EmptyCells | R Documentation |
After subsetting (see e.g. DNAbin
), DNA sequence
alignments can contain rows and columns that consist entirely of missing
and/or ambiguous character states. identifyEmptyCells
will identify
and deleteEmptyCells
will delete all such rows (taxa) and columns
(characters) from a DNA sequence alignment.
deleteEmptyCells(
DNAbin,
margin = c(1, 2),
nset = c("-", "n", "?"),
quiet = FALSE
)
identifyEmptyCells(
DNAbin,
margin = c(1, 2),
nset = c("-", "n", "?"),
quiet = FALSE
)
DNAbin |
An object of class |
margin |
A vector giving the subscripts the function will be applied
over: |
nset |
A vector of mode character; rows or columns that consist
only of the characters given in |
quiet |
Logical: if set to |
For faster execution, deleteEmptyCells
handles sequences in
ape's bit-level coding scheme.
An object of class DNAbin
.
Cornish-Bowden, A. 1984. Nomenclature for incompletely specified bases in nucleic acid sequences: recommendations 1984. Nucleic Acids Res. 13: 3021–3030.
trimEnds
, deleteGaps
# COX1 sequences of bark beetles
data(ips.cox1)
# introduce completely ambiguous rows and colums
x <- as.character(ips.cox1[1:6, 1:60])
x[3, ] <- rep("n", 60)
x[, 20:24] <- rep("-", 6)
x <- as.DNAbin(x)
image(x)
# identify those rows and colums
(id <- identifyEmptyCells(x))
xx <- x[-id$row, -id$col]
# delete those rows and colums
x <- deleteEmptyCells(x)
image(x)
identical(x, xx)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.