Skip to content

feat(r): add matrix support for get_common_ancestor#172

Merged
Neclow merged 2 commits intosbhattlab:mainfrom
Neclow:feat/get_common_ancestor_matrix
Jan 16, 2026
Merged

feat(r): add matrix support for get_common_ancestor#172
Neclow merged 2 commits intosbhattlab:mainfrom
Neclow:feat/get_common_ancestor_matrix

Conversation

@Neclow
Copy link
Collaborator

@Neclow Neclow commented Jan 16, 2026

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

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>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_ancestor wrapper function in R that handles both integer vectors and matrices
  • Renamed the underlying extendr function from get_common_ancestor to get_common_ancestor_from_vector for 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.

@Neclow Neclow merged commit 4842a24 into sbhattlab:main Jan 16, 2026
8 checks passed
@Neclow Neclow deleted the feat/get_common_ancestor_matrix branch January 16, 2026 11:29
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.

feat: get common ancestor for matrices

2 participants