Skip to main content

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 Documentation Status PyPI version DOI 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: Includes a py.typed marker for static type checking
  • Caching: serialization and parsing results are cached for performance (when applicable)
  • Peptacular: Optionally integrated with peptacular to enable parsing of included sequences and generation of mzPAF annotations

Installation

pip install paftacular
pip install paftacular[peptacular] # with peptacular integration
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)  # y
print(ann.ion_type.position)  # 5

# Calculate masses
print(ann.mass())              # Monoisotopic mass by default
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.

Citation

If you use paftacular in research, cite the archived software release. Machine-readable citation metadata is available in CITATION.cff; GitHub's Cite this repository menu can render it as APA or BibTeX. The stable DOI for all versions is 10.5281/zenodo.19076277; individual releases also receive version-specific DOIs from Zenodo.

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

paftacular is distributed under the MIT License. The bundled mzPAF specification remains under its own PSI copyright and distribution terms; see third-party notices.

Contributing

See CONTRIBUTING.md for development setup, issue reporting, support, and pull-request guidance. Project governance is described in GOVERNANCE.md, and security reports are handled according to SECURITY.md.

Author: Patrick Garrett (pgarrett@scripps.edu)

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.1.1.tar.gz (573.1 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.1.1-py3-none-any.whl (28.1 kB view details)

Uploaded Python 3

File details

Details for the file paftacular-1.1.1.tar.gz.

File metadata

  • Download URL: paftacular-1.1.1.tar.gz
  • Upload date:
  • Size: 573.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for paftacular-1.1.1.tar.gz
Algorithm Hash digest
SHA256 a36e22045ba3036e6f45f9e0e1dafdc24f9ced94a2cf2880b88821e34391fce8
MD5 f64586f5bf29833955679739c2d01213
BLAKE2b-256 eae69def22f87c21539af7e745ce978577f21b0c453126d6bf1ca6e6a4a91e60

See more details on using hashes here.

File details

Details for the file paftacular-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: paftacular-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 28.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for paftacular-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f746836ccc2fbae029a71241f3be102360f10c24422e826bedd1f5b841b8dfb9
MD5 ac9d8a78755c0b1f6015eede79d66fe3
BLAKE2b-256 a932a7442a2db4470e0e01943129101fd701ea9a753e3f263fb405ae1bc1592b

See more details on using hashes here.

Release history Release notifications | RSS feed

1.3.0

2 files

1.2.0

2 files

This release

1.1.1 This release

2 files

1.1.0

2 files

1.0.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page