Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the build newick functionality by exposing new edges‐processing functions and integrating them into both the Rust and Python APIs. Key changes include:
- Adding new functions get_edges and from_edges in the Rust library and exposing them via Python bindings.
- Introducing a new module in Python for converting between Phylo2Vec vectors and edge lists.
- Updating TreeVec with a new get_edges method and improving tests and benchmarks for stability.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| py-phylo2vec/src/lib.rs | Added get_edges and from_edges functions wrapping ops calls. |
| py-phylo2vec/phylo2vec/base/edges.py | New module to convert vectors to edge lists and vice versa. |
| py-phylo2vec/phylo2vec/init.py | Exported the new edges conversion functions. |
| phylo2vec/src/tree_vec/ops/vector.rs | Added get_edges_from_pairs, get_edges, and from_edges implementations. |
| phylo2vec/src/tree_vec/mod.rs | TreeVec now supports get_edges with accompanying tests. |
| phylo2vec/src/profile_main.rs | Updated to use a fixed vector for improved stability in main(). |
| phylo2vec/benches/benchmarks/core.rs | Minor updates to benchmark comments for newick generation. |
|
|
||
| pub fn from_edges(edges: &[(usize, usize)]) -> Vec<usize> { | ||
| let mut ancestry: Ancestry = Vec::with_capacity(edges.len() / 2); | ||
|
|
There was a problem hiding this comment.
Clarify in a comment that the implementation of from_edges assumes adjacent pairs of edges belong together to form an ancestry triplet. This helps maintainers understand the invariant behind the pairing logic.
Suggested change
| // The implementation assumes that every two consecutive edges in the input array | |
| // belong together to form an ancestry triplet. Specifically, edges[i] and edges[i + 1] | |
| // represent the two child nodes, and edges[i].1 represents their common parent. |
| DEFAULT_N_LEAVES | ||
| }; | ||
| let v = sample_vector(n_leaves, true); | ||
| // Fore more stability, we use a fixed vector |
There was a problem hiding this comment.
Correct the comment typo from 'Fore more stability' to 'For more stability' for clarity.
Suggested change
| // Fore more stability, we use a fixed vector | |
| // For more stability, we use a fixed vector |
Collaborator
Author
|
Superseded by #27 |
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.
No description provided.