mzpaf parser
Project description
paftacular
A Python library for parsing and serializing mzPAF (Peak Annotation Format), a standardized format for annotating mass spectrometry fragment ions in peptide/proteomics analysis. mzPAF is a specification from the Proteomics Standards Initiative (PSI) that provides a compact, human-readable notation for describing fragment ion types, chemical modifications, charge states, mass errors, and confidence scores.
Features
- mzPAF parsing: Handles parsing / serializing of mzPAF strings
- Properties: Supports calculating mass and composition of annotated ions
- Type-Annotations: typed.py file for static type checking
- Caching: serialization and parsing results are cached for performance (when applicable)
- Peptacular: Integrated with peptacular to enable parsing of included sequences and generation of mzPAF annotations
Installation
pip install paftacular
pip install paftacular[smiles] # with smiles support
pip install paftacular[all] # with all optional dependencies
Quick Start
There are 3 parsing methods available:
parse: Parses a single or multiple comma-separated mzPAF annotations. Returns a singlePafAnnotationor a list of them.parse_multi: Parses multiple comma-separated mzPAF annotations. Always returns a list ofPafAnnotation.parse_single: Parses a single mzPAF annotation. Returns a singlePafAnnotation. Raises ValueError if multiple annotations are provided.
import paftacular as pft
# Parse a simple peptide ion
ann = pft.parse("y5")
print(ann.ion_type.series) # IonSeries.Y
print(ann.ion_type.position) # 5
# Calculate masses
print(ann.monoisotopic_mass) # Calculated mass
print(ann.serialize()) # Round-trip back to string
# Parse multiple ions
anns = pft.parse("y5-H2O^2/1.2ppm*0.95,b3^2")
for ann in anns:
print(ann.charge)
print(ann.mass_error.value)
print(ann.confidence)
Documentation
Full documentation is available at Read the Docs.
mzPAF Format
The mzPAF format uses compact notation:
[&][analyte@]ion_type[modifications][^charge][/mass_error][*confidence]
Examples: y5, b2{PEP}, y5-H2O^2, y5/1.2ppm*0.95
See the PSI mzPAF specification for full details.
License
MIT
Contributing
Contributions welcome! Please submit a Pull Request.
Author: Patrick Garrett (pgarrett@scripps.edu)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file paftacular-1.0.0.tar.gz.
File metadata
- Download URL: paftacular-1.0.0.tar.gz
- Upload date:
- Size: 543.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42239ece2acd565217c07665507fb4f54a552975511ea0ca2654d22493b48360
|
|
| MD5 |
ec0d90782587cea7ffd065c09a762f61
|
|
| BLAKE2b-256 |
96c97a92135cb259a1fd428465e63f28f1b867603257a60af0010fb2d7af16cb
|
File details
Details for the file paftacular-1.0.0-py3-none-any.whl.
File metadata
- Download URL: paftacular-1.0.0-py3-none-any.whl
- Upload date:
- Size: 24.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9927fe35ebc821cdc29ae8372b6682012e03c128c330480081bd860805323de
|
|
| MD5 |
135717f86b89381d77718910b6b0b0ad
|
|
| BLAKE2b-256 |
4a3088ed92f46f470bba7101af8e4ecba7903869d8280acb87dfb5573a21ef89
|