Metadata-Version: 2.4
Name: prozor
Version: 0.1.1
Summary: Typed peptide-to-protein matching and parsimonious protein inference
Keywords: proteomics,protein inference,peptide matching,mass spectrometry
Author: Witold Wolski
Author-email: Witold Wolski <wew@fgcz.ethz.ch>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Typing :: Typed
Requires-Dist: ahocorapy>=1.6,<2
Requires-Dist: ahocorasick-rs>=1.0,<2
Requires-Python: >=3.12
Project-URL: Homepage, https://github.com/anndata-omics-bridge/prozor
Project-URL: Documentation, https://anndata-omics-bridge.github.io/prozor/
Project-URL: Repository, https://github.com/anndata-omics-bridge/prozor.git
Project-URL: Issues, https://github.com/anndata-omics-bridge/prozor/issues
Description-Content-Type: text/markdown

# Prozor

[![Quality](https://github.com/anndata-omics-bridge/prozor/actions/workflows/quality.yml/badge.svg)](https://github.com/anndata-omics-bridge/prozor/actions/workflows/quality.yml)
[![Documentation](https://github.com/anndata-omics-bridge/prozor/actions/workflows/docs.yml/badge.svg)](https://anndata-omics-bridge.github.io/prozor/)
[![Python](https://img.shields.io/badge/Python-%E2%89%A53.12-3776AB.svg)](https://www.python.org/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://spdx.org/licenses/MIT.html)

Typed peptide-to-protein matching and deterministic greedy-parsimony protein
inference.

This repository is a Python port of the R [`prozor`](https://github.com/protViz/prozor) package.

Prozor offers backend-neutral Aho--Corasick matching over mappings or streaming
protein records, occurrence-level annotations, unique peptide--protein edges,
and deterministic protein inference. The core deliberately does not
parse FASTA files or depend on pandas, AnnData, MuData, MuLink, workflow engines,
or consumer CLIs.

**[Documentation](https://anndata-omics-bridge.github.io/prozor/)** ·
**[Getting started](https://anndata-omics-bridge.github.io/prozor/getting-started/)** ·
**[API reference](https://anndata-omics-bridge.github.io/prozor/api/)**

Documentation: <https://anndata-omics-bridge.github.io/prozor/>

## Installation

```bash
python -m pip install prozor
```

Both matching implementations are installed. The public matching operations
default to `backend="auto"`, which selects `ahocorasick_rs`. The portable
`ahocorapy` implementation remains directly selectable and is the automatic
runtime fallback if Rust cannot be imported. Results record both the requested
and concrete backend.

## Quick start

```python
from dataclasses import dataclass

from prozor.api import annotate_peptides_streaming, greedy_parsimony


@dataclass(frozen=True, slots=True)
class Protein:
    id: str
    sequence: str


matches = annotate_peptides_streaming(
    ["PEPTIDE", "SEQUENCE"],
    [
        Protein("P1", "MYPEPTIDESEQUENCE"),
        Protein("P2", "XXSEQUENCEXX"),
    ],
)

for match in matches:
    print(match.peptide, match.protein_id, match.start, match.end)

edges = {(match.peptide, match.protein_id) for match in matches}
protein_groups = greedy_parsimony(edges)
print(protein_groups.to_dict())
```

Matches include nested, overlapping, and repeated sites using half-open
coordinates. Prozor matches the exact strings supplied by the consumer; FASTA
header interpretation, normalization, decoy classification, and persistence
remain application policy.

## Development

```bash
uv sync --group dev --group docs
.venv/bin/pre-commit install --hook-type pre-commit --hook-type pre-push
make check
```

`make check` runs Ruff, strict Pyright, dependency validation, branch-coverage
tests, a strict documentation build, and wheel/sdist validation. All Python
commands run from the synchronized project `.venv`.

## Provenance and license

This implementation ports the algorithmic behavior of the R [`prozor`](https://github.com/protViz/prozor) package and consolidates the matching and inference core for Python consumers such as APB and `diann_runner`.

The Python distribution is an independent implementation of that algorithm
rather than a translation of the R source, and it is licensed under MIT. The R
reference package remains GPL-3, and its license does not extend here: the
copyright holder of both packages is the same author, and algorithms are not
themselves subject to copyright.

MIT keeps the whole anndata-omics-bridge spine under one permissive license, so
that consumers such as APB can be redistributed without inheriting copyleft
obligations from this package.
