This skill covers post-alignment column filtering and per-residue cleaning of multiple sequence alignments. It guides tool selection (ClipKIT, trimAl, BMGE, Divvier, HMMcleaner, Gblocks) by downstream goal (phylogenetic-tree input, HMM profile building, selection analysis, structure modelling) rather than treating "trimming" as a single decision.
# CLI tools (all primary trimmers)
conda install -c bioconda clipkit trimal
# OR pip:
pip install clipkit
# trimAl: https://github.com/inab/trimal
# BMGE (Java)
# https://gitlab.pasteur.fr/GIPhy/BMGE
# Divvier (compile from source)
# https://github.com/simonwhelan/Divvier
# HMMcleaner (Perl + HMMER required)
# cpanm Bio::MUST::Apps::HmmCleaner
Tell your AI agent what you want to do: - "Trim this alignment for phylogenetic-tree input using ClipKIT" - "Prepare an HMM-ready alignment with aggressive gap removal" - "Remove cross-contaminating residues with HMMcleaner before phylogenomic analysis" - "Generate a structural-MSA-friendly trimming that preserves codon boundaries"
"I have a concatenated supermatrix of 500 genes; what trimmer should I use for IQ-TREE input?"
"Trim this single-gene alignment with ClipKIT smart-gap and report what fraction of columns were retained"
"Compare ClipKIT kpic-smart-gap vs trimAl -strictplus on the same alignment and tell me which produces a more stable ML tree"
"Trim this alignment for HMMER hmmbuild input using trimAl gappyout mode"
"Strip insert columns and lowercase characters before building a profile HMM"
"I suspect some sequences have contaminating residues; clean them with HMMcleaner first then trim"
"Mask low-confidence residues with HMMcleaner before building a tree"
"Mark unreliable columns for codeml input but DO NOT remove them; selection analysis is sensitive to column removal"
"Use TCS column scores to mask unreliable codon positions before BUSTED/MEME/aBSREL"
"Run all three ClipKIT modes (smart-gap, kpic-smart-gap, gappy) and compare retention fractions"
"Test how aggressive each trimAl mode is on my alignment and recommend one"
| Concept | Meaning |
|---|---|
| Column retention | Fraction of original columns kept; > 70% is usually safe, < 50% concerning |
| Aggressiveness | How readily a mode removes columns; ClipKIT smart-gap is moderate, trimAl strictplus is high |
| Column mapping | Index list of which original columns survived (-colnumbering, --log) |
| Per-residue masking | Replace bad residues with X instead of removing the column (HMMcleaner) |
| Column splitting | Divvier alternative: split ambiguous columns rather than remove them |
| Codon-aware trimming | Preserve frame boundaries for selection analysis (MACSE trimAlignment) |
kpic-smart-gap is the recommended default for phylogenetic-tree input on concatenated supermatrices; smart-gap for single genes-gappyout is the right tool for HMM profile preparation; aggressive gap removal benefits HMMER hmmbuild-h 0.4 -g 0.2X; pair with a column trimmer for double cleaning-colnumbering, --log) for reproducibilitytrimAlignment or per-codon-block ClipKIT) is required for any post-MSA cleaning of dN/dS input