feat(r): add matrix support for get_common_ancestor#172
Merged
Neclow merged 2 commits intosbhattlab:mainfrom Jan 16, 2026
Merged
feat(r): add matrix support for get_common_ancestor#172Neclow merged 2 commits intosbhattlab:mainfrom
Neclow merged 2 commits intosbhattlab:mainfrom
Conversation
Add thin wrapper in R that handles both vectors and matrices for get_common_ancestor. Since MRCA is purely topological, the matrix version simply extracts column 1 (the vector) and calls the underlying function. Also update CLAUDE.md with git workflow guidance about creating new branches for each feature/bugfix. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds matrix support to the R get_common_ancestor function, aligning its API with other dual-mode functions like get_node_depth. Since MRCA computation is purely topological, the matrix version extracts column 1 (the vector component) and delegates to the underlying Rust function. The PR also adds git workflow guidance to CLAUDE.md.
Changes:
- Added
get_common_ancestorwrapper function in R that handles both integer vectors and matrices - Renamed the underlying extendr function from
get_common_ancestortoget_common_ancestor_from_vectorfor consistency - Updated tests to verify both vector and matrix inputs produce identical results
- Added CLAUDE.md documentation file with project overview, commands, architecture, and git workflow guidance
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| r-phylo2vec/R/stats.R | Added new get_common_ancestor wrapper function that dispatches to vector-specific implementation based on input type |
| r-phylo2vec/R/extendr-wrappers.R | Renamed get_common_ancestor to get_common_ancestor_from_vector and removed its export |
| r-phylo2vec/man/get_common_ancestor.Rd | Updated documentation to reflect new API and clarify topological nature of MRCA |
| r-phylo2vec/tests/testthat/test_utils.R | Enhanced tests to verify matrix support and equality with vector results |
| CLAUDE.md | New comprehensive documentation for Claude Code AI assistant |
💡 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.
Add thin wrapper in R that handles both vectors and matrices for get_common_ancestor. Since MRCA is purely topological, the matrix version simply extracts column 1 (the vector) and calls the underlying function.
Also update CLAUDE.md with git workflow guidance about creating new branches for each feature/bugfix.
Closes #169