]> git.donarmstrong.com Git - ape.git/blob - man/as.alignment.Rd
47de1d2d9526f0cbc5960b7ffaeb8993ae44a4ec
[ape.git] / man / as.alignment.Rd
1 \name{as.alignment}
2 \alias{as.alignment}
3 \alias{as.DNAbin}
4 \alias{as.DNAbin.character}
5 \alias{as.DNAbin.list}
6 \alias{as.DNAbin.alignment}
7 \alias{as.character.DNAbin}
8 \title{Conversion Among DNA Sequence Internal Formats}
9 \description{
10   These functions transform a set of DNA sequences among various
11   internal formats.
12 }
13 \usage{
14 as.alignment(x)
15 as.DNAbin(x, ...)
16
17 \method{as.DNAbin}{character}(x, ...)
18
19 \method{as.DNAbin}{list}(x, ...)
20
21 \method{as.DNAbin}{alignment}(x, ...)
22
23 \method{as.character}{DNAbin}(x, ...)
24 }
25 \arguments{
26   \item{x}{a matrix or a list containing the DNA sequences, or an object
27     of class \code{"alignment"}.}
28   \item{\dots}{further arguments to be passed to or from other methods.}
29 }
30 \details{
31   For \code{as.alignment}, the sequences given as argument should be
32   stored as matrices or lists of single-character strings (the format
33   used in \pkg{ape} before version 1.10). The returned object is in the
34   format used in the package \pkg{seqinr} to store aligned sequences.
35
36   \code{as.DNAbin} is a generic function with methods so that it works
37   with sequences stored into vectors, matrices, or lists.
38
39   \code{as.character} is a generic function: the present method
40   converts objects of class \code{"DNAbin"} into the format used
41   before \pkg{ape} 1.10 (matrix of single characters, or list of vectors
42   of single characters). This function must be used first to convert
43   objects of class \code{"DNAbin"} into the class \code{"alignment"}.
44 }
45 \value{
46   an object of class \code{"alignment"} in the case of
47   \code{"as.alignment"}; an object of class \code{"DNAbin"} in the case
48   of \code{"as.DNAbin"}; a matrix of mode character or a list containing
49   vectors of mode character in the case of \code{"as.character"}.
50 }
51 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
52 \seealso{
53   \code{\link{DNAbin}}, \code{\link{read.dna}},
54   \code{\link{read.GenBank}}, \code{\link{write.dna}}
55 }
56 \examples{
57 data(woodmouse)
58 x <- as.character(woodmouse)
59 x[, 1:20]
60 str(as.alignment(x))
61 identical(as.DNAbin(x), woodmouse)
62 }
63 \keyword{manip}