MCMC kernel · phylogenetics

Sample the tree and the alignment together.

EvolMoves is an MCMC kernel that jointly infers the phylogeny and the multiple sequence alignment of a set of sequences — so you never have to fix the alignment first and pretend it was certain.

TypeScript reference WebAssembly + WebGPU TKF92 indel model
tree + alignment · one posterior sampling
Each posterior sample is a whole evolutionary history — topology, branch lengths, ancestral sequences, and the gaps — drawn as one object.

The move

One Metropolis‑Hastings step, three parts.

The sampler walks the joint posterior over histories with HMM-based proposals that edit the tree and the alignment at once, then accepts or rejects to keep the chain exact.

01 · MODEL

A principled indel model

The target is the posterior implied by the Generalized Geometric Indel model, closely approximated by TKF92 — indels and substitutions on a continuous-time tree.

02 · PROPOSE

HMM Forward & traceback

Pair- and triad-HMM Forward algorithms with stochastic traceback propose realignments, subtree prune-and-regraft, and topology moves — alignment-aware.

03 · ACCEPT

Metropolis‑Hastings

Every proposal is accepted or rejected against the exact Hastings ratio, so the chain samples the true joint posterior — validated by detailed-balance and SBC tests.

What it does

A model toolkit for co-estimating history.

Beyond the joint tree-and-alignment core, EvolMoves carries a broad menu of substitution, indel, and tree-prior models — added as plugins, each gated by detailed-balance or simulation-based-calibration tests.

Core

Joint tree + alignment sampling

Co-samples tree topology, branch lengths, ancestral sequences, and the multiple alignment under the TKF92 indel model — no fixed guide alignment required.

SPR / SPRANNIrealign-subtree
Indels

TKF92 & alignment plugins

The TKF92 pair/triad HMM at the core, plus MixFrag fragment-mixture indels, MixDom domain segmentation, and the TKF-DP column-covariation samplers.

--mixfrag--mixdom--sample-tkfdp--sample-dynfield
Substitution

Substitution & codon models

Reversible GTR, LG-C site-class mixtures, +Γ and +I, and empirical codon (ECM) models — with sampleable rates and frequencies.

--gtr--gamma--invariable--sample-cmixture
Selection

dN/dS, CAT & heterotachy

Goldman-Yang ω, per-site positive selection (FUBAR-style, reporting P(ω>1)), branch and branch-site tests, the CAT profile mixture, and RASER covarion rate-switching.

--sample-gy-omega--sample-site-omega--branch-site-omega--sample-cat--sample-raser
Time trees

Clock & diversification priors

Dated time-trees with a constant-Ne coalescent (serial tips) and a UCLN relaxed clock; Yule, birth-death, and fossilised birth-death priors; node calibrations and monophyly constraints.

--time-tree--yule--birth-death--fbd--calibrate
Phylodynamics

Epidemic & structured models

Birth-death skyline Re(t), mechanistic birth-death SIR and PhyDyn coalescent (R₀, prevalence), parametric growth coalescents, multi-type BDMM, MASCO structured coalescent, and Lemey discrete-trait phylogeography.

--bdsky--bdsir--phydyn--bdmm--masco
Sampling

Sampling machinery

ESS and structure-ESS diagnostics, adaptive move weighting, replica-exchange (MC³), MEA consensus decoding, posterior-predictive checks, and batched multiple-try reattachment.

--replica--weight-batch-reattachconsensus-alignment
Performance

Multi-tier acceleration

A TypeScript reference implementation, with the hot DP kernels ported to WebAssembly (Rust) and WebGPU/WGSL — validated bit-for-bit against the reference. CPU/WASM is bit-exact and reproducible; --gpu opts into WebGPU.

TypeScriptRust · WASMWebGPU

Also: a BEAST2 XML importer maps common tree priors, site models, clocks and MRCA calibrations onto an equivalent EvolMoves run — with a published compatibility matrix.

EvolBrew · in the browser

Run the kernel with nothing installed.

EvolBrew is the in-browser front end: it runs the same EvolMoves kernel entirely client-side via WebAssembly and WebGPU — load sequences, launch a chain, and watch the posterior converge on a live dashboard. Nothing is uploaded to a server.

Get it

Open source, and documented.

EvolMoves is a research reference implementation. Read the LaTeX spec of every algorithm, run it from the command line, or extend it with a plugin.

# sample trees + alignments from a Stockholm file
$ npx evolmoves -i input.stk -m model.json -n 10000 -s 1 -o samples.stk
 
# build a start alignment, then decode a consensus
$ npx evolmoves init -i seqs.fasta -o input.stk
$ npx evolmoves consensus-alignment -i samples.stk

npx evolmoves --help lists every flag, grouped by category.