]> git.donarmstrong.com Git - ape.git/blob - man/read.GenBank.Rd
new code for reading FASTA files
[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, species.names = TRUE,
6              gene.names = FALSE, 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{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
17     single gene.}
18   \item{as.character}{a logical controlling whether to return the
19     sequences as an object of class \code{"DNAbin"} (the default).}
20 }
21 \description{
22   This function connects to the GenBank database, and reads nucleotide
23   sequences using accession numbers given as arguments.
24 }
25 \value{
26   A list of DNA sequences made of vectors of class \code{"DNAbin"}, or
27   of single characters (if \code{as.character = "TRUE"}).
28 }
29 \details{
30   The function uses the site \url{http://www.ncbi.nlm.nih.gov/} from
31   where the sequences are downloaded.
32
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.
36
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).
41 }
42 \seealso{
43   \code{\link{read.dna}}, \code{\link{write.dna}},
44   \code{\link{dist.dna}}, \code{\link{DNAbin}}
45 }
46 \author{Emmanuel Paradis}
47 \examples{
48 ### This won't work if your computer is not connected
49 ### to the Internet!!!
50 ###
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
56 ### want to try them.
57 \dontrun{
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)
65 Rampho[[1]]
66 ### print the first sequence in a cleaner way
67 cat(Rampho[[1]], "\n", sep = "")
68 }
69 }
70 \keyword{IO}