feat: sync MA python with Rust#118
Merged
Merged
Conversation
The core rewrite in #107 changed the API out from under the pyo3 wrapper. Qualities are a SmallVec now and names an Arc<str>, from_tags/to_tags lost the old AL slot, and add_annotations takes an Encoding (always Ma from python). Also give the crate its own empty [workspace] table so maturin stops walking up to the root Cargo.toml when it builds.
The MM/ML parse/emit code was stuck behind the htslib feature because it read straight off a bam::Record. Move the actual algorithm behind a new mmml feature that works on plain slices (the MM string, ML bytes, and forward sequence); from_record just grabs those off the record now and hands them over. pyMA turns on mmml and exposes parse_mm_ml/to_mm_ml, and pysam_utils.from_record reads the tags and reverse-complements the sequence for reverse reads. The algorithm didn't change, so the existing htslib tests still pass; new ones cover the record-free path, reverse strand, and a byte-identical round trip.
Reads fibertools-rs all.bam through pysam and from_record and checks the known nuc/msp/m6a/5mC counts on the first read, that base mods land in range with reference coords, and that writing back out round-trips the MA tag while leaving MM/ML untouched. Also covers adding an annotation to a parsed record and writing it. Skips when the bam isn't there (outside the repo).
Builds the molecular-annotation Python wheels + sdist with maturin and publishes to PyPI via OIDC trusted publishing (no API token) on molecular-annotation-py-v* tags.
Merged
cademirch
pushed a commit
that referenced
this pull request
Jul 21, 2026
## 🤖 New release * `molecular-annotation`: 0.0.1 -> 0.0.2 (✓ API compatible changes) * `fibertools-rs`: 0.11.0 -> 0.12.0 (✓ API compatible changes) <details><summary><i><b>Changelog</b></i></summary><p> ## `molecular-annotation` <blockquote> ## [0.0.2](molecular-annotation-v0.0.1...molecular-annotation-v0.0.2) - 2026-07-21 ### Added - sync MA python with Rust ([#118](#118)) </blockquote> ## `fibertools-rs` <blockquote> ## [0.12.0](v0.11.0...v0.12.0) - 2026-07-21 ### Added - sync MA python with Rust ([#118](#118)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
This PR gets the Python MA library up to date with the Rust crate.