Aug 2026
bali-phy - Bayesian inference of alignment and phylogeny.
bali-phy [OPTIONS] SEQUENCE-FILE [SEQUENCE-FILE ...]
bali-phy uses MCMC to sample evolutionary trees, alignments, and model parameters from their posterior distribution. It analyzes nucleotide, amino-acid, and codon sequences. The companion command bpy-summarize produces a report with estimates and convergence diagnostics.
By default, BAli-Phy estimates the alignment as well as the tree;
unaligned sequences are suitable input. To keep the alignment fixed,
supply aligned sequences of equal length and use
-I none. In this case, gaps are treated as
missing data.
Estimate alignment and phylogeny:
bali-phy sequences.fasta
Analyze a fixed alignment:
bali-phy aligned.fasta -I none
Specify a substitution model with rate variation among sites:
bali-phy sequences.fasta -S 'GTR +> ASRV.Gamma'
Set the run length and random seed:
bali-phy sequences.fasta --iterations=10000 --seed=12345
Summarize the resulting run (assuming its directory is sequences-1):
bpy-summarize sequences-1
You can summarize runs while they are still in progress and update the report later.
Use bali-phy --help for common options.
Topic help describes option syntax and model choices:
bali-phy help smodel
bali-phy help HKY85
The hyphenated option forms shown here work on all platforms. Native
Windows also accepts slash forms such as
/iterations:1000.
The user's guide provides tutorials and fuller explanations of models and analyses: https://www.bali-phy.org/README.html.
Sequence files may use FASTA or PHYLIP format. Each file supplies a data partition, numbered from 1 in command-line order. Partitions share the tree but may have different models and parameters.
Each analysis creates a new output directory, normally based on the
input filename with a numeric suffix: sequences-1,
sequences-2, and so on. Use
--name to choose another base name.
Principal files within the directory include:
bpy-summarize reads the run directory and writes Results/index.html by default. See the user's guide for the full inventory of output files.
-i NUM,
--iterations NUM-s NUM,
--seed NUM-t,
--test-c FILE,
--config FILE--align FILEThe alphabet, substitution model, indel model, and scale options accept partition prefixes. See MODEL EXPRESSIONS AND PARTITIONS below.
-A ALPHABET,
--alphabet ALPHABETDNA,
RNA, Amino-Acids, or Codons.
Otherwise, an alphabet is inferred from the input. Specify codons
explicitly for codon analyses.
-S MODEL,
--smodel MODELbali-phy help smodel for defaults and
examples, and topic help for individual models and their parameters.
-I MODEL,
--imodel MODELRS07. Use
none to keep the input alignment fixed and treat gaps as
missing data.
-R EXPRESSION,
--scale EXPRESSION~Gamma(0.5,2); a constant such as 1 fixes the
scale. Scale defaults to 1 when the tree is fixed.
-T PRIOR,
--tree PRIOR~UniformTree(taxa).
Quote the expression, for example
--tree '~UniformTree(taxa)'. Use
--fix to supply a fixed tree or topology.
-F TARGET=FILE,
--fix TARGET=FILEtopology=FILE to fix the topology while estimating
branch lengths, or tree=FILE to fix both. FILE may contain
a Newick or Nexus tree. These forms cannot be combined with
--tree. To fix the alignment for MCMC, use
-I none.
-L PARTITIONS[:ATTRIBUTES],
--link
PARTITIONS[:ATTRIBUTES]smodel, imodel, and scale;
omitting the attribute list links all three. For example,
--link 1,2:smodel,scale links substitution-model parameters
and scales. Linked specifications must be compatible.
--subst-rates MODELconstant (the default), relaxed, or a model
expression specifying branch rates.
--indel-rates MODELrelaxed (the
default), constant, or a model expression specifying branch
rates.
--variables SOURCE-n NAME,
--name NAME-l FORMAT,
--log-format FORMATtsv (the default for inference), json,
or tsv,json for scalar parameter logs.
-V,
--verbose,
--verbose NUM-h,
--help-v,
--versionQuote model expressions containing spaces or shell punctuation:
bali-phy sequences.fasta -S 'HKY85 +> ASRV.Gamma'
For partition-specific settings, prefix the expression with partition numbers and a colon:
bali-phy gene1.fasta gene2.fasta -S '1:HKY85' -S '2:GTR'
Without a prefix, -S HKY85 gives each
partition a separate copy of the model with separate parameters.
-S '1,2:HKY85' gives those partitions a
shared model and shared parameters. The same distinction applies to
indel models and scales. Alphabet prefixes choose which partitions
receive an alphabet. Repeat an option for different partitions; do not
specify the same partition twice for the same attribute.
bali-phy print EXPRESSION
[-A ALPHABET]
Evaluate a model-language expression and display its value. This is useful for exploring models without running an analysis. Supply an alphabet when the expression depends on one:
bali-phy print HKY85 -A DNA
bali-phy print 'HKY85 +> ASRV.Gamma' -A DNA
Model parameters with priors are sampled when the expression is
evaluated. Use --seed to repeat a
particular draw. For these examples, the output is a rate matrix or a
mixture of rate matrices.
For example, analysis.config could contain:
:align sequences.fasta
:smodel GTR +> ASRV.Gamma
:iterations 10000
:name analysis
Run it with:
bali-phy --config analysis.config
Write each option as :option value, using its long name.
Model expressions in the file do not need shell quotes. Blank lines and
lines beginning with # after optional whitespace are
ignored. Other lines supply model-language definitions and retain their
order.
A scalar command-line option overrides its configuration-file value. Repeated options, such as sequence files and model specifications, are combined, with command-line values first; avoid assigning a model twice to the same partition.
These commands support standalone programming and compiler
inspection. For additional help,
bali-phy help advanced,
bali-phy help expert, and
bali-phy help developer show successively
more detailed command-line help.
main
function. Put BAli-Phy options before PROGRAM. All later arguments
belong to the program, including arguments beginning with a hyphen; no
separator is needed. For example:
bali-phy --seed=1 run Model.hs --iterations=1000 data.fasta
-P PATHS,
--package-path PATHS--set KEY=VALUEThese options are for compiler debugging and tuning, and are unnecessary for ordinary analyses. They apply globally. With run, place them before PROGRAM; with test-module, before MODULE.
--dump-parsed,
--dump-rn,
--dump-tc,
--dump-ds,
--dump-opt--dump-ffi--optimize=false--inline-threshold NUM--cpp{-# LANGUAGE CPP #-} pragma in a module.
-D MACRO[=TEXT],
--cpp-define MACRO[=TEXT]1 if TEXT is omitted.
Does not itself enable CPP.
--cpp-undefine MACRO--dump-cppBAli-Phy online help: https://www.bali-phy.org/docs.php.
Please send bug reports to bali-phy-users@googlegroups.com.
bpy-summarize(1), statreport(1), bali-phy-pkg(1)