dots.to.bases {ComPairWise}R Documentation

Convert alignment formats from dot-match to all bases

Description

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.

Usage

dots.to.bases(alignment, matchchar = ".")

Arguments

alignment

An alignment object

matchchar

Character designating matched base

Value

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

Note

Designed as an internal function, and is called by read.nexus, but works as a standalone.

Author(s)

TER

See Also

read.nexus, read.phylip, aln.to.matrix

Examples


## 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)
  }

[Package ComPairWise version 1.01 Index]