Feb 2018
tree-mean-lengths - Compute conditional branch and node lengths for query trees.
tree-mean-lengths --tree tree [OPTIONS] file1 [file2 ...]
tree-mean-lengths --trees query output [--trees query output ...] [OPTIONS] file1 [file2 ...]
Compute conditional branch and node lengths for query trees.
Use --tree for one query with output on stdout, or repeat --trees to specify query/output filename pairs. Each --trees takes exactly two arguments; remaining positional arguments are sample files. Filenames are literal: commas and colons are not separators. The two query options are mutually exclusive.
Each query file supplies its first tree, using the existing Newick/NEXUS loader. All queries must have the same leaf-label set, but need not be nested or compatible. The sample files are read once, applying --skip, --subsample, and --until independently to each file. --ignore prunes samples; query trees must already contain the resulting leaf set. All output-mode options apply to every query.
An output filename of - means stdout. At most one query may use stdout. Output filenames must be distinct and must not refer to any query or sample input file.
Trees are interpreted as unrooted. An artificial degree-two Newick root is suppressed in both the query and sampled trees; its two branches form one edge. Internal labels do not select rooted comparisons.
Each branch mean uses only samples containing that branch's exact split. For a multifurcating query node, a sample qualifies only if it contains every split incident to that node. Its node-length observation is the sum of lengths of the sample branches resolving that multifurcation. These branches lie between the matched incident branches. A qualifying sample with no resolving branches, or with resolving branches of total length zero, contributes zero.
Each branch and node has its own contributing-sample count. Conflicts elsewhere in a sample do not exclude it. Samples may themselves contain multifurcations. By default, each node mean is divided equally among its incident query branches and added to their branch means. Use --show-node-lengths to keep the two kinds of estimates separate, or --no-node-lengths for branch means alone.
A requested branch or node with no qualifying samples makes that query unavailable. Without --safe, report it, leave its output untouched, write the available queries, and return failure after attempting all outputs. With --safe, write that query's topology without lengths instead; unavailable estimates then do not cause failure. A missing node estimate does not prevent branch-only output modes from succeeding.
Invalid queries or destinations fail before processing samples. Sample input or parsing errors abort estimation before opening outputs, even with --safe; partial estimates are not written. Output opening/writing errors are reported and other outputs are still attempted, with failure returned at the end. Output writes are independent, so a write failure may leave its own file incomplete.
Day's interval algorithm matches splits in linear time without constructing bitsets. Conceptually cutting the matched edges identifies the components whose lengths contribute to eligible query nodes. Both operations take linear time and memory per sample per query, excluding tree input. Each query index is constructed once. Batching shares sample parsing and construction while retaining independent matching and observation counts for every query; sampled trees are not retained.
Compute separate branch and node means for several consensus trees in one pass:
tree-mean-lengths --trees c50.tree c50.ltree --trees c80.tree c80.ltree \
--show-node-lengths --safe run1.trees run2.trees
Write one result to stdout and another to a named file:
tree-mean-lengths --trees c50.tree - --trees c80.tree c80.ltree \
--show-node-lengths samples.trees > c50.ltree
BAli-Phy online help: http://www.bali-phy.org/docs.php.
Please send bug reports to bali-phy-users@googlegroups.com.