]> git.donarmstrong.com Git - ape.git/blob - man/read.GenBank.Rd
e323b44f6149841afaa6429493b043de3115b6c3
[ape.git] / man / read.GenBank.Rd
1 \name{read.GenBank}
2 \alias{read.GenBank}
3 \title{Read DNA Sequences from GenBank via Internet}
4 \usage{
5 read.GenBank(access.nb, seq.names = access.nb,
6              species.names = TRUE, as.character = FALSE)
7 }
8 \arguments{
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).}
16 }
17 \description{
18   This function connects to the GenBank database, and reads nucleotide
19   sequences using accession numbers given as arguments.
20 }
21 \value{
22   A list of DNA sequences made of vectors of class \code{"DNAbin"}, or
23   of single characters (if \code{as.character = "TRUE"}).
24 }
25 \details{
26   The function uses the site \url{http://www.ncbi.nlm.nih.gov/} from
27   where the sequences are downloaded.
28
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.
32 }
33 \seealso{
34   \code{\link{read.dna}}, \code{\link{write.dna}},
35   \code{\link{dist.dna}}, \code{\link{DNAbin}}
36 }
37 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
38 \examples{
39 ### This won't work if your computer is not connected
40 ### to the Internet!!!
41 ###
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
47 ### want to try them.
48 \dontrun{
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)
56 Rampho[[1]]
57 ### print the first sequence in a cleaner way
58 cat(Rampho[[1]], "\n", sep = "")
59 }
60 }
61 \keyword{IO}