Prune tree

Prune taxa from a tree

Command identity

Canonical command:

prune_tree

Handler:

prune_tree

Aliases:

prune

Standalone executables:

pk_prune_tree, pk_prune

Categories:

Tree manipulation & utilities

Runtime interface

Synopsis

phykit prune_tree <tree> <list_of_taxa> [--output <output>] [--keep <keep>] [--ignore-branch-labels] [--json]

Arguments

This table is generated from the live command parser. It is the authoritative source for accepted spellings, required arguments, types, defaults, and choices.

Argument

Required

Type

Default

Choices

tree

true

str

required

any

list_of_taxa

true

str

required

any

-o, --output

false

str

none

any

-k, --keep

false

str2bool

false

any

--ignore-branch-labels

false

boolean

false

any

--json

false

boolean

false

any

Output and errors

--json provides the command's structured JSON representation. Output-file options: --output. Invalid command syntax exits with status 2. Input validation and scientific limitations are described in the guidance below.

Guidance, interpretation, and examples

Prune tips from a phylogeny.

Provide a single column file with the names of the tips in the input phylogeny you would like to prune from the tree.

phykit prune_tree <tree> <list_of_taxa> [-o/--output <output_file>] [-k/--keep]
    [--ignore-branch-labels] [--json]

Options:
<tree>: first argument after function name should be a tree file
<list_of_taxa>: single column file with the names of the tips to remove from the phylogeny
-o/--output: name of output file for the pruned phylogeny. Default output will have the same name as the input file but with the suffix ".pruned"
-k/--keep: optional argument. If used instead of pruning taxa in <list_of_taxa>, keep them
--ignore-branch-labels: optional argument. Strip HyPhy/aBSREL-style {...} branch labels (e.g., Hydlep{FG}) from tip names when matching against <list_of_taxa>. The labels are preserved on the surviving tips in the output tree, so a list of bare names produced by tools like seqkit seq -n will keep (or remove) the foreground-tagged tips intact.
--json: optional argument to print results as JSON

Tip: when preparing trees for branch-site selection tests such as aBSREL or RELAX, use --ignore-branch-labels together with -k to subset a labeled species tree to the taxa present in a given orthogroup alignment without losing the {FG} (foreground) annotations on the labeled branches.