October 2026
alignment-max - Construct a posterior decoding alignment from an alignment sample.
alignment-max [OPTIONS] < SAMPLES
Construct a representative alignment from a sample of alternative alignments of the same sequences, such as a sample produced by BAli-Phy. This is called posterior decoding: the sample is used to estimate support for alignment columns, and the program chooses a combination of columns with the best overall score while preserving sequence order. The result can combine columns from different samples; it need not be one of the input alignments.
A column's support is the fraction of retained samples in which it occurs. By default, the score favors columns that have both high support and many aligned residue pairs. Here a residue is a sequence unit, such as a nucleotide or amino acid. A residue pair is two residues from different sequences placed in the same column. Other scoring choices are described below.
Use this tool when you want one complete alignment summarizing a sample. To retain relationships according to a chosen support threshold, use alignment-consensus(1). To assess support for individual residues in an existing alignment, use alignment-gild(1).
Read FASTA alignments separated by empty lines from standard input. Sequence names must match, although their order may differ. For each sequence, its length after removing gaps must be the same in every sample. Recognized BAli-Phy ancestral placeholders are removed before decoding.
Write the resulting FASTA alignment to standard output, or to the
file named by --out. --out-probabilities
writes one support value per output column, in the same order, so that
less certain parts of the alignment can be identified. Diagnostics go to
standard error.
Let p be a column's estimated probability and n its number of
residues. The score combines contributions from all columns in the
proposed alignment. --score selects how they are
combined:
n*p, weighting each column by its
residue count.
n*(n-1)*p/2, weighting each column by
its number of residue pairs. This is the default. A column with only one
residue contributes zero to this score.
--column-pr homology estimates a column's probability
from how often the same residues and gaps occur together. Residues are
identified by their positions in their sequences, not by their letter
values. For a sequence with a gap in that column, the location of the
gap within the sequence does not matter.
--column-pr alignment also requires that gap to occur at
the same position between residues. Both estimates are fractions of the
retained sample, without added counts.
DNA, RNA, Amino-Acids,
Amino-Acids+stop, Triplets,
Codons, and Codons+stop.
sum, wsum, wsum2, or
multiply. Default: wsum2. See SCORING.
homology or alignment column
probabilities. Default: homology.
true or
false. Default: true. This preserves which residues occur
together.
-, meaning
standard output.
homology
definition above, even when decoding uses
--column-pr alignment.
Decode an alignment with the default residue-pair weighting:
alignment-max --skip 100 < samples.fastas > decoded.fasta
Write the alignment and its column probabilities to separate files:
alignment-max --out decoded.fasta --out-probabilities columns.txt < samples.fastas
Use the product objective and retain the decoder's column ordering:
alignment-max --score multiply --sort false < samples.fastas > decoded.fasta
Write a graph for inspection with Graphviz:
alignment-max --debug-graph decoding.dot:100 < samples.fastas > decoded.fasta
alignment-consensus(1), alignment-gild(1), alignment-distances(1)
BAli-Phy online help: https://www.bali-phy.org/docs.php.
Please send bug reports to bali-phy-users@googlegroups.com.