]> git.donarmstrong.com Git - ape.git/blob - man/DNAbin.Rd
fixed bugs in multi2di and di2multi + code and doc clean-up
[ape.git] / man / DNAbin.Rd
1 \name{DNAbin}
2 \alias{DNAbin}
3 \alias{print.DNAbin}
4 \alias{summary.DNAbin}
5 \alias{[.DNAbin}
6 \alias{rbind.DNAbin}
7 \alias{cbind.DNAbin}
8 \alias{as.matrix.DNAbin}
9 \title{Manipulate DNA Sequences in Bit-Level Format}
10 \description{
11   These functions help to manipulate DNA sequences coded in the
12   bit-level coding scheme.
13 }
14 \usage{
15 \method{print}{DNAbin}(x, \dots)
16 \method{summary}{DNAbin}(object, printlen = 6, digits = 3, \dots)
17 \method{rbind}{DNAbin}(\dots)
18 \method{cbind}{DNAbin}(\dots, check.names = TRUE)
19 \method{[}{DNAbin}(x, i, j, drop = TRUE)
20 \method{as.matrix}{DNAbin}(x, \dots)
21 }
22 \arguments{
23   \item{x, object}{an object of class \code{"DNAbin"}.}
24   \item{\dots}{either further arguments to be passed to or from other
25     methods in the case of \code{print}, \code{summary}, and
26     \code{as.matrix}, or a series of objects of class \code{"DNAbin"} in
27     the case of \code{rbind} and \code{cbind}.}
28   \item{printlen}{the number of labels to print (6 by default).}
29   \item{digits}{the number of digits to print (3 by default).}
30   \item{check.names}{a logical specifying whether to check the rownames
31     before binding the columns (see details).}
32   \item{i, j}{indices of the rows and/or columns to select or to drop.
33     They may be numeric, logical, or character (in the same way than for
34     standard R objects).}
35   \item{drop}{logical; if \code{TRUE} (the default), the returned object
36     is of the lowest possible dimension.}
37 }
38 \details{
39   These are all `methods' of generic functions which are here applied to
40   DNA sequences stored as objects of class \code{"DNAbin"}. They are
41   used in the same way than the standard R functions to manipulate
42   vectors, matrices, and lists. Additionally, the operators \code{[[}
43   and \code{$} may be used to extract a vector from a list.
44
45   These functions are provided to manipulate easily DNA sequences coded
46   with the bit-level coding scheme. The latter allows much faster
47   comparisons of sequences, as well as storing them in less memory
48   compared to the format used before \pkg{ape} 1.10.
49
50   For \code{cbind}, if \code{"check.names = TRUE"}, the rownames of each
51   matrix are checked, and the rows are reordered if necessary. If the
52   rownames differ among matrices, an error occurs. If
53   \code{"check.names = FALSE"}, the matrices are simply binded and the
54   rownames of the first matrix are used.
55
56   \code{as.matrix} may be used to convert DNA sequences (of the same
57   length) stored in a list into a matrix while keeping the names and the
58   class.
59 }
60 \value{
61   an object of class \code{"DNAbin"} in the case of \code{rbind},
62   \code{cbind}, and \code{[}.
63 }
64 \references{
65   Paradis, E. (2007) A Bit-Level Coding Scheme for Nucleotides.
66   \url{http://ape.mpl.ird.fr/misc/BitLevelCodingScheme_20April2007.pdf}
67 }
68 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
69 \seealso{
70   \code{\link{as.DNAbin}}, \code{\link{read.dna}},
71   \code{\link{read.GenBank}}, \code{\link{write.dna}}
72
73   The corresponding generic functions are documented in the package
74   \pkg{base}.
75 }
76 \examples{
77 data(woodmouse)
78 woodmouse
79 summary(woodmouse)
80 summary(woodmouse, 15, 6)
81 summary(woodmouse[1:5, 1:300], 15, 6)
82 ### Just to show how distances could be influenced by sampling:
83 dist.dna(woodmouse[1:2, ])
84 dist.dna(woodmouse[1:3, ])
85 }
86 \keyword{manip}