pku-yuangroup/openai4s/bio-alignment-multiple-alignment
Claude Code and agent skill by pku-yuangroup/openai4s
- community
Checking that the SKILL.md file is still in the repository.
Perform multiple sequence alignment using MAFFT, MUSCLE5, ClustalOmega, or T-Coffee. Guides tool and algorithm selection based on dataset size, sequence divergence, and downstream application. Use when aligning three or more homologous sequences for phylogenetics, conservation analysis, or evolutionary studies.
Install
npx vskill@latest install pku-yuangroup/openai4s/bio-alignment-multiple-alignmentSKILL.md
The same SKILL.md was published earlier as pku-yuangroup/openai4s/bio-alignment-multiple-alignment.
Version Compatibility
Reference examples tested with: MAFFT 7.520+, MUSCLE 5.1+, ClustalOmega 1.2.4+, T-Coffee 13+, PAL2NAL 14+, BioPython 1.83+
Before using code patterns, verify installed versions match. If versions differ:
- CLI:
mafft --version,muscle -version,clustalo --version - Python:
pip show biopythonthenhelp(module.function)to check signatures
If code throws errors, introspect the installed tool and adapt the example to match the actual CLI flags rather than retrying.
Multiple Sequence Alignment
"Align multiple sequences" -> Compute an optimal alignment of three or more homologous sequences using progressive, iterative, or consistency-based methods.
- CLI:
mafft(most versatile),muscle(highest accuracy),clustalo(scales well),t_coffee(consistency-based) - Python:
subprocess.run()wrapping CLI tools; BioPythonBio.Align.Applicationswas removed in BioPython 1.86 (verify withpip show biopython); usesubprocessdirectly
MSA Algorithm Taxonomy
When a tool is failing on a dataset, switch to a tool from a different algorithmic family rather than tuning flags. The six families and their characteristic failure modes:
| Family | Representative tools | Best at | Fails when | |
|---|---|---|---|---|
| Progressive | ClustalW, MAFFT FFT-NS-2 | Fast, large datasets, similar lengths | Early-stage gap errors propagate; no recovery | |
| Iterative refinement | MAFFT L-INS-i, MUSCLE3, PRRN | Recovers from progressive errors at <2000 seqs | Slow on >2000; still guide-tree dependent | |
| Consistency-based | T-Coffee, ProbCons | Highest accuracy <100 seqs; integrates evidence | O(N^2 to N^4) scaling; heavy compute | |
| HMM-based | HMMER hmmalign, ClustalOmega (HHalign), UPP, WITCH | Adding sequences to a curated profile; fragmentary input | Needs an existing high-quality profile or backbone | |
| Divide-and-conquer | PASTA, MAGUS, MUSCLE5 super5 | Heterogeneous large datasets (>10k seqs) | Sub-alignment merges can introduce artefacts | |
| Structure or pLM-informed | Foldmason, PROMALS3D, vcMSA, 3D-Coffee | Dark proteome, <15% identity, dataset has structures | Requires structures or a working pLM |
Tool Selection
Pick by dataset size and divergence; the default recommendations follow the table.
| Tool | Best For | Max Sequences | Accuracy | Speed | |
|---|---|---|---|---|---|
| MAFFT L-INS-i | Highest accuracy, <200 seqs | ~200 | Highest | Slow | |
| MAFFT FFT-NS-2 | Large datasets, good balance | ~50,000 | Good | Fast | |
| MAFFT E-INS-i | Sequences with long unalignable internal regions | ~200 | High | Slow | |
MUSCLE5 (PPP -align) | Benchmarked highest accuracy on Balifam-10000 | ~1000 | Highest | Medium | |
MUSCLE5 (-super5) | Large datasets via mBed clustering | ~100,000+ | Good | Medium | |
| ClustalOmega | Very large datasets, HMM-based profiles | ~190,000 in published benchmark (Sievers et al 2011 Mol Syst Biol) | Good | Fast | |
| T-Coffee (default) | Small datasets needing maximum accuracy | ~200 | Highest | Slowest |
Default recommendation: MAFFT L-INS-i for <200 sequences; MAFFT FFT-NS-2 or MUSCLE5 super5 for thousands; MUSCLE5 ensemble (-stratified) when alignment confidence estimates are needed.
Cross-Aligner Sensitivity Check
When downstream analysis depends on a specific column (a candidate selection site, a contact-prediction position), run BOTH MAFFT L-INS-i and MUSCLE5 -align and verify that column is stable across the two outputs. If unstable, flag as low-confidence regardless of GUIDANCE2/TCS scores. The MUSCLE5 ensemble (-stratified/-diversified) accomplishes the same check directly within one tool and is preferred when ensemble output is acceptable downstream.
Beyond MAFFT and MUSCLE: Scale and Domain
Some workloads exceed what the four main tools handle gracefully. Use the scale-and-domain table below to escape default-tool blind spots.
| Scenario | Recommended tool | Why | |
|---|---|---|---|
| 100k - millions of sequences (UniRef cluster reps) | FAMSA v2 (Deorowicz et al 2016 SREP, v2 2024) | Million-scale MSA in hours with Pareto-optimal accuracy | |
| Heterogeneous large dataset (variable length, divergence) | PASTA (Mirarab et al 2015 J Comp Biol) or MAGUS (Smirnov & Warnow 2021 Bioinf) | Divide-and-conquer plus iterative re-alignment | |
| Fragmentary input (metagenomics, eDNA, ancient DNA) | UPP (Nguyen et al 2015 Genome Biol) or WITCH (Shen et al 2022 J Comp Biol) | HMM backbone tolerates partial sequences | |
| Dark proteome / <15% identity | vcMSA (McWhite, Armour-Garb & Singh 2023 Genome Res; alpha-stage tool per its repo README; last release Oct 2023; test on representative inputs before pipeline use) or Foldmason (Gilchrist et al 2024) | pLM-embedding or structural alignment where sequence fails | |
| RNA with secondary structure | Infernal cmalign (Nawrocki & Eddy 2013), R-Coffee, MAFFT-Q-INS-i | Sequence + base-pair consistency | |
| Strand-unknown (Sanger, Nanopore raw) | mafft --adjustdirection --globalpair | Auto-detects and reverse-complements as needed | |
| Adding many sequences to a curated profile | HMMER hmmalign (Eddy 2011 PLOS CB) | Profile-driven; better than mafft --add for Pfam-style use |
vcMSA limitation: Pre-filter input to within ~2x mean length; vcMSA degrades sharply on mixed full-length/fragment input because ProtT5 embeddings encode positional context. For mixed-length sets, segment long sequences via HHsearch domain decomposition before alignment, or use Foldmason on predicted structures.
Critical Concepts
Mitigate Guide-Tree Dependency
All major MSA tools build a guide tree, then align progressively along it; once a gap is inserted in the progressive phase, it is never removed, so early errors propagate. To mitigate: prefer iterative-refinement modes (MAFFT -i, MUSCLE5), use consistency scoring (T-Coffee) for small datasets, and quantify uncertainty with GUIDANCE2 bootstrapping or the MUSCLE5 ensemble before publishing column-specific conclusions.
Joint MSA-Phylogeny Co-estimation (Small Datasets Only)
The theoretically correct answer to guide-tree dependency is to estimate the alignment and tree jointly under a statistical evolutionary model rather than treating MSA as a fixed input to phylogenetic inference. BAli-Phy version 3 (Redelings 2021 Bioinf 37:3032) does this via MCMC, producing a posterior distribution over alignments and trees with insertion/deletion rates as model parameters. Version 3 is O(n) instead of O(n^2) per likelihood evaluation, but the practical ceiling remains ~70-200 sequences before runtime becomes prohibitive (weeks for >100 sequences). When the dataset fits the cap, BAli-Phy gives the most defensible alignment+tree pair for publication; when it does not, the practical alternative is MUSCLE5 ensemble + IQ-TREE per-replicate (Edgar 2022) to approximate posterior alignment uncertainty without joint estimation.
| Dataset size | Recommended approach | |
|---|---|---|
| < 70 sequences | BAli-Phy v3 joint MSA+tree posterior; gold standard | |
| 70 - 200 sequences | BAli-Phy v3 if compute allows (weeks); else MUSCLE5 ensemble + IQ-TREE per replicate | |
| > 200 sequences | MUSCLE5 ensemble (-stratified) + IQ-TREE per replicate; BAli-Phy not feasible | |
| > 1000 sequences | Single MAFFT/MUSCLE5 + standard bootstrap; ensemble methods become intractable |
Sequence Divergence Thresholds
| Protein Identity | Signal Level | Recommendation | |
|---|---|---|---|
| >40% | Strong | Any MSA tool produces reliable alignment | |
| 25-40% | Moderate (twilight zone begins) | Use iterative methods (L-INS-i, MUSCLE5); validate with GUIDANCE2 | |
| 20-25% | Weak | Profile-profile methods (HHpred); consider structural alignment | |
| <15-20% (length-dependent twilight) | Noise dominates signal | Sequence MSA is unreliable; switch to structural alignment (Foldseek, TM-align) or pLM aligners -- see alignment/structural-alignment |
Running MAFFT
Algorithm Selection
MAFFT offers multiple algorithms with explicit accuracy/speed tradeoffs. Selecting the right mode is critical; the difference between L-INS-i and FFT-NS-1 can be the difference between a correct and incorrect downstream phylogeny.
| Algorithm | Flag | Strategy | Best For | |
|---|---|---|---|---|
| FFT-NS-1 | --retree 1 | Progressive only | Quick look, >10,000 seqs | |
| FFT-NS-2 | --retree 2 | Progressive + guide tree rebuild | Default balance, 200-10,000 seqs | |
| FFT-NS-i | --maxiterate 1000 | Iterative refinement | Moderate improvement, 200-2,000 seqs | |
| G-INS-i | --globalpair --maxiterate 1000 | Global pairwise + iterative | Sequences alignable over full length, <200 | |
| L-INS-i | --localpair --maxiterate 1000 | Local pairwise + iterative | Single alignable domain amid divergent flanks, <200 | |
| E-INS-i | --genafpair --maxiterate 1000 | Local with generalized affine gaps | Multiple conserved motifs separated by unalignable regions, <200 | |
| Auto | --auto | Auto-selects based on dataset size | When unsure |
Decision guide: If sequences share a single conserved domain (most common case), use L-INS-i. If sequences are globally similar (e.g., ortholog set of similar length), use G-INS-i. If sequences have multiple conserved blocks separated by highly variable linker regions (e.g., multi-domain proteins with variable interdomain regions), use E-INS-i.
G-INS-i failure mode: When sequences have long divergent N/C-terminal extensions (signal peptides, intrinsically-disordered regions, isoform-specific tails), the global pairwise distance G-INS-i uses for guide-tree construction is dominated by the extension's mismatch content. The guide tree then mis-clusters sequences by extension similarity rather than core homology. Symptom: the resulting alignment has core conserved domains poorly aligned despite high-identity flanks. Switch to L-INS-i (local pairwise; tolerant of divergent flanks) or pre-process to remove signal peptides/disordered regions before alignment.
What --auto Picks (and Why to Specify Explicitly)
mafft --auto silently downgrades the algorithm based on dataset size. The decision tree is roughly:
| Sequences | --auto selects | Equivalent flags | |
|---|---|---|---|
| < 200 | L-INS-i | --localpair --maxiterate 1000 | |
| 200 - 500 | FFT-NS-i | --retree 2 --maxiterate 2 | |
| 500 - 2000 | FFT-NS-2 | --retree 2 --maxiterate 0 | |
| 2000 - 50000 | FFT-NS-2 (one-pass) | --retree 1 --maxiterate 0 | |
| > 50000 | PartTree | --parttree --retree 1 --maxiterate 0 |
The transition at 200 sequences flips the alignment from "iterative-refined accurate" to "single-pass progressive". Note that --auto invokes FFT-NS-i with only --maxiterate 2 in the 200-500 range (a truncated form of the full FFT-NS-i which uses --maxiterate 1000); for best accuracy in this range, specify --retree 2 --maxiterate 1000 explicitly. For publication-quality phylogenetics, specify the algorithm explicitly so reproducibility audits do not rely on internal threshold heuristics.
Basic Usage
Goal: Run MAFFT on a FASTA file with appropriate algorithm selection.
Approach: Invoke MAFFT via command line or subprocess, selecting the algorithm based on dataset characteristics.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/bioskills/bio-alignment-multiple-alignment/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Grok Build (Cursor)
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/pku-yuangroup/openai4s/bio-alignment-multiple-alignment)