Skip to contents

MuscleAlign follows the three stages of MUSCLE (Edgar 2004): a draft from k-mer distances (1 - F, F the shared k-mer count over min(|x|, |y|) - k + 1), a UPGMA guide tree and progressive profile-profile alignment (Gotoh affine gaps, frequency-weighted mean substitution score per column pair); an improved alignment from Kimura distances -ln(1 - p - p^2/5) of the draft (10 when undefined) and a second UPGMA tree; and tree-dependent restricted partitioning, re-aligning the two sub-alignments on either side of each edge (deepest first) and keeping the result when the sum-of-pairs score rises, until a pass brings no gain or max_iters. Simplifications against MUSCLE 3: no sequence weights, constant gap penalties (ends included) and BLOSUM62 or +5/-4 nucleotide scores instead of the log-expectation profile function. SumOfPairsScore is the objective: over all row pairs, columns gapped in both are dropped, residue pairs score S(a, b) and a gap run of length L costs gap_open + (L - 1) gap_extend. Identical to the Python arm morie.fn.musclemsa.

Usage

MuscleAlign(
  sequences,
  matrix = NULL,
  gap_open = 10,
  gap_extend = 1,
  k = 3,
  max_iters = 16
)

SumOfPairsScore(alignment, matrix = NULL, gap_open = 10, gap_extend = 1)

Arguments

sequences

Character vector of unaligned sequences.

matrix

"blosum62", "nucleotide" or a square score matrix with letter dimnames; chosen from the alphabet when NULL.

gap_open, gap_extend

Affine gap costs.

k

k-mer length for the draft distances.

max_iters

Maximum refinement passes.

alignment

Character vector of aligned rows (gap -).

Value

MuscleAlign: list with alignment (input order), sp_score, sp_draft, sp_improved, accepted, tree1 and tree2 (UPGMA merges, 1-based node ids). SumOfPairsScore: the score.

References

Edgar, R. C. (2004). MUSCLE: multiple sequence alignment with high accuracy and high throughput. Nucleic Acids Research 32, 1792-1797.

Edgar, R. C. (2004). MUSCLE: a multiple sequence alignment method with reduced time and space complexity. BMC Bioinformatics 5, 113.

Examples

r <- MuscleAlign(c("ACGTACGT", "ACGACGT", "ACGTTACGT"))
r$alignment
#> [1] "ACG-TACGT" "ACG--ACGT" "ACGTTACGT"
SumOfPairsScore(c("AC-GT", "ACGGT"), matrix = "nucleotide")
#> [1] 10