Skip to content

feat(rs,py,r): add get_node_depth and get_node_depths functions#171

Merged
Neclow merged 4 commits intosbhattlab:mainfrom
Neclow:feat/node_depth
Jan 16, 2026
Merged

feat(rs,py,r): add get_node_depth and get_node_depths functions#171
Neclow merged 4 commits intosbhattlab:mainfrom
Neclow:feat/node_depth

Conversation

@Neclow
Copy link
Collaborator

@Neclow Neclow commented Jan 16, 2026

Add functions to compute node depth (distance from root) following the BEAST/ETE convention where root has depth 0 and depths increase toward leaves.

  • get_node_depth: returns depth of a single node
  • get_node_depths: returns depths of all nodes as a vector

For vectors, topological depth is used (all branch lengths = 1). For matrices, actual branch lengths are used.

Includes tests comparing with ape's node.depth.edgelength in R.

(My first experience with @claude)

Neclow and others added 4 commits January 16, 2026 10:47
Add functions to compute node depth (distance from root) following the
BEAST/ETE convention where root has depth 0 and depths increase toward
leaves.

- get_node_depth: returns depth of a single node
- get_node_depths: returns depths of all nodes as a vector

For vectors, topological depth is used (all branch lengths = 1).
For matrices, actual branch lengths are used.

Includes tests comparing with ape's node.depth.edgelength in R.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Neclow Neclow merged commit f9dbcb6 into sbhattlab:main Jan 16, 2026
8 checks passed
@Neclow Neclow deleted the feat/node_depth branch January 16, 2026 10:55
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.

1 participant