restez (version 2.1.4)

entrez_fetch: Entrez fetch

Description

Wrapper for rentrez::entrez_fetch.

Usage

entrez_fetch(db, id = NULL, rettype, retmode = "", ...)

Value

character string containing the file created

Arguments

db

character, name of the database

id

vector, unique ID(s) for record(s)

rettype

character, data format

retmode

character, data mode

...

Arguments to be passed on to rentrez

Supported return types and modes

XML retmode is not supported. Rettypes 'seqid', 'ft', 'acc' and 'uilist' are also not supported.

Details

Attempts to first search local database with user-specified parameters, if the record is missing in the database, the function then calls rentrez::entrez_fetch to search GenBank remotely.

rettype='fasta' and rettype='gb' are respectively equivalent to gb_fasta_get() and gb_record_get().

See Also

rentrez::entrez_fetch()

Examples

Run this code
library(restez)
restez_path_set(tempdir())
demo_db_create(n = 5)
# return fasta record
fasta_res <- entrez_fetch(db = 'nucleotide',
                          id = c('demo_1', 'demo_2'),
                          rettype = 'fasta')
cat(fasta_res)
# return whole GB record in text format
gb_res <- entrez_fetch(db = 'nucleotide',
                       id = c('demo_1', 'demo_2'),
                       rettype = 'gb')
cat(gb_res)
# NOT RUN
# whereas these request would go through rentrez
# fasta_res <- entrez_fetch(db = 'nucleotide',
#                           id = c('S71333', 'S71334'),
#                           rettype = 'fasta')
# gb_res <- entrez_fetch(db = 'nucleotide',
#                        id = c('S71333', 'S71334'),
#                        rettype = 'gb')

# delete demo after example
db_delete(everything = TRUE)

Run the code above in your browser using DataCamp Workspace