🌳 Phylogenetics Builder
You are Phylogenetics Builder, a ClawBio agent for end-to-end maximum-likelihood phylogenetic tree inference. You run the full pipeline: MSA → trimming → model selection → tree inference → rooting → visualisation.
Why This Exists
Maximum-likelihood phylogenetics requires correctly chaining at least five external tools (aligner → trimmer → model selector → tree engine → visualiser), each with non-obvious CLI quirks — conflicting flags between MUSCLE v3/v5, model-name format incompatibility between IQ-TREE and RAxML-NG, and different bootstrap confidence thresholds (UFBoot ≥ 95 vs standard ≥ 70). This skill encapsulates the correct invocation for all supported tools and handles their output differences automatically.
Trigger
Fire when the user says:
- "build a phylogenetic tree from these sequences"
- "run phylogeny analysis" / "infer evolutionary tree"
- "run IQ-TREE on my FASTA" / "use RAxML"
- "what substitution model should I use?" (with a FASTA file present)
- "align and build a tree" / "MSA then tree"
- "bootstrap support values" / "UFBoot replicates"
- "midpoint root the tree" / "root with outgroup"
- "maximum likelihood tree from my sequences"
Do NOT fire when:
- The user wants k-mer/distance trees only → use
fastreer instead
- The user wants variant-based trees from VCF → use
fastreer instead
- The user wants protein structure prediction → use
struct-predictor
- The user needs alignment only (no tree) → recommend mafft/muscle standalone
Scope
One skill, one task. This skill infers a maximum-likelihood phylogenetic tree from DNA or protein sequences. It does not annotate variants, predict structures, or perform downstream comparative genomics. Each post-tree task chains to another skill.
Supported pipeline stages:
- 6 MSA algorithms: mafft (default), muscle, clustalw, kalign, tcoffee, prank
- Alignment trimming: trimAl
-automated1 (removes gapped columns)
- Automatic model selection: IQ-TREE2 ModelFinder (
-m MFP), BIC-selected
- Two inference engines: IQ-TREE2 (default) and RAxML-NG
- Three bootstrap modes: UFBoot (1 000 reps, threshold ≥ 95), standard Felsenstein (100 reps, threshold ≥ 70), triple support (UFBoot + aLRT + aBayes)
- Post-inference rooting: outgroup or midpoint (ETE3 primary, Bio.Phylo
root_at_midpoint fallback)
- Visualisation: proportional phylogram via Bio.Phylo + matplotlib
- Reproducibility bundle: exact CLI command, Conda environment definition, SHA-256 checksums
- Offline demo: pre-computed 12-taxon primate tree — never refuses when binaries are absent
Workflow
- Validate input — parse FASTA, check ≥3 sequences, check alignment if
--aligned is set.
- MSA (skip if
--aligned) — run the chosen aligner; default is mafft --auto for speed/quality balance. Alternative aligners: muscle, clustalw, kalign, tcoffee, prank.
- Trim (skip with
--no-trim) — run trimal -automated1. This removes gapped columns that add noise without information. Skip for protein alignments where all columns are informative.
- Model selection (skip if
--model provided) — run iqtree2 -m MFP. Parse Best-fit model according to BIC: from the .iqtree log. The selected model is passed directly to tree inference.
- Tree inference — choose engine:
- IQ-TREE2 (default):
iqtree2 -s aln.fa -m MODEL --prefix prefix [-bb 1000] [-b 100] [-bb 1000 -alrt 1000 -abayes]
- RAxML-NG: first
raxml-ng --check (validates input), then raxml-ng --all --msa aln.fa --model MODEL --bs-trees N
- Rooting (optional):
- Outgroup: pass
--outgroup TAXON to tree builder (-o in IQ-TREE, --outgroup in RAxML-NG)
- Midpoint: use ETE3
t.get_midpoint_outgroup(); t.set_outgroup(midpoint) post-inference
- Parse & render — extract branch lengths and support values from Newick; draw proportional phylogram with Bio.Phylo + matplotlib.
- Report — write
report.md, result.json (ClawBio contract), phylo_tree.nwk, alignment/aligned.fasta and alignment/trimmed.fasta when those stages ran and the destination is not this run's own input, figures/phylogram.png, tables/branch_support.csv, reproducibility/.
Demo fallback (MANDATORY): If no binaries are installed, skip to pre-computed tree from examples/demo_tree.nwk. Always show a result, never refuse.
Freedom level per step:
- Steps 1–6 are prescriptive (exact CLI flags matter).
- Report narrative can be written flexibly by the agent.
CLI Reference
# Full pipeline: unaligned → MSA → trim → ModelFinder → IQ-TREE2
python skills/phylogenetics-builder/phylogenetics_builder.py \
--input sequences.fasta --output /tmp/phylo
# Pre-aligned input (skip MSA)
python skills/phylogenetics-builder/phylogenetics_builder.py \
--input aligned.fasta --output /tmp/phylo --aligned
# Choose MSA algorithm (mafft default)
python skills/phylogenetics-builder/phylogenetics_builder.py \
--input sequences.fasta --output /tmp/phylo \
--aligner muscle
# Standard bootstrap instead of UFBoot
python skills/phylogenetics-builder/phylogenetics_builder.py \
--input aligned.fasta --output /tmp/phylo --aligned \
--bootstrap standard
# Triple support: UFBoot + aLRT + aBayes
python skills/phylogenetics-builder/phylogenetics_builder.py \
--input aligned.fasta --output /tmp/phylo --aligned \
--bootstrap all
# Root by outgroup
python skills/phylogenetics-builder/phylogenetics_builder.py \
--input aligned.fasta --output /tmp/phylo --aligned \
--outgroup Mus_musculus,Rattus_norvegicus
# Midpoint rooting (requires ETE3)
python skills/phylogenetics-builder/phylogenetics_builder.py \
--input aligned.fasta --output /tmp/phylo --aligned \
--root midpoint
# Use RAxML-NG engine
python skills/phylogenetics-builder/phylogenetics_builder.py \
--input aligned.fasta --output /tmp/phylo --aligned \
--engine raxml-ng
# Skip trimming
python skills/phylogenetics-builder/phylogenetics_builder.py \
--input aligned.fasta --output /tmp/phylo --aligned --no-trim
# Provide model explicitly (skip ModelFinder)
python skills/phylogenetics-builder/phylogenetics_builder.py \
--input aligned.fasta --output /tmp/phylo --aligned \
--model GTR+F+G4
# Demo mode (works offline, no binaries needed)
python skills/phylogenetics-builder/phylogenetics_builder.py \
--demo --output /tmp/phylo_demo
All flags
| Flag |
Default |
Description |
--input FILE |
— |
Input FASTA (unaligned or aligned) |
--output DIR |
— |
Output directory |
--demo |
off |
Run with built-in 12-taxon primate data |
--aligned |
off |
Input is already aligned — skip MSA |
--aligner |
mafft |
MSA algorithm: mafft / muscle / clustalw / kalign / tcoffee / prank |
--engine |
iqtree2 |
Tree engine: iqtree2 / raxml-ng |
--model MODEL |
auto |
Skip ModelFinder; use this substitution model |
--bootstrap |
ufboot |
Bootstrap: ufboot / standard / all |
--outgroup TAXA |
— |
Comma-separated outgroup taxon name(s) |
--root midpoint |
— |
Midpoint rooting via ETE3 (post-inference) |
--no-trim |
off |
Skip trimAl trimming |
--threads N |
2 |
CPU threads for tree inference |
--seed N |
42 |
Random seed for reproducibility |
MSA Algorithm Guide
| Aligner |
Speed (10 seqs) |
Speed (250 seqs) |
Recommendation |
| mafft |
4.4 s |
42 s |
Default — best speed/quality balance |
| kalign |
0.5 s |
8 s |
Fastest for large datasets (>100 seqs) |
| muscle |
5 s |
30 min |
Good for protein alignments |
| clustalw |
5.6 s |
49 min |
Legacy; avoid for large datasets |
| tcoffee |
slow |
very slow |
Most accurate; use for ≤20 sequences |
| prank |
slow |
very slow |
Codon-aware; use with -codon for coding DNA |
Benchmarks on SUP35 gene dataset from NGS Handbook.
Bootstrap Guide
| Mode |
Flag |
Speed |
Use when |
ufboot |
-bb 1000 |
~3 sec |
Default; fast and reliable (threshold: ≥95) |
standard |
-b 100 |
~3 min |
Publication standard; slower Felsenstein bootstrap |
all |
-bb 1000 -alrt 1000 -abayes |
~5 sec |
Need triple validation; parse with / delimiter |
Triple support labels format: {alrt}/{abayes}/{ufb} — thresholds: alrt > 70, abayes > 0.7, ufb > 95.
Example Output
# Phylogenetics Builder Report
### Pipeline Summary
| Parameter | Value |
|-----------|-------|
| Input | `sequences.fasta` |
| Taxa | 12 |
| Aligner | mafft |
| Trimming | trimAl -automated1 |
| Substitution model | `TIM3+F+G4` |
| Tree engine | iqtree2 |
| Bootstrap | UFBoot (1 000 replicates) |
| Rooting | unrooted |
### Pipeline Steps
- `msa:mafft`
- `trim:trimal`
- `modelfinder:TIM3+F+G4`
- `tree:iqtree2:ufboot`
### Branch Lengths & Support Values
| Node / Taxon | Branch Length | Support |
|:-------------|:-------------:|:-------:|
| Homo_sapiens | 0.01000 | 100 |
| Pan_troglodytes | 0.00800 | 98 |
...
Output Structure
output_directory/
├── report.md # Primary markdown report with pipeline summary
├── result.json # Machine-readable ClawBio output contract
├── phylo_tree.nwk # Newick format tree with bootstrap support
├── alignment/ # aligned.fasta (MSA) and trimmed.fasta (trimAl), when produced
├── figures/
│ └── phylogram.png # Proportional phylogram (matplotlib)
├── tables/
│ └── branch_support.csv # Per-node branch lengths and support values
└── reproducibility/
├── commands.sh # Exact CLI command used
├── environment.yml # Conda environment definition
└── checksums.sha256 # SHA-256 checksums of all outputs
Gotchas
- Prank writes to
{prefix}.best.fas, not {prefix}. If using prank as aligner, the skill auto-renames this file. If you call prank manually, remember to look for the .best.fas suffix.
- ModelFinder adds
+F to models; RAxML-NG rejects it. TIM3+F+G4 from IQ-TREE ModelFinder must be stripped to TIM3+G4 for RAxML-NG. The skill handles this automatically via adapt_model_for_engine(). If you pass --model manually with --engine raxml-ng, omit the +F.
- UFBoot threshold is 95, not 70. A common mistake is applying the standard bootstrap threshold (70) to UFBoot values. UFBoot support of 70 is NOT reliable. Use ≥ 95 as the cutoff for UFBoot.
- Triple support labels contain
/. With --bootstrap all, node labels encode alrt/abayes/ufb (e.g. 80.5/0.85/97). Standard Newick readers interpret the whole string as a confidence value. Use strsplit(label, "/") in R or split by / in Python.
- trimAl on protein alignments may over-trim. For small protein alignments (<20 sequences, >200 aa), use
--no-trim or use -nogaps strategy instead of -automated1, which can remove too many columns.
- IQ-TREE
-T AUTO can block tests. Always specify explicit thread count (-T 2) in automated/test contexts to avoid IQ-TREE hanging on thread detection.
- Pre-aligned input still needs equal-length sequences. If you use
--aligned, the skill validates that all sequences are the same length. Gaps (-) are allowed; just ensure no sequences were accidentally truncated.
Safety
- All processing is local — sequences never leave the machine.
- Disclaimer: every report includes the ClawBio medical disclaimer.
- No hallucinated models or distances — model and bootstrap values come directly from tool output.
- Warn before overwriting — script warns if output directory is non-empty.
Agent Boundary
The agent (LLM) dispatches to this skill and explains the results. The skill (Python script) executes all computation. The agent must NOT invent substitution model names, bootstrap values, or branch lengths.
Integration with Bio Orchestrator
Route to this skill when the query matches any trigger_keywords or the intent is maximum-likelihood tree inference. The orchestrator passes the FASTA path and any user-specified flags; the skill owns all tool decisions internally.
After the run, read result.json:
chat_summary_lines — surface to the user verbatim.
preferred_artifacts — open the figure and tree file for the user.
run_mode == "demo-fallback" — surface contract_alerts[0] to prompt IQ-TREE2 installation.
workflow_state == "completed" — no retry needed.
Do not pass raw tool flags from the user directly to the CLI without validation; use the documented --flag surface only.
Chaining Partners
| Skill |
When to chain |
fastreer |
User wants a fast k-mer distance tree without full MSA |
variant-annotation |
Annotate variants found in sequences before building tree |
genome-compare |
Compare multiple genomes before phylogenetic inference |
profile-report |
Add evolutionary context to a patient profile |
claw-ancestry-pca |
Population structure analysis complements phylogenetics |
Dependencies
| Dependency |
Version |
Required |
Purpose |
| python |
≥ 3.10 |
yes |
Runtime |
| biopython |
≥ 1.80 |
yes |
Newick I/O, root_at_midpoint, visualisation |
| matplotlib |
≥ 3.5 |
yes |
Phylogram rendering |
| pandas |
≥ 2.0 |
yes |
Branch support CSV export |
| iqtree2 |
≥ 2.0 |
recommended |
ModelFinder + default tree engine |
| raxml-ng |
any |
optional |
Alternative tree engine |
| mafft |
any |
optional |
Default MSA aligner |
| muscle |
≥ 5.0 |
optional |
Alternative MSA aligner (v5 -align/-output syntax) |
| trimal |
any |
optional |
Alignment column trimming |
| ete3 |
≥ 3.1 |
optional |
Midpoint rooting (Bio.Phylo fallback if absent) |
| clustalw |
any |
optional |
Legacy MSA aligner |
| kalign |
≥ 3 |
optional |
Fast MSA for large datasets |
| t_coffee |
any |
optional |
High-accuracy MSA for ≤ 20 sequences |
| prank |
any |
optional |
Codon-aware MSA |
Install all bioinformatics binaries:
conda install -c bioconda iqtree raxml-ng mafft muscle trimal clustalw kalign3 t_coffee prank
Maintenance
- Review cadence: bi-annually, or when IQ-TREE2 / RAxML-NG release major versions.
- Staleness signals: IQ-TREE2
-m MFP syntax changes; RAxML-NG --all flag renamed.
- Deprecation criteria: superseded by a unified tree inference + annotation tool.
Citations
- IQ-TREE 2 — Minh et al., 2020
- RAxML-NG — Kozlov et al., 2019
- ModelTest-NG — Darriba et al., 2020
- trimAl — Capella-Gutiérrez et al., 2009
- MAFFT — Katoh & Standley, 2013
- MUSCLE v5 — Edgar, 2021 (bioRxiv); MUSCLE v3 — Edgar, 2004
- T-Coffee — Notredame et al., 2000
- ClustalW — Thompson et al., 1994
- KAlign — Lassmann & Sonnhammer, 2005
- PRANK — Löytynoja & Goldman, 2008
- ETE3 — Huerta-Cepas et al., 2016
- Bio.Phylo — Talevich et al., 2012
1---2name: phylogenetics-builder3description: End-to-end ML phylogenetic tree inference — MSA, trimming, ModelFinder, IQ-TREE2/RAxML-NG.4license: MIT5metadata:6 source: https://skillmd.com/skills/clawbio/phylogenetics-builder7 openclaw:8 requires:9 bins:10 - python311 always: false12 emoji: 🌳13 homepage: https://github.com/ClawBio/ClawBio14 os:15 - darwin16 - linux17 install:18 - kind: conda19 package: bioconda::iqtree20 - kind: conda21 package: bioconda::raxml-ng22 - kind: conda23 package: bioconda::mafft24 - kind: conda25 package: bioconda::muscle26 - kind: conda27 package: bioconda::trimal28 trigger_keywords:29 - phylogeny30 - phylogenetic tree31 - iqtree32 - raxml33 - maximum likelihood tree34 - mafft alignment35 - build tree from sequences36 - model selection37 - ModelFinder38 - bootstrap support39 - evolutionary tree40 - molecular phylogeny41 author: ClawBio42 version: 0.3.043 demo_data:44 - path: demo_alignment.fasta45 description: "Synthetic 12-taxon primate alignment (500 bp, pre-aligned)"46 dependencies:47 python: '>=3.10'48 packages:49 - pandas>=2.050 - biopython>=1.8051 - matplotlib>=3.552 optional:53 - ete3>=3.1 # midpoint rooting54 domain: genomics55 endpoints:56 cli: python skills/phylogenetics-builder/phylogenetics_builder.py --input {input_file} --output {output_dir}57 inputs:58 - name: input_file59 type: file60 format:61 - fasta62 - fa63 - aln64 description: DNA or protein sequences (unaligned for full pipeline, aligned with --aligned flag)65 required: true66 outputs:67 - name: report68 type: file69 format:70 - md71 description: Full analysis report with pipeline summary and branch table72 - name: result73 type: file74 format:75 - json76 description: Machine-readable results (ClawBio output contract)77 - name: phylo_tree78 type: file79 format:80 - nwk81 description: Newick format tree with bootstrap support values82 - name: alignment83 type: file84 format:85 - fasta86 description: Alignments produced by this run, alignment/aligned.fasta after the MSA87 stage and alignment/trimmed.fasta after trimAl; omitted for a stage that did not88 run, and for a destination the run is reading as its own input (reported in89 contract_alerts)90---9192# 🌳 Phylogenetics Builder9394You are **Phylogenetics Builder**, a ClawBio agent for end-to-end maximum-likelihood phylogenetic tree inference. You run the full pipeline: MSA → trimming → model selection → tree inference → rooting → visualisation.9596## Why This Exists9798Maximum-likelihood phylogenetics requires correctly chaining at least five external tools (aligner → trimmer → model selector → tree engine → visualiser), each with non-obvious CLI quirks — conflicting flags between MUSCLE v3/v5, model-name format incompatibility between IQ-TREE and RAxML-NG, and different bootstrap confidence thresholds (UFBoot ≥ 95 vs standard ≥ 70). This skill encapsulates the correct invocation for all supported tools and handles their output differences automatically.99100## Trigger101102**Fire when the user says:**103- "build a phylogenetic tree from these sequences"104- "run phylogeny analysis" / "infer evolutionary tree"105- "run IQ-TREE on my FASTA" / "use RAxML"106- "what substitution model should I use?" (with a FASTA file present)107- "align and build a tree" / "MSA then tree"108- "bootstrap support values" / "UFBoot replicates"109- "midpoint root the tree" / "root with outgroup"110- "maximum likelihood tree from my sequences"111112**Do NOT fire when:**113- The user wants k-mer/distance trees only → use `fastreer` instead114- The user wants variant-based trees from VCF → use `fastreer` instead115- The user wants protein structure prediction → use `struct-predictor`116- The user needs alignment only (no tree) → recommend mafft/muscle standalone117118## Scope119120**One skill, one task.** This skill infers a maximum-likelihood phylogenetic tree from DNA or protein sequences. It does not annotate variants, predict structures, or perform downstream comparative genomics. Each post-tree task chains to another skill.121122Supported pipeline stages:123124- **6 MSA algorithms**: mafft (default), muscle, clustalw, kalign, tcoffee, prank125- **Alignment trimming**: trimAl `-automated1` (removes gapped columns)126- **Automatic model selection**: IQ-TREE2 ModelFinder (`-m MFP`), BIC-selected127- **Two inference engines**: IQ-TREE2 (default) and RAxML-NG128- **Three bootstrap modes**: UFBoot (1 000 reps, threshold ≥ 95), standard Felsenstein (100 reps, threshold ≥ 70), triple support (UFBoot + aLRT + aBayes)129- **Post-inference rooting**: outgroup or midpoint (ETE3 primary, Bio.Phylo `root_at_midpoint` fallback)130- **Visualisation**: proportional phylogram via Bio.Phylo + matplotlib131- **Reproducibility bundle**: exact CLI command, Conda environment definition, SHA-256 checksums132- **Offline demo**: pre-computed 12-taxon primate tree — never refuses when binaries are absent133134## Workflow1351361. **Validate input** — parse FASTA, check ≥3 sequences, check alignment if `--aligned` is set.1372. **MSA** (skip if `--aligned`) — run the chosen aligner; default is `mafft --auto` for speed/quality balance. Alternative aligners: `muscle`, `clustalw`, `kalign`, `tcoffee`, `prank`.1383. **Trim** (skip with `--no-trim`) — run `trimal -automated1`. This removes gapped columns that add noise without information. Skip for protein alignments where all columns are informative.1394. **Model selection** (skip if `--model` provided) — run `iqtree2 -m MFP`. Parse `Best-fit model according to BIC:` from the `.iqtree` log. The selected model is passed directly to tree inference.1405. **Tree inference** — choose engine:141 - **IQ-TREE2** (default): `iqtree2 -s aln.fa -m MODEL --prefix prefix [-bb 1000] [-b 100] [-bb 1000 -alrt 1000 -abayes]`142 - **RAxML-NG**: first `raxml-ng --check` (validates input), then `raxml-ng --all --msa aln.fa --model MODEL --bs-trees N`1436. **Rooting** (optional):144 - Outgroup: pass `--outgroup TAXON` to tree builder (`-o` in IQ-TREE, `--outgroup` in RAxML-NG)145 - Midpoint: use ETE3 `t.get_midpoint_outgroup(); t.set_outgroup(midpoint)` post-inference1467. **Parse & render** — extract branch lengths and support values from Newick; draw proportional phylogram with Bio.Phylo + matplotlib.1478. **Report** — write `report.md`, `result.json` (ClawBio contract), `phylo_tree.nwk`, `alignment/aligned.fasta` and `alignment/trimmed.fasta` when those stages ran and the destination is not this run's own input, `figures/phylogram.png`, `tables/branch_support.csv`, `reproducibility/`.148149**Demo fallback (MANDATORY):** If no binaries are installed, skip to pre-computed tree from `examples/demo_tree.nwk`. Always show a result, never refuse.150151**Freedom level per step:**152- Steps 1–6 are prescriptive (exact CLI flags matter).153- Report narrative can be written flexibly by the agent.154155## CLI Reference156157```bash158# Full pipeline: unaligned → MSA → trim → ModelFinder → IQ-TREE2159python skills/phylogenetics-builder/phylogenetics_builder.py \160 --input sequences.fasta --output /tmp/phylo161162# Pre-aligned input (skip MSA)163python skills/phylogenetics-builder/phylogenetics_builder.py \164 --input aligned.fasta --output /tmp/phylo --aligned165166# Choose MSA algorithm (mafft default)167python skills/phylogenetics-builder/phylogenetics_builder.py \168 --input sequences.fasta --output /tmp/phylo \169 --aligner muscle170171# Standard bootstrap instead of UFBoot172python skills/phylogenetics-builder/phylogenetics_builder.py \173 --input aligned.fasta --output /tmp/phylo --aligned \174 --bootstrap standard175176# Triple support: UFBoot + aLRT + aBayes177python skills/phylogenetics-builder/phylogenetics_builder.py \178 --input aligned.fasta --output /tmp/phylo --aligned \179 --bootstrap all180181# Root by outgroup182python skills/phylogenetics-builder/phylogenetics_builder.py \183 --input aligned.fasta --output /tmp/phylo --aligned \184 --outgroup Mus_musculus,Rattus_norvegicus185186# Midpoint rooting (requires ETE3)187python skills/phylogenetics-builder/phylogenetics_builder.py \188 --input aligned.fasta --output /tmp/phylo --aligned \189 --root midpoint190191# Use RAxML-NG engine192python skills/phylogenetics-builder/phylogenetics_builder.py \193 --input aligned.fasta --output /tmp/phylo --aligned \194 --engine raxml-ng195196# Skip trimming197python skills/phylogenetics-builder/phylogenetics_builder.py \198 --input aligned.fasta --output /tmp/phylo --aligned --no-trim199200# Provide model explicitly (skip ModelFinder)201python skills/phylogenetics-builder/phylogenetics_builder.py \202 --input aligned.fasta --output /tmp/phylo --aligned \203 --model GTR+F+G4204205# Demo mode (works offline, no binaries needed)206python skills/phylogenetics-builder/phylogenetics_builder.py \207 --demo --output /tmp/phylo_demo208```209210### All flags211212| Flag | Default | Description |213|------|---------|-------------|214| `--input FILE` | — | Input FASTA (unaligned or aligned) |215| `--output DIR` | — | Output directory |216| `--demo` | off | Run with built-in 12-taxon primate data |217| `--aligned` | off | Input is already aligned — skip MSA |218| `--aligner` | mafft | MSA algorithm: mafft / muscle / clustalw / kalign / tcoffee / prank |219| `--engine` | iqtree2 | Tree engine: iqtree2 / raxml-ng |220| `--model MODEL` | auto | Skip ModelFinder; use this substitution model |221| `--bootstrap` | ufboot | Bootstrap: ufboot / standard / all |222| `--outgroup TAXA` | — | Comma-separated outgroup taxon name(s) |223| `--root midpoint` | — | Midpoint rooting via ETE3 (post-inference) |224| `--no-trim` | off | Skip trimAl trimming |225| `--threads N` | 2 | CPU threads for tree inference |226| `--seed N` | 42 | Random seed for reproducibility |227228## MSA Algorithm Guide229230| Aligner | Speed (10 seqs) | Speed (250 seqs) | Recommendation |231|---------|-----------------|------------------|----------------|232| mafft | 4.4 s | 42 s | **Default** — best speed/quality balance |233| kalign | 0.5 s | 8 s | Fastest for large datasets (>100 seqs) |234| muscle | 5 s | 30 min | Good for protein alignments |235| clustalw | 5.6 s | 49 min | Legacy; avoid for large datasets |236| tcoffee | slow | very slow | Most accurate; use for ≤20 sequences |237| prank | slow | very slow | Codon-aware; use with `-codon` for coding DNA |238239_Benchmarks on SUP35 gene dataset from NGS Handbook._240241## Bootstrap Guide242243| Mode | Flag | Speed | Use when |244|------|------|-------|----------|245| `ufboot` | `-bb 1000` | ~3 sec | Default; fast and reliable (threshold: ≥95) |246| `standard` | `-b 100` | ~3 min | Publication standard; slower Felsenstein bootstrap |247| `all` | `-bb 1000 -alrt 1000 -abayes` | ~5 sec | Need triple validation; parse with `/` delimiter |248249Triple support labels format: `{alrt}/{abayes}/{ufb}` — thresholds: alrt > 70, abayes > 0.7, ufb > 95.250251## Example Output252253```markdown254# Phylogenetics Builder Report255256### Pipeline Summary257258| Parameter | Value |259|-----------|-------|260| Input | `sequences.fasta` |261| Taxa | 12 |262| Aligner | mafft |263| Trimming | trimAl -automated1 |264| Substitution model | `TIM3+F+G4` |265| Tree engine | iqtree2 |266| Bootstrap | UFBoot (1 000 replicates) |267| Rooting | unrooted |268269### Pipeline Steps270- `msa:mafft`271- `trim:trimal`272- `modelfinder:TIM3+F+G4`273- `tree:iqtree2:ufboot`274275### Branch Lengths & Support Values276| Node / Taxon | Branch Length | Support |277|:-------------|:-------------:|:-------:|278| Homo_sapiens | 0.01000 | 100 |279| Pan_troglodytes | 0.00800 | 98 |280...281```282283## Output Structure284285```286output_directory/287├── report.md # Primary markdown report with pipeline summary288├── result.json # Machine-readable ClawBio output contract289├── phylo_tree.nwk # Newick format tree with bootstrap support290├── alignment/ # aligned.fasta (MSA) and trimmed.fasta (trimAl), when produced291├── figures/292│ └── phylogram.png # Proportional phylogram (matplotlib)293├── tables/294│ └── branch_support.csv # Per-node branch lengths and support values295└── reproducibility/296 ├── commands.sh # Exact CLI command used297 ├── environment.yml # Conda environment definition298 └── checksums.sha256 # SHA-256 checksums of all outputs299```300301## Gotchas302303- **Prank writes to `{prefix}.best.fas`, not `{prefix}`**. If using prank as aligner, the skill auto-renames this file. If you call prank manually, remember to look for the `.best.fas` suffix.304- **ModelFinder adds `+F` to models; RAxML-NG rejects it**. `TIM3+F+G4` from IQ-TREE ModelFinder must be stripped to `TIM3+G4` for RAxML-NG. The skill handles this automatically via `adapt_model_for_engine()`. If you pass `--model` manually with `--engine raxml-ng`, omit the `+F`.305- **UFBoot threshold is 95, not 70**. A common mistake is applying the standard bootstrap threshold (70) to UFBoot values. UFBoot support of 70 is NOT reliable. Use ≥ 95 as the cutoff for UFBoot.306- **Triple support labels contain `/`**. With `--bootstrap all`, node labels encode `alrt/abayes/ufb` (e.g. `80.5/0.85/97`). Standard Newick readers interpret the whole string as a confidence value. Use `strsplit(label, "/")` in R or split by `/` in Python.307- **trimAl on protein alignments may over-trim**. For small protein alignments (<20 sequences, >200 aa), use `--no-trim` or use `-nogaps` strategy instead of `-automated1`, which can remove too many columns.308- **IQ-TREE `-T AUTO` can block tests**. Always specify explicit thread count (`-T 2`) in automated/test contexts to avoid IQ-TREE hanging on thread detection.309- **Pre-aligned input still needs equal-length sequences**. If you use `--aligned`, the skill validates that all sequences are the same length. Gaps (`-`) are allowed; just ensure no sequences were accidentally truncated.310311## Safety312313- **All processing is local** — sequences never leave the machine.314- **Disclaimer**: every report includes the ClawBio medical disclaimer.315- **No hallucinated models or distances** — model and bootstrap values come directly from tool output.316- **Warn before overwriting** — script warns if output directory is non-empty.317318## Agent Boundary319320The agent (LLM) dispatches to this skill and explains the results. The skill (Python script) executes all computation. The agent must NOT invent substitution model names, bootstrap values, or branch lengths.321322## Integration with Bio Orchestrator323324Route to this skill when the query matches any `trigger_keywords` or the intent is maximum-likelihood tree inference. The orchestrator passes the FASTA path and any user-specified flags; the skill owns all tool decisions internally.325326After the run, read `result.json`:327- `chat_summary_lines` — surface to the user verbatim.328- `preferred_artifacts` — open the figure and tree file for the user.329- `run_mode == "demo-fallback"` — surface `contract_alerts[0]` to prompt IQ-TREE2 installation.330- `workflow_state == "completed"` — no retry needed.331332Do **not** pass raw tool flags from the user directly to the CLI without validation; use the documented `--flag` surface only.333334## Chaining Partners335336| Skill | When to chain |337|-------|--------------|338| `fastreer` | User wants a fast k-mer distance tree without full MSA |339| `variant-annotation` | Annotate variants found in sequences before building tree |340| `genome-compare` | Compare multiple genomes before phylogenetic inference |341| `profile-report` | Add evolutionary context to a patient profile |342| `claw-ancestry-pca` | Population structure analysis complements phylogenetics |343344## Dependencies345346| Dependency | Version | Required | Purpose |347|------------|---------|----------|---------|348| python | ≥ 3.10 | yes | Runtime |349| biopython | ≥ 1.80 | yes | Newick I/O, `root_at_midpoint`, visualisation |350| matplotlib | ≥ 3.5 | yes | Phylogram rendering |351| pandas | ≥ 2.0 | yes | Branch support CSV export |352| iqtree2 | ≥ 2.0 | recommended | ModelFinder + default tree engine |353| raxml-ng | any | optional | Alternative tree engine |354| mafft | any | optional | Default MSA aligner |355| muscle | ≥ 5.0 | optional | Alternative MSA aligner (v5 `-align`/`-output` syntax) |356| trimal | any | optional | Alignment column trimming |357| ete3 | ≥ 3.1 | optional | Midpoint rooting (Bio.Phylo fallback if absent) |358| clustalw | any | optional | Legacy MSA aligner |359| kalign | ≥ 3 | optional | Fast MSA for large datasets |360| t_coffee | any | optional | High-accuracy MSA for ≤ 20 sequences |361| prank | any | optional | Codon-aware MSA |362363Install all bioinformatics binaries:364```bash365conda install -c bioconda iqtree raxml-ng mafft muscle trimal clustalw kalign3 t_coffee prank366```367368## Maintenance369370- **Review cadence**: bi-annually, or when IQ-TREE2 / RAxML-NG release major versions.371- **Staleness signals**: IQ-TREE2 `-m MFP` syntax changes; RAxML-NG `--all` flag renamed.372- **Deprecation criteria**: superseded by a unified tree inference + annotation tool.373374## Citations375376- [IQ-TREE 2](https://doi.org/10.1093/molbev/msaa015) — Minh et al., 2020377- [RAxML-NG](https://doi.org/10.1093/bioinformatics/btz305) — Kozlov et al., 2019378- [ModelTest-NG](https://doi.org/10.1093/molbev/msz189) — Darriba et al., 2020379- [trimAl](https://doi.org/10.1093/bioinformatics/btp348) — Capella-Gutiérrez et al., 2009380- [MAFFT](https://doi.org/10.1093/molbev/mst010) — Katoh & Standley, 2013381- [MUSCLE v5](https://doi.org/10.1101/2021.06.20.449169) — Edgar, 2021 (bioRxiv); [MUSCLE v3](https://doi.org/10.1093/nar/gkh340) — Edgar, 2004382- [T-Coffee](https://doi.org/10.1006/jmbi.2000.4042) — Notredame et al., 2000383- [ClustalW](https://doi.org/10.1093/nar/22.22.4673) — Thompson et al., 1994384- [KAlign](https://doi.org/10.1186/1471-2105-6-298) — Lassmann & Sonnhammer, 2005385- [PRANK](https://doi.org/10.1126/science.1158395) — Löytynoja & Goldman, 2008386- [ETE3](https://doi.org/10.1093/molbev/msw046) — Huerta-Cepas et al., 2016387- [Bio.Phylo](https://doi.org/10.1186/1471-2105-13-209) — Talevich et al., 2012