Project annotated intron positions into protein sequences and alignment columns, then score whether those positions are
shared across orthologs: Dollo parsimony (dollo), Fitch parsimony (mp), weighted Dollo (dollo_weighted), plain counts
(counts), or a likelihood model with per-genome annotation error (likelihood).
Rust workspace, no runtime dependencies beyond the binary.
- See it work (5 minutes): run the demo (Try it) and the hand-checked
examples/. - A full run on public genomes:
docs/HOWTO.md, copy-paste steps from NCBI download to gains and losses per branch, for five or nine fungi. Needs OrthoFinder and MAFFT; run it on a cluster node. - Your own genomes:
docs/TUTORIAL.mdexplains each step of the pipeline and what to check. - Reference:
docs/USAGE.md(commands, options, methods, diagnostics) anddocs/OUTPUTS.md(every output file and column).
Also: docs/SPEC.md design, assumptions and references · docs/TESTING.md the test suite ·
bench/README.md validation runs on real data · docs/HANDOFF.md current state of the work.
GFF3/GTF ──► intron ──► cds_offset ──► (codon, phase) ──► MSA column ──► site × taxon matrix ──► scores
genome coding bases 0/1/2 nt homology 1 / 0 / ? per taxon dollo, mp, dollo_weighted,
space into the CDS into the codon unit per position counts, likelihood
The key idea: genome coordinates are useless across species, and residue numbers drift with indels — alignment columns are the homology unit. An intron's position is its CDS nucleotide offset, split into codon + phase, looked up in the protein alignment.
Requires Rust 1.85 or newer (rustup.rs, or conda install -c conda-forge rust).
git clone https://github.com/stajichlab/intronfate.git
cd intronfate
cargo build --release # binary at target/release/intronfate
cargo test --workspace # full suite, see docs/TESTING.mdThe binary has no runtime dependencies; copy it or put target/release on your PATH.
cargo run --release -p intronfate-cli -- demo -o intron_demoWrites a worked five-species example (inputs + every table) into intron_demo under the directory you run it from, and prints
the interesting tables. The last line is the demo checking its own numbers, so you can tell a good run from a broken build:
# format=2 alignment=demo alen=15 phase_mode=strict flank=1 masked_present=0 taxa=5 sites=3 unannotated=- residues=13,14,14,13,13
site column phase n_taxa n_observable pattern species1 species2 species3 species4 outgroup
4:0 4 0 4 5 11101 1 1 1 0 1
6:0 6 0 2 5 01100 0 1 1 0 0
9:0 9 0 3 5 10011 1 0 0 1 1
site column phase n_present n_missing gains losses monophyletic dollo_compatible gained_at lost_in
4:0 4 0 4 0 1 1 no no root species4
6:0 6 0 2 0 1 0 yes yes species2,species3
9:0 9 0 3 0 1 1 no no root species2,species3
site column phase n_present n_missing steps informative ambiguous
4:0 4 0 4 0 1 no no
6:0 6 0 2 0 1 yes no
9:0 9 0 3 0 1 yes no
demo inputs and tables written to intron_demo
expect 3 sites, 3 Dollo gains, 2 Dollo losses, 3 mp steps: got 3 sites, 3 gains, 2 losses, 3 steps
Three intron positions: two ancestral (each lost once) and one derived insertion on the species2/species3 stem. The annotated tree shows where the origins were placed:
(outgroup,((species1,(species2,species3)[gains=1])A,species4))[gains=2];
One pass over many gene-family alignments, with every family also stacked into one matrix (out/combined/):
intronfate analyze --gff-dir genomes/ --proteins-dir genomes/ --proteins-ext faa \
--msa-dir alignments/ --msa-ext aln.fasta --taxon-map taxon_map.tsv \
-t species.nwk --outgroup Spunctatus --combine -o outmatrix.tsv is the interchange format: intronfate score --matrix out/combined/matrix.tsv ... re-scores it under another tree,
rooting or method in seconds, without re-reading any annotation. The separate project, matrix and score commands, every option
and the input forms (files, list files, folders) are in docs/USAGE.md; the whole pipeline from download to results
is docs/HOWTO.md.
Read these first: diagnostics.tsv and unmatched.tsv (what failed to join, and why), then combined/dollo_branches.tsv (gains and
losses per branch) or, per family, <family>/summary_score.tsv and dollo_sites.tsv. Every file and column is described in
docs/OUTPUTS.md.
- Phase is part of site identity.
codon 5 phase 0andcodon 5 phase 1are different sites. Use--ignore-phasedeliberately, not by accident. - Missing is
?, never0. An unannotated taxon, a gap around the site, or an alignment row that is not the annotated protein is no observation; scoring it as "intron lost" would invent losses.--flanksets how much alignment around a site a taxon needs. Details:docs/USAGE.md§6. - Classic Dollo minimises losses, not gains. One gain per site is assumed, so the informative statistic is the loss count;
-m dollo_weightedsweeps the gain:loss cost when you need a real trade-off (docs/SPEC.md§5.1–5.2). - Dollo gain placement depends on rooting. Pass
--outgroup; if the Newick looks unrooted the tool warns instead of guessing. introns.tsvnumbers are per-protein. Cross-species comparisons usematrix.tsvcolumns.- Annotation and sequence must correspond.
unmatched.tsvand thelength_mismatchdiagnostic exist because a join onto the wrong paralog otherwise yields plausible-looking tables. - The result is only as good as the annotated introns. A missed intron looks like a loss and a false one like a gain;
bench/V7measures how far that moves the counts, and-m likelihoodwith--error-ratesmodels it (docs/USAGE.md§11).
Every step was run on a university HPC cluster; scripts, small result tables and a README per step are in bench/, indexed
with one-line results in bench/README.md: agreement with MALIN's published Dollo results, projection on nine
fungal genomes, genome-scale timing, annotation accuracy and its effect on the counts, ortholog tiers, and the how-to run end to end.
These are validation and first-use results, not a finished biological study. The tools have also been applied to a separate
research project.
crates/intronfate-core/ library: gff, annotation, seqio, msa, project, matrix, tree, score, likelihood, malin, tables, inputs, ...
crates/intronfate-cli/ the `intronfate` binary
docs/ HOWTO, TUTORIAL, USAGE, OUTPUTS, SPEC (design + references), TESTING, HANDOFF (state)
examples/ three runnable examples with committed expected output, plus 04_public_genomes (inputs for docs/HOWTO.md)
bench/ validation runs on the HPCC (index: bench/README.md)
tests/data/ tiny synthetic fixtures
scripts/ helpers for docs/HOWTO.md (one_protein_per_gene.py, make_families.py, align_families.sh, doc_blocks.py);
malin_to_matrix.py, an independent MALIN importer used as a cross-check;
test_*.py, the fixture tests (see docs/TESTING.md) — test_doc_samples.py checks the pages against the
binary, and mutate_doc_samples.py checks that those checks still fail when a page is wrong
Implemented: GFF3/GTF ingestion with frame/exon/length cross-checks, protein-space projection, FASTA/Stockholm alignments,
site × taxon matrices with per-cell missing data, pairwise sharing, the five scoring methods above (likelihood with
--error-rates, bootstrap intervals, gamma rate classes and separate gain/loss factors), TSV/NEXUS output, MALIN import/export
(convert) and MALIN's own FASTA input (--malin-fasta), RNA-seq junction support as soft evidence (junctions), combined
matrices over many families (--combine), and pipes in both directions (- for any single input, --stdout TABLE for one table).
Not yet: SQL/Chado/Ensembl annotation sources (the AnnotationSource seam is there), a site-by-site check of --malin-fasta
against a MALIN run on the same files, and Python bindings. The full list: docs/HANDOFF.md and
docs/SPEC.md §12.