Learning center

Branch scores: complete edge lengths, unrooted coordinates and export precision

Read the retained length-bearing tree comparison, combined root edges and absolute-residual summaries, while preserving complete CSV precision and native export limits.

Branch Score Distance compares edge lengths after matching their unrooted taxon splits. Read its treatment of terminal edges, root placement and absent splits, then distinguish the numerical export from the rounded viewer display.

Scope of this guide. One retained native workflow compares a synthetic four-taxon pair. Separate small checks cover selected length, topology and refusal cases. A separate section below explains three saved Tree Length Ratio API cases, with no ratio native or export coverage. A saved-only review on 11 November 2026 compared snapshot 91220f38… with the executed snapshot: twelve selected functions and three shared dependency files match. The full app files differ; this guide does not establish a new whole-app run, a biological benchmark or broader release acceptance.

Product and app: Computational Biology · Tree Comparison & Topology Metrics · computational_biology/Tree comparison.

1. Retain both complete length-bearing trees

The first tree is named Reference AB|CD, and the second Comparison AC|BD. Their exact input strings are:

((A:1,B:2):3,(C:4,D:5):6);
((A:1,C:4):1,(B:2,D:5):1);

They contain the same four taxa and identical terminal lengths for A, B, C and D. The numbers are synthetic branch lengths, not measurements of elapsed time. For a real comparison, retain compatible length definitions and scales; the numeric input checks do not establish biological units.

The source’s supplied-tree path requires at least four taxa and matching taxon sets. This route checks unique labels and complete finite, nonnegative lengths on every non-root edge. A missing length differs from an explicitly supplied zero. Preserve the original strings, names and order rather than filling missing lengths to obtain a result.

The native review supplied the named-tree bundle when the app opened and then exercised Run, the viewer and Export All. It did not test a Load dialog, launcher, hosted upload or sequence-inference path. Confirm the delivery contract before planning a run. All twenty methods start selected in the reviewed source; retain only Branch Score, identified by branch_score_distance, for this example.

2. Understand the unrooted coordinates

Input or coordinateMeaning in this route
Terminal edgesIncluded. Each separates one taxon from all the others; changes in their lengths can affect the distance.
Internal edgesIdentified by unordered taxon bipartitions, rather than drawing position or parser row number.
Degree-two rootIts two incident lengths describe the same unrooted split and are combined. In the first input, 3 and 6 contribute to one length of 9.
Root stemExcluded from this unrooted comparison. Its placement does not create a separate coordinate here.
Split present in only one treeThe other tree contributes zero for that coordinate. This is distinct from accepting a missing length on an edge that is present.

The PHYLIP Treedist documentation defines branch score using terminal and internal split lengths and explains combining the two sides of an inserted root. It is primary methodological context, not evidence that a PHYLIP executable was run for this guide.

The source refuses incomplete, nonfinite or negative non-root lengths and checks that combined lengths stay finite. The retained small cases do not establish full Newick grammar, arbitrary malformed structures, extreme magnitudes, large-tree resource limits or rooted-tree semantics.

3. Read the retained distance within its scope

For each split coordinate, subtract the second tree’s length from the first tree’s length. Branch score is the square root of the sum of squared residuals. Keep the same length scale across both inputs; the distance follows that scale and is not a probability, confidence level or count of evolutionary events.

The existing independent reference records four equal terminal-edge coordinates and two different internal coordinates, with lengths 9 and 2. Their retained expression is sqrt(9² + 2²), or sqrt(85). The recorded result is 9.219544457292887. These are saved reference values; no tree parsing or distance calculation was repeated for the writing review.

N Branches = 6 counts the union of split coordinates used across the two trees. It does not mean that either original tree independently has six unrooted edges. For a question about topology alone, use the distinct definitions in the RF guide. For lengths along leaf-to-leaf paths, see the weighted path-distance guide.

4. Read all eight saved fields

Saved fieldRetained value
BSD9.219544457292887
Mean Residual1.8333333333333333
Max Residual9.0
N Branches6
ScopeUnrooted; all pendant and internal edges; root stem excluded
First TreeReference AB|CD
Second TreeComparison AC|BD
RefKuhner & Felsenstein, Mol Biol Evol 1994

Despite its shorter label, Mean Residual is the mean absolute residual in the source. Max Residual is also an absolute magnitude. The residual figure, by contrast, uses signed first-minus-second differences. Keep those definitions when comparing a table value with a bar.

The historical viewer displays BSD as 9.2195445, while the CSV retains 9.219544457292887. These table values remain floating-point scalars before export; this route does not pre-round them into the summary strings used by some other methods. Retained digits still describe serialized floating-point values, not arbitrary-precision arithmetic.

5. Use the plot with its coordinate and precision limits

The first panel compares the two length vectors. The second shows signed residuals, with its vertical-axis label identifying the input order. Its numbered branch positions refer to the sorted split-coordinate union, not genomic positions or a tree-drawing layout.

The source logs additional rounded summaries, including a normalized BSD, but the eight-field native CSV does not contain that normalized field or the complete branch-length and residual vectors. Do not infer a separate numerical vector export from a plotted bar. Retain the original trees and the declared coordinate rule if a later reproduction needs those vectors.

