3 \title{Read DNA Sequences from GenBank via Internet}
5 read.GenBank(access.nb, seq.names = access.nb,
6 species.names = TRUE, 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{as.character}{a logical controlling whether to return the
15 sequences as an object of class \code{"DNAbin"} (the default).}
18 This function connects to the GenBank database, and reads nucleotide
19 sequences using accession numbers given as arguments.
22 A list of DNA sequences made of vectors of class \code{"DNAbin"}, or
23 of single characters (if \code{as.character = "TRUE"}).
26 The function uses the site \url{http://www.ncbi.nlm.nih.gov/} from
27 where the sequences are downloaded.
29 If \code{species.names = TRUE}, the returned list has an attribute
30 \code{"species"} containing the names of the species taken from the
31 field ``ORGANISM'' in GenBank.
34 \code{\link{read.dna}}, \code{\link{write.dna}},
35 \code{\link{dist.dna}}, \code{\link{DNAbin}}
37 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
39 ### This won't work if your computer is not connected
40 ### to the Internet!!!
42 ### Get the 8 sequences of tanagers (Ramphocelus)
43 ### as used in Paradis (1997)
44 ref <- c("U15717", "U15718", "U15719", "U15720",
45 "U15721", "U15722", "U15723", "U15724")
46 ### Copy/paste or type the following commands if you
49 Rampho <- read.GenBank(ref)
50 ### get the species names:
51 attr(Rampho, "species")
52 ### build a matrix with the species names and the accession numbers:
53 cbind(attr(Rampho, "species"), names(Rampho))
54 ### print the first sequence
55 ### (can be done with `Rampho$U15717' as well)
57 ### print the first sequence in a cleaner way
58 cat(Rampho[[1]], "\n", sep = "")