# MUSCLE (alignment software)

MUltiple Sequence Comparison by Log-Expectation (MUSCLE) is a computer software for multiple sequence alignment of protein and nucleotide sequences. It is licensed as public domain. The method was published by Robert C. Edgar in two papers in 2004. The first paper, published in Nucleic Acids Research, introduced the sequence alignment algorithm. The second paper, published in BMC Bioinformatics, presented more technical details.

## Algorithm

The MUSCLE algorithm proceeds in three stages: the draft progressive, improved progressive, and refinement stage.

### Stage 1: Draft Progressive

In this first stage, the algorithm produces a multiple alignment, emphasizing speed over accuracy. This step begins by computing the k-mer distance for every pair of input sequences to create a distance matrix. UPGMA clusters the distance matrix to produce a binary tree. From this tree a progressive alignment is constructed, beginning with the creation of profiles for each leaf of the tree. For every node in the tree, a pairwise alignment is constructed of the two child profiles, creating a new profile to be assigned to that node. This continues until there is a multiple sequence alignment of all input sequences at the root of the tree.

### Stage 2: Improved Progressive

This stage focuses on obtaining a more optimal tree by calculating the Kimura distance for each pair of input sequences using the multiple sequence alignment obtained in Stage one, and creates a second distance matrix. UPGMA clusters this distance matrix to obtain a second binary tree. A progressive alignment is performed to obtain a multiple sequence alignment like in Stage 1, but it is optimized by only computing alignments in subtrees whose branching orders have changed from the first binary tree, resulting in a more accurate alignment.

### Stage 3: Refinement

In this final stage, an edge is chosen from the second tree, with edges being visited in decreasing distance from the root. The chosen edge is deleted, dividing the tree into two subtrees. The profile of the multiple alignment is then computed for each subtree. A new multiple sequence alignment is produced by re-aligning the subtree profiles. If the SP score is improved, the new alignment is kept, otherwise, it is discarded. The process of deleting an edge and aligning is repeated until convergence, or until a user-defined limit is reached.

### Complexity and Comparison

In the first two stages of the algorithm, the time complexity is O(N$^2$L + NL$^2$), the space complexity is O(N$^2$ + NL + L$^2$). The refinement stage adds to the time complexity another term, O(N$^3$L). MUSCLE is often used as a replacement for Clustal, since it usually (but not always) gives better sequence alignments, depending on the chosen options. is significantly faster than Clustal, more so for larger alignments.

### Algorithm Flowchart
## Integration

MUSCLE is integrated into DNASTAR's Lasergene software, Geneious, and MacVector and is available in Sequencher, MEGA, and UGENE as a plug-in. MUSCLE is also available as a web service via the European Molecular Biology Laboratory (EMBL)-European Bioinformatics Institute (EBI). As of September 2016, the two papers describing MUSCLE have been cited more than 19,000 times in total.