Multiple sequence alignment as a sequence-to-sequence learning problem

Edo Dotan, Yonatan Belinkov, Oren Avram, Elya Wygoda, Noa Ecker, Michael Alburquerque, Omri Keren, Gil Loewenthal, Tal PupkoICLR 2023

Multiple Sequence Alignment (MSA) is a cornerstone of bioinformatics, essential for tasks ranging from vaccine development to tracing evolutionary history. It involves arranging DNA, RNA, or protein sequences to identify regions of similarity that indicate evolutionary relationships.

For decades, the field has relied on algorithmic heuristics that use fixed "cost matrices" to assign penalties for gaps (insertions/deletions) and rewards for matching characters. However, evolution is not one-size-fits-all. Different species and genomic regions evolve at different rates and under varying constraints. Traditional tools often act as "black boxes" that are difficult to tune for specific biological contexts, frequently struggling with complex evolutionary events that defy their predefined mathematical models.

To address these limitations, researchers have introduced BetaAlign, a novel methodology that reimagines MSA as a Natural Language Processing (NLP) sequence-to-sequence translation task. By training an ensemble of Transformers on millions of simulated evolutionary scenarios, BetaAlign demonstrates that deep learning can match or outperform industry-standard heuristic tools, offering a highly flexible, data-driven approach to understanding biological homology.

Methodology: Treating Evolution as a Language

BetaAlign formulates the alignment process as a translation problem, treating unaligned sequences as a "source language" and the final alignment as a "target language."

BetaAlign formulates multiple sequence alignment as a sequence-to-sequence translation task, converting concatenated input sequences into an interleaved aligned output.
  1. Translation Framework: Unaligned sequences are concatenated and separated by a pipe character (|). The model then produces an interleaved string where characters from different sequences are paired column-by-column, effectively generating the alignment.
  2. Segmented Transformers: Standard Transformers have a computational complexity of $O(L^2)$ relative to sequence length, making long biological sequences difficult to process. BetaAlign solves this by splitting sequences into overlapping segments. It uses a specialized "segmented transformer" that ensures the last column of each aligned block is "indel-free" (no gaps), allowing segments to be stitched back together seamlessly.
  3. Ensemble Approach: To ensure biological validity, BetaAlign uses an ensemble of transformers. If a primary model produces an "invalid" alignment (e.g., accidentally mutating a character or returning sequences of unequal length), the system falls back on alternative models to find a valid solution.
  4. Simulation-Based Training: Because "perfect" real-world alignments are rare, the authors utilized the SpartaABC simulator to generate millions of training samples based on diverse evolutionary models, covering various substitution and insertion/deletion (indel) rates.

Key Insights

  • The "Grammar" of Evolution: BetaAlign suggests that the rules governing how DNA changes over time can be learned as a language. The Transformer does not need to be explicitly told the "cost" of a gap; it learns the probability of a gap appearing based on the surrounding context.
  • Split Attention: In standard NLP translation, attention usually follows a single diagonal. In BetaAlign, the attention map "splits" into multiple diagonals—one for each sequence being aligned—demonstrating that the model simultaneously tracks homology across all inputs.
  • Context Matters: Unlike traditional tools that apply rigid rules to every dataset, BetaAlign can be fine-tuned for specific clades (groups of organisms). In theory, researchers could train specialized models (e.g., a "Virus-Aligner") that inherently understand the specific mutation patterns of those groups.

Performance and Results

The authors benchmarked BetaAlign against state-of-the-art (SOTA) tools, including MAFFT, DIALIGN, ClustalW, T-Coffee, PRANK, and MUSCLE, using both nucleotide (SND1) and protein (SPD1LG) datasets.

Comparison of CS-error rates across different alignment tools for nucleotide and protein sequences as the number of input sequences increases.
  • Superior Accuracy: On simulated nucleotide datasets, BetaAlign achieved the lowest error rate compared to all SOTA tools (paired t-test; $p < 10^{-20}$).
  • Robustness to Complexity: In scenarios involving "model misspecification"—where the test data evolved differently than the training data—BetaAlign remained more accurate than traditional tools, which often broke down when their internal heuristic assumptions were violated.
  • Protein Performance: BetaAlign and PRANK outperformed other methods on protein datasets with high deletion rates, with BetaAlign showing better consistency across different protein domain structures.

Limitations and Future Work

While BetaAlign represents a significant leap forward, it currently faces a few limitations. First is scalability: while it handles long sequences via segmentation, it is currently limited in the number of sequences it can align simultaneously (benchmarked up to 10). Scaling to hundreds of sequences remains a challenge. Second is computational cost: unlike lightweight heuristic tools that run easily on a CPU, BetaAlign requires GPUs for efficient inference.

Finally, the current training models assume homogeneity, meaning mutation rules are treated as uniform across the entire length of a sequence. In reality, regions like the ends of proteins often evolve differently than the core. Future iterations of BetaAlign could incorporate these spatial variations into the training simulations, further refining its biological accuracy.

Summary updated

BibTeX
@inproceedings{dotan2023multiple,
  author = {Edo Dotan and Yonatan Belinkov and Oren Avram and Elya Wygoda and Noa Ecker and Michael Alburquerque and Omri Keren and Gil Loewenthal and Tal Pupko},
  title = {{Multiple sequence alignment as a sequence-to-sequence learning problem}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=8efJYMBrNb},
}
Figure