Skip to content

Preserve undefined edge lengths in consensus trees - #260

Open
antonsoo wants to merge 2 commits into
jeetsukumaran:mainfrom
antonsoo:fix/consensus-missing-lengths
Open

antonsoo wants to merge 2 commits into
jeetsukumaran:mainfrom
antonsoo:fix/consensus-missing-lengths

Conversation

@antonsoo

@antonsoo antonsoo commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

This change was prepared and tested by an AI coding agent under standing instructions. Anthony has not reviewed the code line by line.

TreeSummarizer.tree_from_splits raises TypeError when ordinary input trees omit their optional root lengths. SplitDistribution records those lengths as None, and both mean-calculation loops try to subtract them.

Keep a consensus edge undefined when any sampled length is missing, matching the existing split-summary behavior, while retaining means for complete numeric samples. Apply the same guard to both loops. As requested in review, use None not in edges and emit one standard UserWarning per call when a returned consensus edge has missing length samples. Fully defined samples, support-only construction and excluded splits do not warn. Add regressions for omitted/mixed lengths, defined zero/negative lengths, single observations, input non-mutation and support-only construction.

Validation after review: all 14 consensus tests pass on Python 3.8 and 3.12; all 164 smoke tests and lint.sh pass. The full unit run has 989 passes and four PAUP execution failures (PermissionError), all four reproduced on unchanged main. On the bundled pythonidae and cetacean posterior datasets, 18 formerly failing summary/export workflows now work per profile, including full-dataset cases; all 36 complete controls remain exact. Exported topology, internal support labels and defined lengths round-trip, and 1,008 continued tip-distance calculations agree with independent parent-path sums. The original installed wheel reproduced all 54 complete reports. The review revision reproduces those exact outputs from source and emits exactly 18 missing-length warnings across the 54 calls.

@codecov-commenter

codecov-commenter commented Oct 26, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.64%. Comparing base (75ab706) to head (b366bd9).
⚠️ Report is 1 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #260      +/-   ##
==========================================
+ Coverage   89.16%   89.64%   +0.47%     
==========================================
  Files         116      116              
  Lines       13406    13438      +32     
==========================================
+ Hits        11954    12046      +92     
+ Misses       1452     1392      -60     
Flag Coverage Δ
unittests 89.64% <100.00%> (+0.47%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mmore500 mmore500 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes requested thanks @antonsoo

Comment thread src/dendropy/calculate/treesum.py Resolved
Comment thread src/dendropy/calculate/treesum.py Resolved

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants