| dots.to.bases {ComPairWise} | R Documentation |
dot.to.bases takes an alignment in which bases that match the first taxon are shown with a dot or other character, and replaces them with the base.
dots.to.bases(alignment, matchchar = ".")
alignment |
An alignment object |
matchchar |
Character designating matched base |
A new alignment object, whose elements are
nb |
Number of aligned sequences |
nam |
Character vector of the names of the sequences |
seq |
Character vector of the sequences |
com |
currently always NA; could be a comment |
Designed as an internal function, and is called by read.nexus, but works as a standalone.
TER
read.nexus, read.phylip, aln.to.matrix
## The function is currently defined as
function (alignment, matchchar = ".")
{
dotsout <- function(aln.column) {
aln.column[aln.column == matchchar] <- aln.column[1]
return(aln.column)
}
aln.new <- aln.to.matrix(alignment, F)
aln.new <- apply(aln.new, 2, dotsout)
aln.new <- matrix.to.aln(aln.new)
alignment$seq <- aln.new$seq
return(alignment)
}