refactor: move label_mapping functions to rust and make them more robust#44
Merged
Neclow merged 2 commits intosbhattlab:mainfrom May 23, 2025
Merged
refactor: move label_mapping functions to rust and make them more robust#44Neclow merged 2 commits intosbhattlab:mainfrom
Neclow merged 2 commits intosbhattlab:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the label mapping functionality by moving the corresponding functions from Python to Rust and improving robustness in label replacement. Key changes include:
- Implementing create_label_mapping and apply_label_mapping in Rust.
- Adjusting the Python bindings to use the new Rust functions.
- Adding Rust unit tests and updating the Cargo.toml version.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| py-phylo2vec/src/lib.rs | Added Python bindings for the new Rust label mapping |
| py-phylo2vec/phylo2vec/utils/newick.py | Updated functions to leverage Rust implementations |
| phylo2vec/src/tree_vec/ops/newick/mod.rs | Refactored and extended label mapping logic in Rust |
| phylo2vec/Cargo.toml | Updated package version |
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.
Changes:
create_label_mappingandapply_label_mappingto rust.apply_label_mappingmore robust (not a naive string replace)