The accepted historical viewer review records clipped long scope text. The CSV preserves the full field. This browser guide presents its saved content and does not establish a native-viewer repair or general accessibility acceptance.

6. Save and inspect the five-file bundle

The native viewer’s Export All saved four listed artifacts plus an integrity manifest. The writing review checks all five identities and every one of the sixteen CSV data cells against the retained native table.

Saved fileContents and boundary
Branch_Score_Distance.csvParameter/Value columns and all eight rows, with the saved numerical scalar precision.
Branch_Score_Distance.pngThe retained length-comparison and residual figure, not a complete numerical vector export.
Input_and_methods.txtThe application, input fingerprint, selected route, selection notes and completed-run status.
Summary.txtThe selected run’s summary.
artifact_manifest.jsonNames, byte counts and SHA-256 hashes of the four artifacts. Keep the manifest itself as the fifth file.

Keep the original named-tree input separately. Its file-byte hash differs from the application fingerprint. The native bundle contains no original Newick file or demonstrated reloadable app session. File identity and scientific validity are separate checks.

7. Keep total-length and internal-branch ratios separate

Tree Length Ratio is a different method. Its three retained positive, finite four-taxon API cases do not extend the Branch Score native workflow above. They supplied named trees directly, selected only tree_length_ratio, and produced the saved summaries below. No Load dialog, native viewer, figure or export was exercised for these cases.

The total ratio divides the first tree’s total explicit branch length by the second tree’s total. The mean branch ratio instead averages ratios for the union of internal taxon splits. Terminal lengths contribute to the totals but do not become internal-split coordinates. These are dimensionless ratios only when the input lengths use compatible units and scales; the checks do not establish biological units or comparable evolutionary models.

The labels NJ Total and UPGMA Total are retained application field names. In these supplied-tree cases they identify the first and second input trees; they do not establish that either inference algorithm was run. Keep the named inputs and their order.

Case A: degree-three first tree, degree-two second tree

First: Degree3Root. Second: Degree2Root. The two lines retain that order.

(A:1,B:1,(C:1,D:1):2);
((A:1,B:1):0.5,(C:1,D:1):1.5);
Saved fieldSaved value
NJ Total6.000000
UPGMA Total6.000000
Ratio1.0000
Mean Branch Ratio1.0000
RefFelsenstein, Inferring Phylogenies 2004

Case B: degree-two first tree with reversed children

First: RootedFirst. Second: UnrootedSecond. The two lines retain that order.

((C:1,D:1):1.5,(A:1,B:1):0.5);
(A:1,B:1,(C:1,D:1):2);
Saved fieldSaved value
NJ Total6.000000
UPGMA Total6.000000
Ratio1.0000
Mean Branch Ratio1.0000
RefFelsenstein, Inferring Phylogenies 2004

Case C: different internal lengths

First: Unrooted2. Second: Unrooted4. The two lines retain that order.

(A:1,B:1,(C:1,D:1):2);
(A:1,B:1,(C:1,D:1):4);
Saved fieldSaved value
NJ Total6.000000
UPGMA Total8.000000
Ratio0.7500
Mean Branch Ratio0.5000
RefFelsenstein, Inferring Phylogenies 2004

All five fields are shown for each case. Totals are saved as strings with six decimal places, and both ratio fields as strings with four decimal places. These are the exact saved summary strings, not raw floating-point exports. The evidence download separately retains the observed internal arrays and scalars.

Read the saved internal coordinate

Each case has one internal split, AB|CD. In cases A and B, the two branches incident to the degree-two root have lengths 0.5 and 1.5; the saved internal coordinate combines them to 2.0. Reversing the children in B preserves that coordinate in this retained case.

CaseFirst internal lengthSecond internal lengthInternal ratio
A2.02.01.0
B2.02.01.0
C2.04.00.5

Case C makes the distinction visible: its total-length ratio is 0.7500, while its mean internal-branch ratio is 0.5000. The equal terminal lengths remain in both totals. Do not substitute one ratio for the other, or interpret either as a topology distance, support probability or biological accuracy score.

Keep the separate method’s limits

The reviewed ratio source sums every node marked as having an explicit branch length. It does not apply Branch Score’s root-stem exclusion or its complete finite, nonnegative non-root length guard. None of these three inputs has a root stem or a zero denominator. Missing, zero, nonfinite, negative and extreme lengths remain unvalidated here. The source also floors internal denominators at 1e-10; the saved cases do not exercise that branch, so they cannot establish its suitability for near-zero inputs.

The recorded 84 predicates overlap across three public API calls, not 84 datasets. The receipt explicitly leaves graphics, cumulative-length plots, other statistics, alignment inputs, native GUI and exports unvalidated. The five-file Branch Score bundle above belongs to that separate method; there is no retained Tree Length Ratio export bundle.

The ratio cases ran snapshot eca0d2f7…. A saved-only review at 22:08 UTC on 11 November 2026 compared thirteen selected functions and six shared app dependencies with snapshot 91220f38…. A later review that day confirms the same matches with cf7c7d96…, after a separate four-value Branch Length Correlation export correction was integrated. That change leaves this ratio method and its formatted summaries unchanged. The earlier source review remains dated evidence; no ratio calculation, native Run or export was repeated.

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

← Back to the learning center