October 2026
alignments-diff - Compare the placement of residues in two alignments.
alignments-diff [OPTIONS] ALIGNMENT1 ALIGNMENT2
Compare two alignments of the same sequences to show where their alignment of residues differs. A residue is identified by its position in its sequence, so repeated copies of the same letter are distinct. The program matches columns while preserving their order, favoring matches that place the same residues together.
By default, write annotations for coloring the first alignment with alignment-draw. This provides a visual comparison of alternative alignment estimates. With --dual or --merge, write the alignments themselves with extra blank columns inserted to line up corresponding residues.
ALIGNMENT1 and ALIGNMENT2 are required positional filenames. Each contains one alignment. Both must contain the same sequence names and the same sequences after removing gaps. Sequence order may differ; the second alignment is reordered to match the first.
Output goes to standard output; diagnostics go to standard error.
The default output is a space-separated annotation table for ALIGNMENT1. Its header lists sequence names, followed by one data row per column of that alignment. Each row has one value per sequence and an additional, unlabelled value for the whole column:
These are comparison categories, not probabilities. Use --scale identity and a diff[N] color scheme in alignment-draw, with N equal to --classes.
With --dual, write two FASTA alignments with
corresponding columns, separated by empty lines. With
--merge, write one FASTA alignment: the first
alignment's rows, a blank separator row, and the second alignment's
rows. Each name from the second alignment has 2
appended.
With --merge --differences-file, also write an annotation table for the merged alignment to the specified file. In this table, a residue receives 1 when the same residue occurs in the corresponding column of both alignments, and 0 otherwise. Separator and whole-column values are 0. This table records agreement rather than the difference categories of the default output.
DNA, Amino-Acids, or
Codons.
gap
or unknown. Default: gap.
Highlight differences on the first alignment:
alignments-diff first.fasta second.fasta > differences.txt
alignment-draw first.fasta differences.txt --scale identity \
--color-scheme 'diff[1]' --show-ruler > comparison.html
Write both alignments with corresponding columns:
alignments-diff --dual first.fasta second.fasta > paired.fastas
Combine the alignments and save agreement annotations:
alignments-diff --merge --differences-file agreement.txt \
first.fasta second.fasta > merged.fasta
alignment-draw(1), alignment-compare(1)
BAli-Phy online help: https://www.bali-phy.org/docs.php.
Please send bug reports to bali-phy-users@googlegroups.com.