October 2026
alignment-chop-internal - Remove ancestral sequences from FASTA alignment samples.
alignment-chop-internal -N count < alignments-file > leaves.fastas
alignment-chop-internal
--tree tree-file <
alignments-file > leaves.fastas
Read FASTA alignments from standard input and write selected sequences from each alignment to standard output. Read input through shell redirection or a pipe; there is no positional input filename.
Choose exactly one selection method: retain the first N sequences
with --nleaves, or retain sequences whose
names occur as leaves in --tree. Ancestral
sequences are not identified from their contents.
Each input alignment begins with a FASTA header whose first character is > and ends at an empty line or end of input. Separate successive alignments with empty lines. Text before or between alignment blocks is skipped while looking for the next header. Output alignments are in FASTA format, separated by empty lines.
Sequence names are the text after > up to the first space or tab; the remaining header text is a comment. Letters are converted to uppercase, but sequence names retain their case. Retained sequences keep their input order and columns, including columns containing only gaps. The tool does not interpret a sequence alphabet or require equal sequence lengths.
--help--nleaves count--tree.
--tree tree-file--nleaves.
Empty leaf labels are ignored with a warning; duplicate nonempty leaf
labels cause an error. An alignment with fewer sequences than the number
of distinct nonempty leaf labels also causes an error. Otherwise,
selection keeps every sequence whose name matches a leaf label: it does
not check that every leaf occurs in the alignment or that alignment
sequence names are unique.
Keep the first five sequences in every sampled alignment:
alignment-chop-internal -N 5 < samples.fastas > leaves.fastas
Keep sequences named by the leaves of a reference tree:
alignment-chop-internal --tree reference.tree < samples.fastas > leaves.fastas
Select the last alignment, then retain its leaf sequences:
alignment-find < samples.fastas | alignment-chop-internal --tree reference.tree > leaves.fasta
Returns 0 on success (including --help)
and 1 when an error is reported. Warnings and error messages are written
to standard error. Input containing no alignment blocks produces no
output and succeeds, provided the selection options and any tree input
are valid. If a later alignment fails, output from earlier alignments
may already have been written.
alignment-find(1), alignment-cat(1), cut-range(1)
BAli-Phy online help: http://www.bali-phy.org/docs.php.
Please send bug reports to bali-phy-users@googlegroups.com.