tree

zombi2 tools tree TREE applies a single action to a Newick tree and writes the result to stdout, or to a file with -o: a Newick tree for the transforms, a table or a number for the measurements. Exactly one action runs per call. TREE is a tree file, or - for stdin.

--prune and --clades need each tip's fate, so they read the fates a ZOMBI2 complete tree carries (the run's species_fates.tsv, found beside the tree); an ultrametric tree counts as all-extant, and a plain non-ultrametric tree with no fates is refused: there is no flag to hand fates in from elsewhere yet, so a foreign non-ultrametric tree cannot be pruned. Every other action ignores fates and loads any tree.

--clades lists the clades a tree offers to name, one row per internal node that passes the filter, biggest first, as node · extant · crown · example_tips, filtered by --min-extant / --max-extant. It is the read-back for Clade({...}): scoping a rate to a clade means naming a node, and nothing else tells you which nodes are there or how big they are. crown is when the clade first splits; the clade itself begins at that node's birth, because its root's own branch is inside it. The two example tips straddle the crown split wherever both sides left a survivor, so passing them to Clade({"label": ["tip_a", "tip_b"]}) names this very node. From Python, Clade.resolve(tree) answers the other direction: which lineages a clade you have already written actually covers.

zombi2 tools tree out/species/species_complete.nwk --clades --min-extant 5
node    extant  crown   example_tips
n0  25  0.0846268   n55,n31
n1  22  0.622912    n55,n7
n4  9   0.708753    n7,n30
Action What it writes
--prune the extant tree: the dead and unsampled lineages dropped, and the unifurcations they leave behind suppressed so the tree stays bifurcating
--round the tree snapped to exactly ultrametric, by extending the terminal branches to a common depth. --tol is the tolerance as a fraction of tree height (default 1e-3); a wider tip-depth spread raises an error, because that much spread is real tip-date signal, not rounding. Written round-trip exact: this is the flag whose whole promise is the exactness of the file. (A species tree is written at full precision, the shortest string that reads back as exactly the same float, which is well inside ape::is.ultrametric()'s tolerance, so an extant species tree from a dated run does not need this flag to survive R. A gene tree and a trait tree are written to seven significant figures, so those, and any tree that arrives near-ultrametric from somewhere else, are what this is for.)
--stem LEN / --stem-add LEN the branch above the crown set to LEN, or extended by LEN; nothing below the crown moves
--rescale-height H / --rescale-factor F every branch length scaled, so the root-to-tip height becomes H, or by a raw multiplier F
--red the RED-rescaled tree: node depths become their Relative Evolutionary Divergence (Parks et al. 2018), ultrametric on [0, 1] with the root at 0 and every tip at 1. --red --values writes a two-column node<TAB>RED table instead of a tree
--gamma Pybus and Harvey's γ (Pybus & Harvey 2000), as gamma<TAB><value>: where the branching times sit relative to what a constant rate would give. Standard normal under constant-rate pure birth, so 0 is the null; it goes negative when speciation slows toward the present, because the branching times bunch up early. It reads waiting times, so the tree must be dated and ultrametric: --prune first, and do not pass a phylogram
# drop the extinct lineages, extant tree to stdout
zombi2 tools tree out/species/species_complete.nwk --prune

# snap a rounding-noisy dated tree to ultrametric, to a file
zombi2 tools tree dated.nwk --round -o dated_ultrametric.nwk

# the RED of every node, as a table
zombi2 tools tree out/species/species_extant.nwk --red --values

# gamma — pipe a complete tree through --prune first
zombi2 tools tree out/species/species_complete.nwk --prune | zombi2 tools tree - --gamma