Agent skill

Bio Alignment Multiple

by GPTomics in GPTomics/bioSkills

Perform multiple sequence alignment using MAFFT, MUSCLE5, ClustalOmega, or T-Coffee.

MITAuto-check passedResearch & Science

Install Bio Alignment Multiple

skills CLI
$ npx skills add GPTomics/bioSkills --skill bio-alignment-multiple -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install GPTomics/bioSkills bio-alignment-multiple --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/GPTomics/bioSkills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/alignment/multiple-alignment .claude/skills/bio-alignment-multiple && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
bio-alignment-multiple
GitHub stars
1.2k
Used in
2 other repos
Token cost
~8.4k tokens
SKILL.md length
3,522 words
Files
4
Skills in repo
553
Repo updated
First seen
Licence
MIT

At a glance

Perform multiple sequence alignment using MAFFT, MUSCLE5, ClustalOmega, or T-Coffee.

  • Works in 6 steps: Visual inspection: Scan for columns of… → Gap distribution: High gap fraction… → Sequence identity: If average pairwise… → …
  • More homologous sequences for phylogenetics
  • SKILL.md covers Version Compatibility, MSA Algorithm Taxonomy, Tool Selection and Critical Concepts, plus 6 more sections
  • Runs Python scripts from its folder; calls java and pip

What it does

Bio Alignment Multiple is an agent skill from GPTomics/bioSkills. 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.

Its SKILL.md is about 8.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files (for example `examples/codon_alignment.py`, `examples/run_msa.py` and `usage-guide.md`).

It sits in Research & Science, covering Bioinformatics. It works with Biopython. The repository describes itself as: a set of SKILLS.md for doing bioinformatics with agents like claude code. The licence is MIT.

When your agent uses it

  • More homologous sequences for phylogenetics
  • Conservation analysis
  • Evolutionary studies

Example prompts

  • “/bio-alignment-multiple”

Requirements

  • Python 3

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Visual inspection: Scan for columns of mostly gaps with scattered residues (hallmark of misalignment)
  2. Gap distribution: High gap fraction (>50% of columns with gaps) suggests problematic regions or inclusion of non-homologous sequences
  3. Sequence identity: If average pairwise identity is <25% for proteins, alignment reliability is questionable
  4. Outlier sequences: Sequences with excessive gaps relative to others may be non-homologous or fragments; consider removing and re-aligning
  5. Conservation pattern: Functional domains should show clear conservation; absence of expected conserved motifs suggests alignment error or…
  6. Run GUIDANCE2 or MUSCLE5 ensemble: Quantify alignment confidence per column before phylogenetic inference

What it can do on your machine

Read from SKILL.md and the folder at commit d91ed3d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • java
    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use pip, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Bio Alignment Multiple loads about 8.4k tokens when it runs. Until then it costs about 84 tokens; SKILL.md has 3,522 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~84
When it runs · the whole SKILL.md, loaded when a task matches
~8.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from GPTomics/bioSkills at commit d91ed3d, republished under its MIT licence (© GPTomics). 3,522 words, ~8,439 tokens.

