Learning center

Tree Comparison: weighted path distance, constant correlation and complete exports

Read two four-leaf synthetic examples without confusing weighted branch paths,topology,correlation or rounded display values.

Written guide to Path Length Dist in Computational Biology’s Tree Comparison app. Two saved native examples compare small synthetic trees with four named leaves. They demonstrate branch-length-weighted path distance and complete exports for one selected route. They do not establish which tree is biologically correct or validate the app’s other comparison methods.

1. Preserve the named trees and common branch units

The app is identified as computational_biology/Tree comparison. The saved cases supplied a named tree_newicks bundle directly to the app, then exercised native Run, the actual viewer and Export All. They did not test a Load dialog or a complete launcher/upload journey.

Each example contains two Newick trees with the same four unique leaves: A, B, C and D. The app’s uploaded-tree workflow requires at least four taxa. Keep the labels unique, nonempty and identical across the compared trees. This route does not silently reduce different taxon sets to their intersection.

Every non-root branch needs an explicit finite, nonnegative length. A missing length is not an instruction to substitute zero; an explicit zero length is permitted. Root-stem length is excluded from leaf-to-leaf paths. Both trees’ branch lengths must have the same units. The synthetic examples do not attach a biological unit, and the app does not independently establish common units or convert between files.

Use the first two named trees for this route. The source snapshot reviewed for these examples also has a separate alignment-derived-tree path; that path is not part of these two native examples. The analysis-settings lesson explains why the selected method and input representation belong with the saved result.

2. Select the weighted path-distance route

Select Path Length Dist, route path_length_distance. A patristic distance is the sum of branch lengths along the path between two leaves. Four leaves give six unordered pairs: AB, AC, AD, BC, BD and CD. Each pair contributes once.

The app subtracts the corresponding path lengths, squares those differences, sums them and takes the square root. That is the Euclidean distance between the two six-value path vectors. The result, PLD, has the same units as the input branches. It is neither a count of topological disagreements nor the sum of squared distances; it is also not divided by six.

The official phangorn tree-distance reference distinguishes weighted paths from its default edge-count convention through use.weight. The app’s named comparison is the weighted variant, corresponding to use.weight=TRUE. These receipts use retained hand-summed references; they do not record an independent R/phangorn execution.

3. Read the small-scale example without rounding it to zero

The first pair is named Weighted X and Weighted Y. Their topology is the same, while two supplied branch lengths differ. The saved independent reference lists these paths, shown here in decimal form:

PairWeighted XWeighted Y
AB0.000030.00004
AC0.000140.00016
AD0.000150.00017
BC0.000150.00016
BD0.000160.00017
CD0.000090.00009

The reference PLD is approximately 3.3166247903554e-05; the saved CSV retains 3.3166247903553995e-05. This small nonzero value must not become zero through coarse display rounding. The table’s Mean |Delta| is the mean absolute path difference, a different quantity from PLD.

The saved Pearson correlation is 0.9920226646013991. High correlation means the path vectors vary similarly; it does not mean their magnitudes are identical. Here the branch-length-weighted distance remains nonzero even though the topologies agree.

The figure pairs a path scatter with a matrix of absolute differences. Read the axes’ scientific-notation multipliers: the small-case scatter uses 10⁻⁴ and its colorbar uses 10⁻⁵. The symmetric heatmap contains each off-diagonal pair twice, while PLD uses only the six unique pairs. The saved receipt retains the full scatter and matrix values; this guide does not recompute the trees or distances.

4. Keep a valid zero distance separate from undefined correlation

The second pair, Constant X and Constant Y, consists of identical four-leaf stars with every branch length equal to one. All six leaf-pair paths equal two. Their saved PLD and mean absolute difference are both 0.0, while correlation is explicitly undefined (constant pairwise paths).

A correlation coefficient requires variation in both path vectors. Do not replace undefined with zero or one. The distance itself remains valid. The zero-difference figure contains an explicit zero annotation and a single zero colorbar tick; its plotting range is not evidence of a nonzero difference.

The separate Branch Length Correlation route compares a different set of quantities. A later, separately reviewed source guard refuses constant inputs in that route through its existing no-data result. Its focused method checks are separate from these Path Length Dist exports. That repair does not invalidate the zero PLD example or expand this guide to all branch-comparison methods.

5. Save the complete table and its companion files

Use the viewer’s Export All for the selected result. Each saved case contains four artifacts plus artifact_manifest.json; the two cases total ten files:

ArtifactWhat to retain
Path_Length_Distance.csvAll nine fields: PLD, Mean |Delta|, Correlation, N Pairs, Scope, Units, First Tree, Second Tree and Ref.
Path_Length_Distance.pngThe scatter and difference-matrix figure. It does not replace the exact numeric table or the source trees.
Input_and_methods.txt
Summary.txt
The app’s input/method description and selected-run summary. Keep the actual Newick inputs separately.
artifact_manifest.jsonIdentities of the four artifacts. Integrity accounting is not a scientific validation certificate.

The native viewer’s long Scope, Units and Ref strings required full-value access beyond their initially visible cells. The CSV retains them completely. This guide reopened all eighteen saved CSV values across both cases and checked them against the native receipts, including the literal undefined-correlation text and full PLD precision.

The CSV is a summary table, not an export of all six paths or the full matrix. Those arrays are retained in this example’s evidence receipt. Preserve the two source trees to support future reproducibility; these five-file packages are not reloadable app sessions.

6. Respect the input and source boundaries

Existing focused cases cover missing, negative or nonfinite branch lengths, mismatched or duplicate labels, unlabeled leaves and an overflowing path sum. Their scope is bounded. Do not treat the simple Newick parser as proof of support for every Newick dialect or arbitrary malformed input. No real-tree benchmark, large-tree performance test or unit-conversion check is established here.

The saved-only review at 16:31 UTC on 11 November 2026 compared snapshot 25d5d907… with the native snapshot af9ddb85…. At that inspection, the selected weighted-path method and eleven input, display and path helpers matched, while seven other methods differed. This is a dated source comparison, not a statement that every later input function remains unchanged.

7. Check later input handling separately

The source integration on 12 November 2026 UTC adds a complete-consumption check and a named refusal for the retained trailing-text example. A saved-only comparison with integrated e1a9b518… confirms that the weighted-path method and eight other selected helpers still match the native source. The parser, collection adapter and run_analysis now differ. The earlier twelve-function match remains a dated observation.

Read the complete named-input and refusal lesson before interpreting a collection of supplied trees. Its recorded early method check uses test adapters and performs zero metric calls. It adds no new weighted-path calculation, valid full analysis, native GUI or export acceptance. Both numerical examples and their saved tables above remain unchanged.

Download the dated weighted-path source comparison, including all twelve selected function identities and the three changed input functions.

Worked examples describe particular inputs, methods and recorded results. Check current availability and input requirements before planning an evaluation.

← Back to the learning center