8 \alias{as.matrix.DNAbin}
9 \title{Manipulate DNA Sequences in Bit-Level Format}
11 These functions help to manipulate DNA sequences coded in the
12 bit-level coding scheme.
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, fill.with.gaps = FALSE,
20 \method{[}{DNAbin}(x, i, j, drop = TRUE)
21 \method{as.matrix}{DNAbin}(x, \dots)
24 \item{x, object}{an object of class \code{"DNAbin"}.}
25 \item{\dots}{either further arguments to be passed to or from other
26 methods in the case of \code{print}, \code{summary}, and
27 \code{as.matrix}, or a series of objects of class \code{"DNAbin"} in
28 the case of \code{rbind} and \code{cbind}.}
29 \item{printlen}{the number of labels to print (6 by default).}
30 \item{digits}{the number of digits to print (3 by default).}
31 \item{check.names}{a logical specifying whether to check the rownames
32 before binding the columns (see details).}
33 \item{fill.with.gaps}{a logical indicating whether to keep all
34 possible individuals as indicating by the rownames, and eventually
35 filling the missing data with insertion gaps (ignored if
36 \code{check.names = FALSE}).}
37 \item{quiet}{a logical to switch off warning messages when some rows
39 \item{i, j}{indices of the rows and/or columns to select or to drop.
40 They may be numeric, logical, or character (in the same way than for
42 \item{drop}{logical; if \code{TRUE} (the default), the returned object
43 is of the lowest possible dimension.}
46 These are all `methods' of generic functions which are here applied to
47 DNA sequences stored as objects of class \code{"DNAbin"}. They are
48 used in the same way than the standard R functions to manipulate
49 vectors, matrices, and lists. Additionally, the operators \code{[[}
50 and \code{$} may be used to extract a vector from a list.
52 These functions are provided to manipulate easily DNA sequences coded
53 with the bit-level coding scheme. The latter allows much faster
54 comparisons of sequences, as well as storing them in less memory
55 compared to the format used before \pkg{ape} 1.10.
57 For \code{cbind}, the default behaviour is to keep only individuals
58 (as indicated by the rownames) for which there are no missing data. If
59 \code{fill.with.gaps = TRUE}, a `complete' matrix is returned,
60 enventually with insertion gaps as missing data. If \code{check.names
61 = TRUE} (the default), the rownames of each matrix are checked, and
62 the rows are reordered if necessary. If \code{check.names = FALSE},
63 the matrices must all have the same number of rows, and are simply
64 binded; the rownames of the first matrix are used. See the examples.
66 \code{as.matrix} may be used to convert DNA sequences (of the same
67 length) stored in a list into a matrix while keeping the names and the
71 an object of class \code{"DNAbin"} in the case of \code{rbind},
72 \code{cbind}, and \code{[}.
75 Paradis, E. (2007) A Bit-Level Coding Scheme for Nucleotides.
76 \url{http://ape.mpl.ird.fr/misc/BitLevelCodingScheme_20April2007.pdf}
78 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
80 \code{\link{as.DNAbin}}, \code{\link{read.dna}},
81 \code{\link{read.GenBank}}, \code{\link{write.dna}}
83 The corresponding generic functions are documented in the package
90 summary(woodmouse, 15, 6)
91 summary(woodmouse[1:5, 1:300], 15, 6)
92 ### Just to show how distances could be influenced by sampling:
93 dist.dna(woodmouse[1:2, ])
94 dist.dna(woodmouse[1:3, ])
95 ### cbind and its options:
96 x <- woodmouse[1:2, 1:5]
97 y <- woodmouse[2:4, 6:10]
98 as.character(cbind(x, y)) # gives warning
99 as.character(cbind(x, y, fill.with.gaps = TRUE))
101 as.character(cbind(x, y, check.names = FALSE)) # gives an error