October 2026
alignment-thin - Remove sequences or columns from an alignment.
alignment-thin [OPTIONS] alignment-file
Read an alignment, remove selected sequences or columns, and write
the resulting alignment in FASTA format to standard output. The
alignment filename is required; use - to read standard
input. Diagnostics and --find-dups reports
go to standard error.
Sequence filtering precedes column filtering. Length filters run first, followed by selection by name, removal of gappy sequences, and similarity thinning. Column filters therefore use the remaining sequences. Empty columns are retained unless a column filter removes them.
--protect,
--keep, and
--remove accept comma-separated names or
@filename. In a names file, separate names with commas or
newlines. Names are matched exactly. To supply an initial literal
@, escape it as \@ and quote the argument for
the shell.
Protected sequences survive all sequence filters.
--keep also protects the listed sequences
and retains any sequences named by
--protect, even if a length filter would
remove them. --keep and
--remove cannot be given together.
To list sequence names or lengths, use
alignment-info --show-names or
alignment-info --show-lengths instead.
--help--verbose--protect names--keep names--protect. These sequences are protected
from subsequent sequence filters.
--remove names--longer-than length--shorter-than length--cutoff countN) and the other sequence has a different symbol,
including a gap. The count can differ when the two sequences are
exchanged. Protected sequences are never removed.
--down-to count--cutoff, the result can contain fewer
than count sequences to satisfy the similarity cutoff.
--remove-gappy count--conserved fraction
(=0.75)--remove-gappy, the minimum fraction
of retained sequences with a present character needed to classify a
column as conserved. Conservation here refers to occupancy, not
identity.
--keep-columns name--min-letters and
--remove-unique. The sequence is looked up
in the original alignment, even if removed by a sequence filter. Does
not override --erase-empty-columns.
--min-letters count--remove-unique length--keep-columns protection. Internal runs
are shortened from the middle; terminal runs are shortened from the
outer end.
--erase-empty-columns-) and unknown calls (?) do not
count as present; ambiguous non-gap states such as DNA N
do.
--sort--find-dups names@filename is not supported for this option. Targets are
chosen by mismatches at positions where both sequences have present
characters other than fully unknown states such as DNA N.
Reports use the original alignment, before filtering, and do not replace
the alignment written to standard output.
Keep only selected sequences:
alignment-thin --keep=seq1,seq2 file.fasta > selected.fastaRemove named sequences, or sequences of length 250 or less:
alignment-thin --remove=seq1,seq2 file.fasta > filtered.fasta
alignment-thin --longer-than=250 file.fasta > long.fastaThin to 30 sequences while protecting names listed in a file:
alignment-thin --down-to=30 --protect=@names.txt file.fasta > thinned.fastaThin sequences using a cutoff of five directional mismatches:
alignment-thin --cutoff=5 file.fasta > thinned.fastaRemove up to ten sequences with poor coverage of conserved columns:
alignment-thin --remove-gappy=10 file.fasta > filtered.fastaKeep columns with at least five present characters, retaining columns
occupied by reference:
alignment-thin --min-letters=5 --keep-columns=reference file.fasta > columns.fastaRemove empty columns from standard input:
alignment-thin --erase-empty-columns - < file.fasta > compact.fastaReport each non-target sequence's nearest target, discarding the alignment output:
alignment-thin --find-dups=seq1,seq2 file.fasta > /dev/nullalignment-cat(1), alignment-info(1)
BAli-Phy online help: http://www.bali-phy.org/docs.php.
Please send bug reports to bali-phy-users@googlegroups.com.