pairwiseEqual - Calculate pairwise equivalence between sequences
Description¶
pairwiseEqual determined pairwise equivalence between a pairs in a
set of sequences, excluding ambiguous positions (Ns and gaps).
Usage¶
pairwiseEqual(seq, ignore = as.character(c("N", "-", ".", "?")))
Arguments¶
- seq
- character vector containing a DNA sequences.
- ignore
- vector of characters to ignore when testing for equality. Default is to ignore c(“N”,”-“,”.”,”?”)
Value¶
A logical matrix of equivalence between each entry in seq.
Values are TRUE when sequences are equivalent and FALSE
when they are not.
Examples¶
# Gaps and Ns will match any character
seq <- c(A="ATGGC", B="ATGGG", C="ATGGG", D="AT--C", E="NTGGG")
d <- pairwiseEqual(seq)
rownames(d) <- colnames(d) <- seq
d
ATGGC ATGGG ATGGG AT--C NTGGG
ATGGC TRUE FALSE FALSE TRUE FALSE
ATGGG FALSE TRUE TRUE FALSE TRUE
ATGGG FALSE TRUE TRUE FALSE TRUE
AT--C TRUE FALSE FALSE TRUE FALSE
NTGGG FALSE TRUE TRUE FALSE TRUE
# Ignore only Ns, so that gaps are not treated as matching any character
d <- pairwiseEqual(seq, ignore="N")
rownames(d) <- colnames(d) <- seq
d
ATGGC ATGGG ATGGG AT--C NTGGG
ATGGC TRUE FALSE FALSE FALSE FALSE
ATGGG FALSE TRUE TRUE FALSE TRUE
ATGGG FALSE TRUE TRUE FALSE TRUE
AT--C FALSE FALSE FALSE TRUE FALSE
NTGGG FALSE TRUE TRUE FALSE TRUE
See also¶
Uses seqEqual for testing equivalence between pairs. See pairwiseDist for generating a sequence distance matrix.