API reference¶
Public objects are documented from their typed source and Google-style docstrings.
Aho--Corasick matching¶
prozor.matching.automaton
¶
Backend-neutral Aho--Corasick peptide matching.
Match
dataclass
¶
AhoCorasickBase
¶
Bases: ABC
Common interface implemented by every matching backend.
Source code in src/prozor/matching/automaton.py
AhoCorasickPure
¶
Bases: AhoCorasickBase
Portable matcher implemented with :mod:ahocorapy.
Source code in src/prozor/matching/automaton.py
find_all
¶
Yield all pure-Python matches in text.
AhoCorasickRust
¶
Bases: AhoCorasickBase
Accelerated matcher implemented with :mod:ahocorasick_rs.
Source code in src/prozor/matching/automaton.py
find_all
¶
Yield all Rust matches in text.
Source code in src/prozor/matching/automaton.py
create_automaton
¶
Create a matcher and expose both requested and resolved backend names.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keywords
|
Iterable[str]
|
Peptide patterns to search for. |
required |
backend
|
str
|
|
'auto'
|
case_sensitive
|
bool
|
Whether matching distinguishes letter case. |
True
|
Returns:
| Type | Description |
|---|---|
AhoCorasickBase
|
A backend-neutral matcher. |
Raises:
| Type | Description |
|---|---|
ImportError
|
The Rust backend was requested but is not installed. |
ValueError
|
|
Source code in src/prozor/matching/automaton.py
resolve_backend
¶
Resolve a requested backend to the concrete implementation name.
Source code in src/prozor/matching/automaton.py
get_available_backends
¶
Return the concrete matching backends available in this environment.
Source code in src/prozor/matching/automaton.py
Peptide annotation¶
prozor.matching.annotation
¶
Peptide-to-protein annotation over mappings or streaming protein records.
ProteinSequenceRecord
¶
Bases: Protocol
Smallest protein-record capability required by peptide matching.
Source code in src/prozor/matching/annotation.py
PeptideAnnotation
dataclass
¶
One peptide occurrence in a protein sequence.
Source code in src/prozor/matching/annotation.py
AnnotationResult
dataclass
¶
Collection of peptide matches and matching-backend provenance.
Source code in src/prozor/matching/annotation.py
filter_tryptic
¶
Return matches with a supported tryptic N-terminal context.
Source code in src/prozor/matching/annotation.py
annotate_peptides
¶
Annotate peptides against an in-memory protein mapping.
Source code in src/prozor/matching/annotation.py
annotate_peptides_streaming
¶
Annotate peptides against one-pass records exposing id and sequence.
Source code in src/prozor/matching/annotation.py
Tie resolution¶
prozor.inference.ties
¶
Tie candidates and resolution for greedy protein inference.
TieCandidate
dataclass
¶
One indistinguishable protein group competing in a consequential tie.
Source code in src/prozor/inference/ties.py
resolve_current_tie
¶
Preserve Prozor's deterministic group-size and accession tie rule.
Source code in src/prozor/inference/ties.py
Greedy protein inference¶
prozor.inference.greedy
¶
Deterministic greedy-parsimony protein inference over unique edges.
ProteinGroup
dataclass
¶
Proteins selected together and the peptides assigned to them.
Source code in src/prozor/inference/greedy.py
GreedyResult
dataclass
¶
Protein groups selected by greedy parsimony.
Source code in src/prozor/inference/greedy.py
greedy_parsimony
¶
greedy_parsimony(
edges, resolve_tie=resolve_current_tie, subsume=True
)
Select a deterministic parsimonious set of protein groups.
Repeated (peptide, protein) edges collapse before inference. Proteins
with identical remaining peptide evidence are grouped. Disjoint equal
candidates are ordered deterministically, while overlapping non-identical
candidates are passed to resolve_tie.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edges
|
Iterable[PeptideProteinEdge]
|
Peptide and protein identifier pairs. |
required |
resolve_tie
|
TieResolver
|
Operation selecting one consequential tie candidate. |
resolve_current_tie
|
subsume
|
bool
|
Whether proteins supported by a subset of selected evidence remain in the selected group. |
True
|
Returns:
| Type | Description |
|---|---|
GreedyResult
|
Deterministically ordered inferred protein groups. |