nonsquareDist {alakazam} | R Documentation |
nonsquareDist
calculates all pairwise distance between a set of sequences and a subset of it.
nonsquareDist(seq, indx, dist_mat = getDNAMatrix())
seq |
character vector containing a DNA sequences. The sequence vector needs to be named. |
indx |
numeric vector contating the indices (a subset of indices of |
dist_mat |
Character distance matrix. Defaults to a Hamming distance
matrix returned by getDNAMatrix. If gap
characters, |
A matrix of numerical distance between each entry in seq
and
sequences specified by indx
indices.
Note that the input subsampled indices will be ordered ascendingly. Therefore,
it is necassary to assign unique names to the input sequences, seq
,
to recover the input order later. Row and columns names will be added accordingly.
Amino acid distance matrix may be built with getAAMatrix. Uses seqDist for calculating distances between pairs. See pairwiseEqual for generating an equivalence matrix.
# Gaps will be treated as Ns with a gap=0 distance matrix
seq <- c(A="ATGGC", B="ATGGG", C="ATGGG", D="AT--C")
pairwiseDist(seq,
dist_mat=getDNAMatrix(gap=0))
nonsquareDist(seq, indx=c(1,3),
dist_mat=getDNAMatrix(gap=0))