Learn R Programming

ips (version 0.0-7)

deleteEmptyCells: Delete Spurious Rows and Columns from DNA Alignments

Description

After subsetting (see e.g. DNAbin), DNA sequence alignments can contain rows and columns that consist entirely of missing and/or ambiguous character states. deleteEmptyCells will delete all such rows (taxa) and columns (characters) from a DNA sequence alignment.

Usage

deleteEmptyCells(DNAbin, nset = c("-", "n", "?"), 
  quiet = FALSE)

Arguments

DNAbin

an object of class DNAbin.

nset

vector of mode character; rows or colums that consist only of the characters given in nset will be deleted from the alignment.

quiet

logical: if set to TRUE, screen output will be suppressed

Value

an object of class DNAbin.

Details

For faster execution, deleteEmptyCells handles sequences in ape's bit-level coding scheme. As a consequence, nset cannot be extended by the user and the use of IUPAC ambiguity symbols other than 'N' is currently not possible.

See Also

trimEnds, deleteGaps

Examples

Run this code
# NOT RUN {
# 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)

# delete those rows and colums
x <- deleteEmptyCells(x)
image(x)
# }

Run the code above in your browser using DataLab