Skip to content

Release/0.5#16

Merged
RalfG merged 56 commits into
mainfrom
release/0.5
Jul 13, 2026
Merged

Release/0.5#16
RalfG merged 56 commits into
mainfrom
release/0.5

Conversation

@ArthurDeclercq

Copy link
Copy Markdown
Contributor

No description provided.

ArthurDeclercq and others added 30 commits December 23, 2025 18:06
Bump pyo3 (0.23 → 0.28), numpy (0.23 → 0.28), and timsrust (0.4.1 →
0.4.2). Migrate to new PyO3 0.28 API: allow_threads → detach, PyObject
→ Py<PyAny>, downcast → cast, and add from_py_object to pyclass attrs.
Apply rustfmt formatting throughout.
additional support for ms2rescore refactoring
Group files by responsibility: types/ for Python-facing data structures,
io/ for file parsing and format dispatch, scoring/ for feature computation,
ms2pip/ for future ms2pip-specific functionality. No logic changes.
Peak-centric annotation types that mirror rustyms output using only
plain Rust/Python types. AnnotatedMS2Spectrum carries the original
spectrum data alongside per-peak fragment annotations.
Extract annotation logic into standalone pyfunction that produces
AnnotatedMS2Spectrum output. Supports all 6 ion series (a/b/c/x/y/z)
and exposes tolerance_value + tolerance_mode parameters.
…ctra

Replace monolithic function with score_ms2_spectra() that consumes
AnnotatedMS2Spectrum. Fixed feature set for all 6 ion series with NaN
for inactive series. Extract shared math helpers to utils.rs.
Add 16 Python tests for annotate_ms2_spectra and score_ms2_spectra,
plus Rust unit tests in utils.rs. Fix empty spectrum panic, type
mismatches, clippy warnings, and PyO3 deprecation warnings.
…iciency

- Remove duplicate f32/f64 arrays in OwnedSpec, convert inline
- Cache parsed peptides to avoid double-parsing
- Extract empty_annotated helper for repeated return blocks
- Replace per-series HashMaps with fixed [_; 6] arrays
- Pre-compute feature name strings outside parallel loop
- Keep intensity accumulation in f32, cast to f64 at output boundary
- Use byte parsing in parse_ion_series_and_index to avoid heap allocs
- Fix stale comment in spectrum_prediction.rs, powf -> exp2
score_ms2_spectra now takes explicit active_ion_series so the caller
specifies which series the fragmentation model produces, rather than
inferring from matched annotations.
Separate annotation from scoring and restructure codebase
Compute 139 features per cleavage site matching the C code layout:
peptide-level properties, charge one-hot, AA counts, positional
properties, and quartile statistics. Takes ProForma strings directly
with charge suffix. Parsing and computation fully parallelized.
Includes 7 Rust unit tests.
Compute theoretical fragment m/z using rustyms, consistent with
annotate_ms2_spectra. Extract parse_ion_series_and_index and
extract_charge into utils.rs, used by annotation, feature_vectors,
and theoretical_mz modules.
Replace to_string()-based fragment parsing with direct FragmentType enum
matching in parse_fragment(). Replace char-based AA lookup with AminoAcid
enum matching in aa_to_ms2pip_index(). Consolidate shared helpers in utils.
Fix c-ion boundary off-by-one (c_length = peplen-i, not peplen-i-1),
positional features using C's 1-indexed peptide_buf convention, quartile
denominators matching C's per-context formulas, and incremental AA count
tracking. Document intentional C code bugs replicated for XGBoost model
compatibility. Add exact C reference test for ACDE/2.
RalfG and others added 26 commits April 13, 2026 21:29
Add ms2pip feature vector and theoretical m/z computation
Update CI and dependencies
Handle spectra where the precursor exists but has no selected ions
(e.g. missing PEPMASS in MGF, incomplete mzML). Default to mz=0.0
and intensity=0.0, consistent with missing precursor handling.
Fix panic on precursors with empty ions list, bump to 0.5.0-alpha.2
Switch from cross-compiling on windows-latest to building natively on
windows-11-arm, which has the correct Python libs available. This
simplifies the workflow by removing the need for per-target args.
Merge the separate linux, windows, and macos jobs into one build job
with a matrix strategy. All entries still run in parallel.
Move theoretical fragment generation into py.detach() and use
rayon par_iter over unique peptide+charge keys, so both cache
building and spectrum annotation run outside the GIL in parallel.
Convert the f64 results to f32 numpy arrays before returning to
Python, eliminating the need for np.array() wrapping on the caller side.
Derive sequence length internally by parsing the proforma string,
which the function already does later for fragment generation.
Extract per-ion-type observed intensity arrays from annotated spectra.
Derives sequence length from annotation positions, fills unmatched
positions with log2(0.001), takes max when multiple peaks match.
- Fix targets: use explicit seq_lens parameter instead of fragile max-position
  derivation; use HashSet for ion_types lookup; filter out-of-bounds in GIL phase
- Fix annotation: eliminate double proforma parsing by deriving seq_len from
  cache entry in parallel block; restructure CacheEntry as named struct
- Fix theoretical_mz: update docstring to reflect numpy return type
annotate_ms2_spectra now skips rustyms spectrum materialization and builds peak annotations directly from cached fragment metadata, reducing native overhead in the correlate workflow. ms2pip_compute_theoretical_mz now pre-parses requested ion types, fills f32 output buffers directly, and reuses shared theoretical-fragment generation helpers.

Also adds shared fragment/mz-search utilities and tests in utils.rs, and includes the current uv.lock regeneration.`
Speed up annotation and theoretical m/z calculation for MS²PIP
Set up MSVC environment with ilammy/msvc-dev-cmd and set
CMAKE_GENERATOR=Ninja to bypass cmake's unsupported VS 18.0
version detection in the libz-sys build script.
Pre-release fixes, version bump, CHANGELOG, and README for 0.5.0-beta.1
@ArthurDeclercq
ArthurDeclercq requested a review from RalfG July 13, 2026 13:06
@RalfG
RalfG merged commit 2e940b4 into main Jul 13, 2026
4 checks passed
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