genbank: A function to open the browser to Genbank with the selected...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/query.R

Description

Given a vector of Genbank accession numbers or NCBI UIDs, the user can either have a browser display a URL showing a Genbank query for those identifiers, or a XMLdoc object with the same data.

Usage

1
2
genbank(...,disp=c("data","browser"), type=c("accession","uid"),
        pmaddress=.efetch("gene", disp, type))

Arguments

...

Vectorized set of Genbank accession numbers or NCBI UIDs

disp

Either "Data" or "Browser" (default is data). Data returns a XMLDoc, while Browser will display information in the user's browser.

type

Denotes whether the arguments are accession numbers or UIDS. Defaults to accession values.

pmaddress

Specific path to the pubmed efetch engine from the NCBI website.

Details

A simple function to retrieve Genbank data given a specific ID, either through XML or through a web browser. This function will accept either Genbank accession numbers or NCBI UIDs (defined as a Pubmed ID or a Medline ID) - although the types must not be mixed in a single call.

WARNING: The powers that be at NCBI have been known to ban the IP addresses of users who abuse their servers (currently defined as less then 2 seconds between queries). Do NOT put this function in a tight loop or you may find your access revoked.

Value

If the option "data" is used, an object of type XMLDoc is returned, unless there was an error with the query in which case an object of type try-error is returned.

If the option "browser" is used, nothing is returned.

Author(s)

R. Gentleman

See Also

pubmed, xmlTreeParse

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
   ## Use UIDs to get data in both browser & data forms

   if ( interactive() ) {
      disp <- c("data","browser")
   } else {
      disp <- "data"
   }

   for (dp in disp)
     genbank("12345","9997",disp=dp,type="uid")

   ## Use accession numbers to retrieve browser info
   if ( interactive() )
       genbank("U03397","AF030427",disp="browser")

annotate documentation built on Nov. 8, 2020, 8:14 p.m.