Fix Quartet distances with unifurcating roots (#64)#77
Merged
Conversation
Trees with a unifurcating root (e.g. "(((a,b),(c,d)));") caused QuartetDistance and related tqDist functions to abort with "Leaves don't agree", because the tree reader rerooted at the dummy node's only child but passed nullptr as the recursion parent, causing the dummy to be emitted as a spurious extra leaf. Fix: record the original root and pass it as the recursion parent so the dummy node is skipped. Handles arbitrarily-nested unifurcations; a degree-1 internal node induces no quartet/triplet statement, so it's invisible to the algorithms. Fixes #64. Note: TripletDistance was not actually affected in current code, as the CPDT migration (v1.4.0) handles singletons natively. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
The VisualizeQuartets function uses hcl.colors() instead of viridisLite::viridis() (as of commit 00cc031), but the NAMESPACE still had an importFrom directive left over from the previous implementation.
The shared macOS cache was stale, causing build failures. Incrementing the cache-version clears the cached R packages across all platforms.
macOS-latest (Apple Silicon) passes successfully. The macos-15-intel runner appears to have an environment-specific issue that doesn't affect other platforms. Disabling it temporarily to unblock CI while the runner issue is investigated.
…ailures" This reverts commit c5a4161.
The tinytex installation fails on macos-15-intel but not on other platforms. Skipping it conditionally on x86_64 Darwin systems to work around the issue.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #77 +/- ##
=======================================
Coverage 96.13% 96.13%
=======================================
Files 32 32
Lines 2070 2070
=======================================
Hits 1990 1990
Misses 80 80 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Trees with a unifurcating root (e.g.
(((a,b),(c,d)));) causedQuartetDistance,QuartetAgreement, and related tqDist functions to abort with "Leaves don't agree". The bundled tqDist tree reader rerooted at the dummy node's only child but passednullptras the recursion parent, causing the dummy to be emitted as a spurious extra leaf.Fix: Record the original root and pass it as the recursion parent so the dummy node is skipped during tree conversion. This 2-line change in
src/unrooted_tree.h:convertToRootedTree()closes #64.Details
((((a,b),(c,d))))), since a degree-1 internal node induces no quartet or triplet statement and is invisible to the algorithms.tqdist_*/…Char/…Edgewrappers, phylo, edge, and file paths.Test Plan
QuartetDistanceandQuartetAgreementon the exact files from Unifurcating root causesQuartetDistance,TripletDistanceerror #64 now return correct values🤖 Generated with Claude Code