Download SKILL.mdSave it as .claude/skills/bio-alignment-multiple/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
bio-alignment-multiple
description
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.
tool_type
mixed
primary_tool
MAFFT

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 biopython then help(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; BioPython Bio.Align.Applications was removed in BioPython 1.86 (verify with pip show biopython); use subprocess directly

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:

FamilyRepresentative toolsBest atFails when
ProgressiveClustalW, MAFFT FFT-NS-2Fast, large datasets, similar lengthsEarly-stage gap errors propagate; no recovery
Iterative refinementMAFFT L-INS-i, MUSCLE3, PRRNRecovers from progressive errors at <2000 seqsSlow on >2000; still guide-tree dependent
Consistency-basedT-Coffee, ProbConsHighest accuracy <100 seqs; integrates evidenceO(N^2 to N^4) scaling; heavy compute
HMM-basedHMMER hmmalign, ClustalOmega (HHalign), UPP, WITCHAdding sequences to a curated profile; fragmentary inputNeeds an existing high-quality profile or backbone
Divide-and-conquerPASTA, MAGUS, MUSCLE5 super5Heterogeneous large datasets (>10k seqs)Sub-alignment merges can introduce artefacts
Structure or pLM-informedFoldmason, PROMALS3D, vcMSA, 3D-CoffeeDark proteome, <15% identity, dataset has structuresRequires structures or a working pLM

Tool Selection

Pick by dataset size and divergence; the default recommendations follow the table.

ToolBest ForMax SequencesAccuracySpeed
MAFFT L-INS-iHighest accuracy, <200 seqs~200HighestSlow
MAFFT FFT-NS-2Large datasets, good balance~50,000GoodFast
MAFFT E-INS-iSequences with long unalignable internal regions~200HighSlow
MUSCLE5 (PPP -align)Benchmarked highest accuracy on Balifam-10000~1000HighestMedium
MUSCLE5 (-super5)Large datasets via mBed clustering~100,000+GoodMedium
ClustalOmegaVery large datasets, HMM-based profiles~190,000 in published benchmark (Sievers et al 2011 Mol Syst Biol)GoodFast
T-Coffee (default)Small datasets needing maximum accuracy~200HighestSlowest

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.

ScenarioRecommended toolWhy
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% identityvcMSA (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 structureInfernal cmalign (Nawrocki & Eddy 2013), R-Coffee, MAFFT-Q-INS-iSequence + base-pair consistency
Strand-unknown (Sanger, Nanopore raw)mafft --adjustdirection --globalpairAuto-detects and reverse-complements as needed
Adding many sequences to a curated profileHMMER 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 sizeRecommended approach
< 70 sequencesBAli-Phy v3 joint MSA+tree posterior; gold standard
70 - 200 sequencesBAli-Phy v3 if compute allows (weeks); else MUSCLE5 ensemble + IQ-TREE per replicate
> 200 sequencesMUSCLE5 ensemble (-stratified) + IQ-TREE per replicate; BAli-Phy not feasible
> 1000 sequencesSingle MAFFT/MUSCLE5 + standard bootstrap; ensemble methods become intractable
Sequence Divergence Thresholds
Protein IdentitySignal LevelRecommendation
>40%StrongAny MSA tool produces reliable alignment
25-40%Moderate (twilight zone begins)Use iterative methods (L-INS-i, MUSCLE5); validate with GUIDANCE2
20-25%WeakProfile-profile methods (HHpred); consider structural alignment
<15-20% (length-dependent twilight)Noise dominates signalSequence 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.

AlgorithmFlagStrategyBest For
FFT-NS-1--retree 1Progressive onlyQuick look, >10,000 seqs
FFT-NS-2--retree 2Progressive + guide tree rebuildDefault balance, 200-10,000 seqs
FFT-NS-i--maxiterate 1000Iterative refinementModerate improvement, 200-2,000 seqs
G-INS-i--globalpair --maxiterate 1000Global pairwise + iterativeSequences alignable over full length, <200
L-INS-i--localpair --maxiterate 1000Local pairwise + iterativeSingle alignable domain amid divergent flanks, <200
E-INS-i--genafpair --maxiterate 1000Local with generalized affine gapsMultiple conserved motifs separated by unalignable regions, <200
Auto--autoAuto-selects based on dataset sizeWhen 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 selectsEquivalent flags
< 200L-INS-i--localpair --maxiterate 1000
200 - 500FFT-NS-i--retree 2 --maxiterate 2
500 - 2000FFT-NS-2--retree 2 --maxiterate 0
2000 - 50000FFT-NS-2 (one-pass)--retree 1 --maxiterate 0
> 50000PartTree--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.

bash
# Highest accuracy for <200 sequences (local pairwise iterative)
mafft --localpair --maxiterate 1000 input.fasta > aligned.fasta

# Good balance for medium datasets
mafft --retree 2 input.fasta > aligned.fasta

# Auto-select algorithm based on dataset size
mafft --auto input.fasta > aligned.fasta

# Protein alignment with specific matrix (default BLOSUM62)
mafft --amino --localpair --maxiterate 1000 input.fasta > aligned.fasta

# DNA alignment (auto-detected, but can be explicit)
mafft --nuc --localpair --maxiterate 1000 input.fasta > aligned.fasta

# Adjust gap penalties (op=gap open, ep=gap extension)
mafft --op 1.53 --ep 0.123 --localpair --maxiterate 1000 input.fasta > aligned.fasta

# Multithreaded
mafft --thread 8 --localpair --maxiterate 1000 input.fasta > aligned.fasta
python
import subprocess

def run_mafft(input_fasta, output_fasta, algorithm='linsi', threads=4):
    algo_flags = {
        'linsi': ['--localpair', '--maxiterate', '1000'],
        'ginsi': ['--globalpair', '--maxiterate', '1000'],
        'einsi': ['--genafpair', '--maxiterate', '1000'],
        'fftns2': ['--retree', '2'],
        'auto': ['--auto'],
    }
    cmd = ['mafft', '--thread', str(threads)] + algo_flags[algorithm] + [input_fasta]
    with open(output_fasta, 'w') as out:
        result = subprocess.run(cmd, stdout=out, stderr=subprocess.PIPE, text=True)
    if result.returncode != 0:
        raise RuntimeError(f'MAFFT failed (exit {result.returncode}):\n{result.stderr}')

run_mafft('sequences.fasta', 'aligned.fasta', algorithm='linsi')

MAFFT writes its progress log and errors to stderr, not stdout. Capturing stderr and surfacing the failure message is essential when MAFFT exits non-zero (e.g. encountering ambiguous characters, oversized input, missing libraries) -- otherwise check=True raises a CalledProcessError without showing the actionable message.

Adding Sequences to an Existing Alignment

Goal: Add new sequences to an existing MSA without realigning the entire dataset.

Approach: Use MAFFT's --add for full-length sequences, --addfragments for partial / surveillance / metagenomic reads. The two flags are NOT interchangeable.

FlagUse whenBehaviour
--addNew sequences are full-length homologuesEach new sequence is profile-aligned end-to-end
--addfragmentsNew sequences are partial (reads, contigs, surveillance amplicons)Free terminal gaps; new sequences may align to a sub-region of the profile
--addprofileAdding an entire pre-aligned profileProfile-profile alignment
--keeplengthOutput must have the same column count as input MSAInsertions in new sequences are dropped (key for HMMER/Pfam-style use)
bash
# Full-length additions; may extend alignment with new columns
mafft --add new_seqs.fasta existing_alignment.fasta > updated.fasta

# Partial reads or fragments; common for SARS-CoV-2 surveillance
mafft --addfragments new_reads.fasta --keeplength reference_msa.fasta > updated.fasta

# Profile-profile merge
mafft --addprofile second_msa.fasta first_msa.fasta > merged.fasta

For HMM-curated families (Pfam, Rfam), hmmalign --trim --outformat afa profile.hmm new_seqs.fa > out.fasta is the canonical alternative; it constrains insertions to lowercase columns rather than introducing new alignment columns and is the format expected by downstream HMMER/HHsuite tooling.

Running MUSCLE5

Pick -align (PPP) for peak-accuracy runs up to ~1000 sequences, or -super5 (mBed clustering + chunked alignment) for thousands to millions. -super5 is not a "lower quality" mode; both share the same HMM-perturbation ensemble machinery.

CommandAlgorithmDesigned forOutput
-align (PPP)Posterior probability progressive (HMM)<= ~1000 seqs, peak accuracySingle MSA or .efa ensemble
-super5mBed-clustering + chunked alignmentThousands to millions of seqsSingle MSA or .efa ensemble
Basic Usage
bash
# Peak accuracy PPP algorithm, <1000 sequences
muscle -align input.fasta -output aligned.fasta -threads 8

# super5 divide-and-conquer for thousands of sequences
muscle -super5 input.fasta -output aligned.fasta -threads 8
Ensemble Mode for Alignment Confidence

Goal: Quantify alignment uncertainty by generating multiple HMM-perturbed alignments and measuring column consistency.

Approach: MUSCLE5 (Edgar 2022 Nat Comm) ships two ensemble modes: -stratified (16 replicates by default: the -replicates flag defaults to 4 HMM-perturbation seeds x 4 guide-tree permutations) and -diversified (100 replicates by default). Both write an Ensemble FASTA (.efa) file containing all replicates; column-level confidence is the fraction of replicates that place a given residue pair in the same column. -perturb SEED is a separate flag that sets the HMM-perturbation random seed, not an ensemble selector.

bash
# Stratified ensemble: 16 replicates (4 HMM-perturbation seeds x 4 guide-tree permutations)
muscle -super5 input.fasta -stratified -output ensemble.efa

# Diversified ensemble: 100 replicates exploring guide-tree and HMM space
muscle -super5 input.fasta -diversified -output ensemble.efa

# Optional: change replicate count and HMM-perturbation seed
muscle -super5 input.fasta -stratified -replicates 8 -perturb 42 -output ensemble.efa

The .efa output is consumed downstream to derive confidence-weighted bootstrap support: each replicate is fed to a tree builder and the resulting trees combined (Edgar 2022 supplement). Columns consistently aligned across replicates are reliable; high-divergence regions diverge between replicates and should be flagged before phylogenetic inference.

Running ClustalOmega

Use ClustalOmega when datasets reach hundreds of thousands of sequences (the mBed guide tree scales O(N log N)) or for HMM-profile-driven alignment. Prefer MAFFT or MUSCLE5 below that scale.

bash
# Basic alignment
clustalo -i input.fasta -o aligned.fasta --auto

# Force overwrite output
clustalo -i input.fasta -o aligned.fasta --force

# Specify output format
clustalo -i input.fasta -o aligned.phy --outfmt=phylip

# Use more iterations for better accuracy
clustalo -i input.fasta -o aligned.fasta --iter=5

# Profile-profile alignment (align two existing MSAs)
clustalo --p1 profile1.fasta --p2 profile2.fasta -o merged.fasta

# Add sequences to existing alignment
clustalo -i new_seqs.fasta --profile1 existing.fasta -o updated.fasta

# Multithreaded
clustalo -i input.fasta -o aligned.fasta --threads=8

Running T-Coffee

Use T-Coffee for small datasets (<50 sequences) where maximum accuracy matters or where structural templates exist (Expresso, 3D-Coffee). It is slower than progressive aligners but integrates diverse evidence via consistency-based library scoring.

ModeFlagWhat it does
Default(none)T-Coffee + Lalign pairwise library
M-Coffee-mode mcoffeeCombines libraries from MAFFT, MUSCLE, ClustalW, ProbCons, T-Coffee, etc.
Expresso-mode expressoPSI-BLAST searches PDB for structural templates, runs SAP structural alignment (requires internet for PSI-BLAST and PDB lookups; offline alternative: 3D-Coffee with user-supplied templates)
3D-Coffee-mode 3dcoffee -template_file templates.txtUser-supplied PDB templates; SAP / TM-align pairwise structural library
R-Coffee-mode rcoffeeRNA: combines sequence alignment with consensus secondary structure (RNAplfold)
Pro-Coffee-mode procoffeePromoter regions: enforces position-specific TF binding-site alignment
Reliability-evaluate -output score_asciiTCS column reliability score for an existing alignment
bash
t_coffee input.fasta -output fasta_aln -outfile aligned.fasta

t_coffee input.fasta -mode mcoffee -output fasta_aln -outfile aligned.fasta

t_coffee input.fasta -mode expresso -output fasta_aln -outfile aligned.fasta

t_coffee -infile aligned.fasta -evaluate -output score_ascii > tcs_scores.ascii

When to use T-Coffee: Small datasets (<50 sequences) where maximum accuracy matters, especially when structural information (PDB templates) is available. Expresso (Armougom et al 2006 NAR) and 3D-Coffee modes (Poirot et al 2004; O'Sullivan et al 2004 JMB) substantially improve correct-column rate over sequence-only T-Coffee when structures exist; verify the latest benchmark numbers in the project documentation. Expresso requires internet access for PSI-BLAST + PDB lookups. The TCS reliability score (Chang et al 2014 MBE) flags individual columns as reliable/unreliable for downstream filtering before phylogenetics.

Codon-Aware Alignment

When Codon Alignment Is Required

Coding sequences destined for selection analysis (dN/dS with PAML/codeml, HyPhy BUSTED/MEME/aBSREL) must be aligned respecting codon boundaries. Standard nucleotide MSA tools do not preserve reading frames and produce systematically incorrect dN/dS estimates -- Fletcher & Yang (2010 MBE) showed conventional aligners cause false-positive signals in the branch-site test of positive selection even on clean simulated data.

Show full SKILL.md (1,436 more words)Show less
Codon-Alignment Tool Decision Tree
Input cleanlinessRecommended toolNotes
Clean orthologs (no frameshifts, no internal stops)MAFFT-protein + PAL2NAL (Suyama, Torrents & Bork 2006 NAR)Fastest; standard PAML pipeline input
Recently duplicated paralogs (indel-rich)PRANK +F codon (Loytynoja & Goldman 2008 Science)Phylogeny-aware indel model; fewest false-positive selection calls (Fletcher & Yang 2010)
Frameshifts, pseudogenes, error-prone assembliesMACSE v2 alignSequences -fs <cost> (Ranwez et al 2018 MBE)Frameshift-tolerant; preserves reading frame across sequencing errors
Mixed dataset with some bad genesOMM_MACSE pipeline (Scornavacca, Belkhir, Lopez et al 2019; Ranwez group)MACSE non-homologous-fragment trimming + MAFFT prealignment + MACSE frameshift refinement + HMMcleaner
HyPhy-grade quality (BUSTED, MEME, aBSREL input)HyPhy pre-msa.bf / post-msa.bf (Pond lab; Kosakovsky Pond et al)Strips stop codons, runs MSA at protein level, threads back, validates frames
PAL2NAL: Protein-Guided Codon Alignment

Goal: Thread a nucleotide coding sequence alignment onto a protein alignment to preserve reading frame.

Approach: Align protein sequences first (higher sensitivity), then use PAL2NAL to map the protein alignment back to codons. Suyama et al 2006 NAR; standard codeml input pipeline.

bash
mafft --localpair --maxiterate 1000 proteins.fasta > proteins_aligned.fasta
pal2nal.pl proteins_aligned.fasta codons.fasta -output fasta > codons_aligned.fasta
pal2nal.pl proteins_aligned.fasta codons.fasta -output paml > codons_aligned.phy

Non-standard genetic codes: PAL2NAL by default uses the standard code (NCBI table 1). For mitochondrial (vertebrate=2, yeast=3, invertebrate=5), ciliate macronuclear (=6, UAA/UAG=Gln), or other non-standard codes, the protein-to-codon mapping mismatches and PAL2NAL silently produces wrong codon assignments. Specify explicitly with -codontable N:

bash
pal2nal.pl proteins_aligned.fasta codons.fasta -output paml -codontable 2 > codons_mt.phy

For datasets mixing genetic codes (e.g. nuclear + mitochondrial CDS in one tree), translate each lineage with its own code BEFORE protein alignment, never apply a single code globally. See NCBI Translation Tables for the full numbering.

PRANK +F Codon Mode

Goal: Align coding sequences under a phylogeny-aware indel model that does not over-collapse insertions.

Approach: PRANK +F (Loytynoja & Goldman 2008 Science) treats indels as evolutionary events on a tree, distinguishing insertions from deletions. Slower than MAFFT but recommended for selection-analysis prep.

bash
prank -d=codons.fasta -o=prank_aligned -codon -F

The +F flag enforces "fewer false insertions"; without it PRANK behaves more like a conventional aligner. For dN/dS analysis under PAML M2a/M8, PRANK +F is the most conservative input choice.

MACSE v2: Frameshift-Tolerant Codon Alignment

Goal: Align coding sequences directly at the codon level while tolerating frameshifts and internal stops.

Approach: MACSE scores based on amino acid translation while operating on DNA. The v2 toolbox (Ranwez et al 2018 MBE) ships a sub-program selector via -prog; the eight most-used sub-programs are listed below (run macse -help for the full set in the installed release):

Sub-programPurpose
alignSequencesAlign coding sequences (-fs <cost> sets frameshift penalty)
enrichAlignmentAdd new sequences to existing codon alignment
refineAlignmentRefine an alignment with MACSE scoring
splitAlignmentSplit into sub-alignments (e.g. by guide tree clades)
exportAlignmentConvert between MACSE-internal and standard formats
trimAlignmentPosition-aware trimming preserving codon structure
trimNonHomologousFragmentsDetect and remove non-homologous regions per sequence
reportGapsAA2NTMap protein-level gap removals back to nucleotide alignment
bash
java -jar macse_v2.jar -prog alignSequences -seq coding_seqs.fasta \
    -out_NT aligned_nt.fasta -out_AA aligned_aa.fasta -fs 30

java -jar macse_v2.jar -prog enrichAlignment -align existing.fasta \
    -seq new_seqs.fasta -out_NT updated.fasta

OMM_MACSE (Ranwez group, used in OrthoMaM v10+) chains: MACSE trimNonHomologousFragments to remove non-homologous fragments (annotation errors, retained introns/UTRs), MAFFT pre-alignment for guide-tree, MACSE v2 frameshift-aware refinement, then soft HMMcleaner cleaning. This is the recommended pipeline for genome-scale ortholog datasets where some genes will contain frameshifts.

bash
OMM_MACSE_v12.02.sif --in_seq_file orthogroup.fasta --out_dir omm_out --out_file_prefix orthogroup --genetic_code_number 1
HyPhy pre-msa.bf / post-msa.bf

For HyPhy-grade dN/dS analyses (BUSTED, MEME, aBSREL, RELAX), Pond lab's standard workflow is:

bash
hyphy pre-msa.bf --input cds.fasta
mafft --auto cds.fasta_protein.fas > cds.fasta_protein.msa
hyphy post-msa.bf --protein-msa cds.fasta_protein.msa --nucleotide-sequences cds.fasta_nuc.fas --output cds.codon.msa

pre-msa.bf strips internal stop codons and translates; post-msa.bf validates that all sequences remain in-frame after threading. Without this validation step, a single mis-aligned codon can cascade into a spurious episodic-selection call.

Confidence Assessment

For publication-grade phylogenetics or selection analysis, alignment uncertainty must be quantified per column and unreliable columns excluded BEFORE downstream inference -- not after.

MethodToolOutput
Guide-tree perturbationGUIDANCE2 (Sela et al 2015 NAR)Per-column and per-residue reliability score (0-1); default cutoff 0.93. No GUIDANCE3 has been released; deep-learning successors are exploratory only.
Library-consistencyT-Coffee TCS (Chang et al 2014 MBE)Per-column reliability score via -evaluate -output score_ascii
HMM ensembleMUSCLE5 -stratified / -diversifiedEFA file; column confidence = fraction of replicates supporting it
Co-optimal alignmentsHoT (Landan & Graur 2007 MBE)Heads-or-tails alternate optimal alignment for each column

Mask columns below the reliability threshold before phylogenetic inference. Trees built from filtered alignments are markedly more stable to method choice.

GUIDANCE2 thresholds are tool-specific. The 0.93 default cutoff is calibrated against MAFFT-LINSI in Sela et al 2015. Running GUIDANCE2 on top of MUSCLE5 or PRANK uses different perturbation distributions and produces scores on a slightly different scale. For non-MAFFT base aligners, calibrate the threshold empirically using a benchmark with known-correct columns or use the tool-native ensemble scoring (MUSCLE5 -stratified) instead.

Post-Alignment Validation Checklist

Before proceeding to downstream analysis, verify alignment quality:

  1. Visual inspection: Scan for columns of mostly gaps with scattered residues (hallmark of misalignment)
  2. Gap distribution: High gap fraction (>50% of columns with gaps) suggests problematic regions or inclusion of non-homologous sequences
  3. Sequence identity: If average pairwise identity is <25% for proteins, alignment reliability is questionable
  4. Outlier sequences: Sequences with excessive gaps relative to others may be non-homologous or fragments; consider removing and re-aligning
  5. Conservation pattern: Functional domains should show clear conservation; absence of expected conserved motifs suggests alignment error or non-homology
  6. Run GUIDANCE2 or MUSCLE5 ensemble: Quantify alignment confidence per column before phylogenetic inference

When NOT to Run MSA

  • Non-homologous sequences: MSA tools always produce an alignment, even for unrelated sequences; verify homology first (e.g., BLAST E-value < 1e-5)
  • Sequences below the twilight zone: Below ~20% protein identity, sequence signal is lost in noise; structural alignment is needed
  • Different domain architectures: Globally aligning multi-domain proteins with different domain orders produces meaningless results; align individual domains separately
  • Very different lengths without shared homology: Aligning a 50-residue fragment against 1000-residue proteins globally forces biologically meaningless gaps; use local alignment or fragment-aware modes (E-INS-i)
  • Highly repetitive sequences: Tandem repeats cause alignment ambiguity; specialized tools (e.g., TRUST for tandem repeats) may be needed

Quick Reference

TaskCommand
Best accuracy (<200 seqs)mafft --localpair --maxiterate 1000 in.fa > out.fa
Large datasetmafft --retree 2 in.fa > out.fa or clustalo -i in.fa -o out.fa
Uncertainty estimationmuscle -super5 in.fa -stratified -output out.efa
Codon-awareAlign protein first, then pal2nal.pl prot.fa cds.fa -output fasta
Add to existing MSAmafft --add new.fa existing.fa > updated.fa
Profile mergeclustalo --p1 msa1.fa --p2 msa2.fa -o merged.fa
With structure infot_coffee in.fa -mode expresso

Common Errors

ErrorCauseSolution
MAFFT runs out of memoryL-INS-i on too many sequencesSwitch to FFT-NS-2 or auto mode
Alignment has many all-gap columnsNon-homologous sequences includedFilter input by BLAST hits first
ClustalOmega crashes on large inputMemory limitsIncrease --MAC RAM or use MAFFT
PAL2NAL "length mismatch"Protein/DNA sequences not from same genesVerify correspondence with sequence IDs
MUSCLE5 slow on large datasetsDefault algorithm not designed for >10K seqsUse -super5 mode
Poor alignment despite high identityWrong sequence type detectionExplicitly specify --amino or --nuc
  • alignment/pairwise-alignment - Compare two sequences using PairwiseAligner
  • alignment/alignment-io - Read/write MSA files in various formats
  • alignment/msa-parsing - Parse, filter, trim, and assess MSA quality
  • alignment/msa-statistics - Calculate identity, conservation, entropy metrics
  • alignment/structural-alignment - Foldseek, TM-align, Foldmason for the dark proteome
  • alignment/alignment-trimming - ClipKIT, trimAl, BMGE post-MSA column filtering
  • phylogenetics/modern-tree-inference - Build phylogenetic trees from MSAs
  • sequence-io/read-sequences - Read input sequences for alignment

References

  • Edgar RC. 2022. Muscle5: high-accuracy alignment ensembles enable unbiased assessments of sequence homology and phylogeny. Nat Comm 13:6968.
  • Katoh K, Standley DM. 2013. MAFFT multiple sequence alignment software version 7. MBE 30:772-780.
  • Sievers F et al. 2011. Fast, scalable generation of high-quality protein multiple sequence alignments using Clustal Omega. Mol Syst Biol 7:539.
  • Notredame C, Higgins DG, Heringa J. 2000. T-Coffee: a novel method for fast and accurate multiple sequence alignment. JMB 302:205-217.
  • Loytynoja A, Goldman N. 2008. Phylogeny-aware gap placement prevents errors in sequence alignment and evolutionary analysis. Science 320:1632-1635.
  • Ranwez V, Douzery EJP, Cambon C, Chantret N, Delsuc F. 2018. MACSE v2: toolkit for the alignment of coding sequences accounting for frameshifts and stop codons. MBE 35:2582-2584.
  • Suyama M, Torrents D, Bork P. 2006. PAL2NAL: robust conversion of protein sequence alignments into the corresponding codon alignments. NAR 34:W609-W612.
  • Sela I, Ashkenazy H, Katoh K, Pupko T. 2015. GUIDANCE2: accurate detection of unreliable alignment regions accounting for the uncertainty of multiple parameters. NAR 43:W7-W14.
  • Chang JM, Di Tommaso P, Notredame C. 2014. TCS: a new multiple sequence alignment reliability measure to estimate alignment accuracy and improve phylogenetic tree reconstruction. MBE 31:1625-1637.
  • Fletcher W, Yang Z. 2010. The effect of insertions, deletions, and alignment errors on the branch-site test of positive selection. MBE 27:2257-2267.
  • Armougom F, Moretti S, Poirot O, Audic S, Dumas P, Schaeli B, Keduas V, Notredame C. 2006. Expresso: automatic incorporation of structural information in multiple sequence alignments using 3D-Coffee. NAR 34:W604-W608.
  • McWhite CD, Armour-Garb I, Singh M. 2023. Leveraging protein language models for accurate multiple sequence alignments. Genome Res 33:1145-1153.
  • Redelings BD. 2021. BAli-Phy version 3: model-based co-estimation of alignment and phylogeny. Bioinf 37:3032-3034.

© GPTomics, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files in alignment/multiple-alignment of GPTomics/bioSkills.

  • SKILL.md
  • examples/codon_alignment.py
  • examples/run_msa.py
  • usage-guide.md

Open the folder on GitHubat commit d91ed3d

Used in 2 other repositories

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 2 other GitHub owners. This page covers the copy in GPTomics/bioSkills, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Bio Alignment Multiple next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Bio Alignment Multiple compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Bio Alignment Multiple this skillGPTomics/bioSkills1.2k2 repos~8.4kAutomated safety check: PassMIT
Biopython Bioinformaticsaiming-lab/AutoResearchClaw15k—~810Automated safety check: PassMIT
Biopythondavila7/claude-code-templates32k13 repos~3.4kAutomated safety check: PassMIT
Ggetdavila7/claude-code-templates32k11 repos~6.3kAutomated safety check: PassMIT
Bio Alignment Pairwisemajiayu000/claude-skill-registry6664 repos~1.7kAutomated safety check: PassMIT
GgetK-Dense-AI/scientific-agent-skills48k1 repos~2.8kAutomated safety check: NotesBSD-2-Clause

Similar skills

  • Biopython Bioinformatics

    aiming-lab/AutoResearchClaw

    Quick reference for Biopython work: sequence operations, SeqIO file parsing, BLAST searches, Entrez queries, phylogenetic trees and PDB structure analysis.

    15k GitHub stars~810 tokensUpdated 1 mo ago
    Research & ScienceAuto-check passed
  • Biopython

    davila7/claude-code-templates

    Primary Python toolkit for molecular biology. An agent skill from davila7/claude-code-templates.

    32k GitHub starsUsed in 13 repos~3.4k tokens
    Research & ScienceAuto-check passed
  • Gget

    davila7/claude-code-templates

    CLI/Python toolkit for rapid bioinformatics queries. An agent skill from davila7/claude-code-templates.

    32k GitHub starsUsed in 11 repos~6.3k tokens
    Research & ScienceAuto-check passed
  • Bio Alignment Pairwise

    majiayu000/claude-skill-registry

    Perform pairwise sequence alignment using Biopython Bio.Align.PairwiseAligner.

    666 GitHub starsUsed in 4 repos~1.7k tokens
    Research & ScienceAuto-check passed
  • Gget

    K-Dense-AI/scientific-agent-skills

    Queries 20+ bioinformatics resources through CLI/Python. An agent skill from K-Dense-AI/scientific-agent-skills.

    48k GitHub starsUsed in 1 repo~2.8k tokens
    Research & ScienceAuto-check: notes
  • Biopython

    K-Dense-AI/scientific-agent-skills

    Provides Biopython workflows for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez).

    48k GitHub starsUsed in 1 repo~4.3k tokens
    Research & ScienceAuto-check: notes

More from GPTomics/bioSkills

All 553 skills in this repo
  • Bio Alignment Io

    GPTomics/bioSkills

    Read, write, and convert multiple sequence alignment files using Biopython Bio.AlignIO.

    1.2k GitHub starsUsed in 3 repos~4.9k tokens
    Auto-check passed
  • bioSkills Installer

    GPTomics/bioSkills

    Installs the bioSkills collection of 425 bioinformatics skills in one step, or only chosen categories, so sequencing, RNA-seq, single-cell and variant tasks get specialized help.

    1.2k GitHub starsUsed in 1 repo~789 tokens
    Auto-check passed
  • Bio Write Sequences

    GPTomics/bioSkills

    Write biological sequences to files (FASTA, FASTQ, GenBank, EMBL) using Biopython Bio.SeqIO.

    1.2k GitHub starsUsed in 3 repos~2.1k tokens
    Auto-check passed
  • Amplicon Primer Clipping

    GPTomics/bioSkills

    Soft- or hard-clips PCR primer footprints from aligned amplicon BAMs so primer bases stop masquerading as confirmed reference sequence.

    1.2k GitHub starsUsed in 2 repos~2.2k tokens
    Auto-check passed
  • Bio Alignment Indexing

    GPTomics/bioSkills

    Create and use BAI/CSI indices for BAM/CRAM files using samtools and pysam.

    1.2k GitHub starsUsed in 2 repos~2.4k tokens
    Auto-check passed
  • Bio Alignment Sorting

    GPTomics/bioSkills

    Sort alignment files by coordinate or read name using samtools and pysam.

    1.2k GitHub starsUsed in 2 repos~2.6k tokens
    Auto-check passed

Works with

Questions about Bio Alignment Multiple

What does Bio Alignment Multiple do?

Perform multiple sequence alignment using MAFFT, MUSCLE5, ClustalOmega, or T-Coffee. Bio Alignment Multiple is an agent skill from GPTomics/bioSkills. Perform multiple sequence alignment using MAFFT, MUSCLE5, ClustalOmega, or T-Coffee.

When should I use Bio Alignment Multiple?

Bio Alignment Multiple fits situations like: more homologous sequences for phylogenetics; conservation analysis; evolutionary studies.

How do I install Bio Alignment Multiple in Claude Code?

Run `npx skills add GPTomics/bioSkills --skill bio-alignment-multiple -a claude-code`. Or copy the skill folder (alignment/multiple-alignment in GPTomics/bioSkills) into .claude/skills/bio-alignment-multiple in your project. Claude Code loads it when a task matches its description.

How do I install Bio Alignment Multiple in Codex?

Run `npx skills add GPTomics/bioSkills --skill bio-alignment-multiple -a codex`. Or copy the skill folder (alignment/multiple-alignment in GPTomics/bioSkills) into .agents/skills/bio-alignment-multiple in your project. Codex loads it when a task matches its description.

Can I use Bio Alignment Multiple in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add GPTomics/bioSkills --skill bio-alignment-multiple -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/bio-alignment-multiple, .gemini/skills/bio-alignment-multiple, .github/skills/bio-alignment-multiple and .opencode/skills/bio-alignment-multiple in your project.

What does Bio Alignment Multiple need to run?

Going by SKILL.md and its folder, Bio Alignment Multiple needs Python for the scripts in its folder and the command-line tools its instructions call (java and pip). Our summary lists: Python 3.

Does Bio Alignment Multiple access the network?

SKILL.md contains no URLs. Its commands use pip, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Bio Alignment Multiple safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Bio Alignment Multiple use?

Bio Alignment Multiple is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Bio Alignment Multiple use?

About 8.4k tokens (SKILL.md is roughly 34k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Bio Alignment Multiple?

Skills that share tags, products or a category with Bio Alignment Multiple: Biopython Bioinformatics (aiming-lab/AutoResearchClaw, 15k stars), Biopython (davila7/claude-code-templates, 32k stars), Gget (davila7/claude-code-templates, 32k stars) and Bio Alignment Pairwise (majiayu000/claude-skill-registry, 666 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Bio Alignment Multiple?

GPTomics (a GitHub organization) maintains it in GPTomics/bioSkills, which has 1,215 GitHub stars. The repository holds 553 skills in this directory. The repository was last updated on August 15, 2026.

Source: GPTomics/bioSkills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.