Merged
Conversation
Collaborator
Neclow
commented
Feb 13, 2026
- Expose sackin, leaf_depth_variance, and b2 balance index functions in the R package via extendr bindings
- Add tests: manual values from Rust test suite + comparisons against treestats package
- Document treestats CRAN install step in development guide (not on conda-forge)
Contributor
There was a problem hiding this comment.
Pull request overview
This PR exposes three tree balance index functions (sackin, leaf_depth_variance, and b2) from the Rust phylo2vec library to the R package through extendr bindings. These indices are statistical measures used to characterize tree topology shape and balance, with sackin and leaf_depth_variance measuring imbalance (higher = more imbalanced) and b2 measuring balance (higher = more balanced).
Changes:
- Added R bindings for sackin, leaf_depth_variance, and b2 balance indices
- Comprehensive test coverage with manual test cases from Rust suite and cross-validation against treestats package
- Documentation update to development guide about installing treestats from CRAN
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| r-phylo2vec/src/rust/src/lib.rs | Added extendr wrapper functions and exports for the three balance indices (sackin, leaf_depth_variance, b2) |
| r-phylo2vec/R/extendr-wrappers.R | Added R function wrappers with roxygen2 documentation for the three balance indices; added default parameter for cophenetic_distances |
| r-phylo2vec/tests/testthat/test_stats.R | Added comprehensive tests including manual test cases with known values and comparison tests against treestats package |
| r-phylo2vec/man/sackin.Rd | Generated documentation for sackin function |
| r-phylo2vec/man/leaf_depth_variance.Rd | Generated documentation for leaf_depth_variance function |
| r-phylo2vec/man/b2.Rd | Generated documentation for b2 function |
| r-phylo2vec/man/get_common_ancestor.Rd | Updated parameter documentation (removed duplicate vector param, fixed tree param) |
| r-phylo2vec/man/cophenetic_distances.Rd | Cleaned up duplicate documentation and standardized parameter descriptions |
| r-phylo2vec/R/stats.R | Removed duplicate cophenetic_distances function definition |
| r-phylo2vec/NAMESPACE | Added exports for the three new balance index functions |
| docs/development.md | Documented manual installation of treestats package from CRAN for R testing |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.