Skip to content

refactor: move label_mapping functions to rust and make them more robust#44

Merged
Neclow merged 2 commits intosbhattlab:mainfrom
Neclow:improve_label_mapping
May 23, 2025
Merged

refactor: move label_mapping functions to rust and make them more robust#44
Neclow merged 2 commits intosbhattlab:mainfrom
Neclow:improve_label_mapping

Conversation

@Neclow
Copy link
Collaborator

@Neclow Neclow commented May 23, 2025

Changes:

  • Move python functions create_label_mapping and apply_label_mapping to rust.
  • Make apply_label_mapping more robust (not a naive string replace)
  • Add unit tests in Rust for those functions

@Neclow Neclow requested a review from Copilot May 23, 2025 12:44
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 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

@Neclow Neclow merged commit a09caf4 into sbhattlab:main May 23, 2025
7 checks passed
@Neclow Neclow deleted the improve_label_mapping branch May 23, 2025 13:19
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.

2 participants