Skip to content

feat: sync MA python with Rust#118

Merged
cademirch merged 5 commits into
mainfrom
sync-ma-python-rust
Jul 21, 2026
Merged

feat: sync MA python with Rust#118
cademirch merged 5 commits into
mainfrom
sync-ma-python-rust

Conversation

@cademirch

Copy link
Copy Markdown
Contributor

This PR gets the Python MA library up to date with the Rust crate.

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.
@cademirch
cademirch merged commit 01ad8d8 into main Jul 21, 2026
8 of 9 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 21, 2026
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>
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