Metadata-Version: 2.4
Name: ms2rescore-rs
Version: 0.5.0
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Dist: numpy>=1.20
Requires-Dist: pytest ; extra == 'test'
Provides-Extra: test
License-File: LICENSE
Summary: ms2rescore rust package
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# ms2rescore-rs

Rust core for [MS²Rescore](https://github.com/compomics/ms2rescore) and
[MS²PIP](https://github.com/compomics/ms2pip), exposed as a Python package via PyO3.

Provides fast, parallelized implementations of spectrum reading, fragment ion annotation, MS2PIP feature extraction, and MS2 scoring features used during PSM rescoring.

## Installation

```sh
pip install ms2rescore-rs
```

## Functions

| Function | Description |
|---|---|
| `get_precursor_info(path)` | Read precursor metadata from mzML, MGF, or Bruker raw files |
| `get_ms2_spectra(path)` | Read MS2 spectra from mzML, MGF, or Bruker raw files |
| `annotate_ms2_spectra(spectra, proformas, ...)` | Match observed peaks to theoretical fragment ions |
| `score_ms2_spectra(spectra, seq_lens, ...)` | Compute per-series matched-ion scoring features |
| `ms2pip_compute_features(proformas, ...)` | Compute 139 MS2PIP XGBoost feature vectors per cleavage site |
| `ms2pip_compute_theoretical_mz(proformas, ...)` | Compute theoretical fragment m/z arrays |
| `ms2pip_extract_targets(spectra, intensities, ...)` | Extract observed intensity targets for model training |

Supported input formats: mzML, mzMLb, MGF, Thermo RAW, Bruker TDF/TIMS.

ProForma 2.0 notation is used throughout for peptide sequences and modifications.

## Built on

- [mzcore (formerly rustyms)](https://github.com/rusteomics/mzcore) — ProForma parsing, theoretical fragment generation, and mass calculations
- [mzdata](https://github.com/mobiusklein/mzdata) — mzML, mzMLb, MGF, and Thermo RAW file reading
- [timsrust](https://github.com/MannLabs/timsrust) — Bruker TDF/TIMS file reading

## Development

Requires Rust and [maturin](https://github.com/PyO3/maturin).

```sh
uv run maturin develop
```

