Skip to main content

mzpaf parser

Project description

paftacular

Paftacular Logo

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.

Python package codecov PyPI version Python 3.12+ License: MIT

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 single PafAnnotation or a list of them.
  • parse_multi: Parses multiple comma-separated mzPAF annotations. Always returns a list of PafAnnotation.
  • parse_single: Parses a single mzPAF annotation. Returns a single PafAnnotation. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

paftacular-1.0.0.tar.gz (543.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

paftacular-1.0.0-py3-none-any.whl (24.5 kB view details)

Uploaded Python 3

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

Hashes for paftacular-1.0.0.tar.gz
Algorithm Hash digest
SHA256 42239ece2acd565217c07665507fb4f54a552975511ea0ca2654d22493b48360
MD5 ec0d90782587cea7ffd065c09a762f61
BLAKE2b-256 96c97a92135cb259a1fd428465e63f28f1b867603257a60af0010fb2d7af16cb

See more details on using hashes here.

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

Hashes for paftacular-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a9927fe35ebc821cdc29ae8372b6682012e03c128c330480081bd860805323de
MD5 135717f86b89381d77718910b6b0b0ad
BLAKE2b-256 4a3088ed92f46f470bba7101af8e4ecba7903869d8280acb87dfb5573a21ef89

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page