3 \title{Read DNA Sequences from GenBank via Internet}
5 read.GenBank(access.nb, seq.names = access.nb, species.names = TRUE,
6 gene.names = FALSE, as.character = FALSE)
9 \item{access.nb}{a vector of mode character giving the accession numbers.}
10 \item{seq.names}{the names to give to each sequence; by default the
11 accession numbers are used.}
12 \item{species.names}{a logical indicating whether to attribute the
13 species names to the returned object.}
14 \item{gene.names}{a logical indicating whether to attribute the
15 gene names to the returned object. It is \code{FALSE} by default
16 because this will work correctly only when reading sequences with a
18 \item{as.character}{a logical controlling whether to return the
19 sequences as an object of class \code{"DNAbin"} (the default).}
22 This function connects to the GenBank database, and reads nucleotide
23 sequences using accession numbers given as arguments.
26 A list of DNA sequences made of vectors of class \code{"DNAbin"}, or
27 of single characters (if \code{as.character = "TRUE"}).
30 The function uses the site \url{http://www.ncbi.nlm.nih.gov/} from
31 where the sequences are downloaded.
33 If \code{species.names = TRUE}, the returned list has an attribute
34 \code{"species"} containing the names of the species taken from the
35 field ``ORGANISM'' in GenBank.
37 If \code{gene.names = TRUE}, the returned list has an attribute
38 \code{"gene"} containing the names of the gene. This will not work
39 correctly if reading a sequence with multiple genes (e.g., a
40 mitochondrial genome).
43 \code{\link{read.dna}}, \code{\link{write.dna}},
44 \code{\link{dist.dna}}, \code{\link{DNAbin}}
46 \author{Emmanuel Paradis}
48 ### This won't work if your computer is not connected
49 ### to the Internet!!!
51 ### Get the 8 sequences of tanagers (Ramphocelus)
52 ### as used in Paradis (1997)
53 ref <- c("U15717", "U15718", "U15719", "U15720",
54 "U15721", "U15722", "U15723", "U15724")
55 ### Copy/paste or type the following commands if you
58 Rampho <- read.GenBank(ref)
59 ### get the species names:
60 attr(Rampho, "species")
61 ### build a matrix with the species names and the accession numbers:
62 cbind(attr(Rampho, "species"), names(Rampho))
63 ### print the first sequence
64 ### (can be done with `Rampho$U15717' as well)
66 ### print the first sequence in a cleaner way
67 cat(Rampho[[1]], "\n", sep = "")