Skip to main content

spxtacular logo

CI PyPI Python versions Docs License

spxtacular

spxtacular is a Python library for mass spectrometry spectrum processing. It provides a chainable Spectrum API covering the full centroid-to-neutral-mass pipeline: denoising, isotope deconvolution, neutral mass conversion, fragment matching, and PSM scoring — with interactive Plotly visualizations throughout.

Part of the tacular-omics ecosystem alongside peptacular, paftacular, and mzmlpy.

Install

pip install spxtacular

# Optional: Numba JIT acceleration (~3–4× faster deconvolution)
pip install spxtacular[numba]

# Optional: share spectra as compact URL-safe tokens (spectrl)
pip install spxtacular[spectrl]

# Optional: raw-file readers — Bruker .d (bruker) and/or mzML (mzml)
pip install spxtacular[bruker]      # tdfpy — DReader
pip install spxtacular[mzml]        # mzmlpy — MzmlReader
pip install spxtacular[readers]     # both readers

# Everything (numba + both readers + spectrl)
pip install spxtacular[all]

Quick start

import spxtacular as spx

spec = spx.Spectrum(mz=mz_array, intensity=intensity_array)

# Full pipeline: denoise → deconvolute → filter → neutral mass
neutral = (
    spec
    .denoise(method="mad")
    .deconvolute(charge_range=(1, 5), tolerance=10, tolerance_type="ppm", min_score=0.4)
    .decharge()
)

neutral.plot(title="Neutral masses").show()

Features

Feature Description
Isotope deconvolution Bhattacharyya-scored greedy algorithm; optional Numba JIT acceleration
Quality filtering min_score, m/z, intensity, charge, and ion mobility filters
Neutral mass conversion decharge() converts charged clusters to neutral masses
Fragment matching match_fragments() with ppm/Da tolerance
PSM scoring Hyperscore, spectral angle, matched fraction, and more
Interactive visualization Stick plots, mirror plots, annotated fragment spectra (Plotly)
File reading Bruker timsTOF .d files (DReader) and mzML (MzmlReader)
Spectrum sharing Encode a full spectrum to a compact, URL-safe spectrl token or link (to_spectrl_token / to_spectrl_url)

Deconvolution pipeline

# 1. Find isotope clusters → assign monoisotopic m/z + charge + Bhattacharyya score
decon = spec.deconvolute(charge_range=(1, 5), tolerance=10, tolerance_type="ppm")

# charge > 0  → assigned cluster
# charge = -1 → singleton / unassigned
# score 0–1   → isotope profile quality (0.0 for singletons)

# 2. Keep only high-confidence clusters
filtered = decon.filter(min_score=0.5)

# 3. Convert to neutral masses (drops singletons)
neutral = filtered.decharge()

Sharing spectra

With the optional [spectrl] extra, encode a complete spectrum (peaks, charges, ion mobility, and MSn metadata) into a single compact, URL-safe token — or a ready-to-share link — with no backend required.

token = spec.to_spectrl_token()                       # spectrl1.… token
restored = spx.Spectrum.from_spectrl_token(token)

url = spec.to_spectrl_url("https://example.com/view")  # …#spectrl1.… (shareable)
restored = spx.Spectrum.from_spectrl_url(url)

Documentation

Full documentation with API reference, guides, and interactive plots is available at tacular-omics.github.io/spxtacular.

License

MIT

Download files

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

Source Distribution

spxtacular-0.4.0.tar.gz (95.0 MB view details)

Uploaded Source

Built Distribution

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

spxtacular-0.4.0-py3-none-any.whl (59.1 kB view details)

Uploaded Python 3

File details

Details for the file spxtacular-0.4.0.tar.gz.

File metadata

  • Download URL: spxtacular-0.4.0.tar.gz
  • Upload date:
  • Size: 95.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for spxtacular-0.4.0.tar.gz
Algorithm Hash digest
SHA256 48fb6715df99183b2f8c9d88b6bb5c4d6be0a49ee93b009e9801dcb5eb85c993
MD5 9cc92bdf5a2f1d8b4fc13b4a4815dfe9
BLAKE2b-256 5c5f03d58cf2e46856b366eabe123bb8e6e05346f870bc7604631f834485ef53

See more details on using hashes here.

File details

Details for the file spxtacular-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: spxtacular-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 59.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for spxtacular-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 175171f91f91f3badbd7b737e2199b86fd1fc090b447821912946680412848e1
MD5 80b1ebdfb47d261d1364cd80bd7ae72a
BLAKE2b-256 c30803197441dfd85aed227afb9aa343ac590f13fde304a4da8645f34cec4380

See more details on using hashes here.

Release history Release notifications | RSS feed

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

This release

0.4.0 This release

2 files

0.3.0

2 files

0.2.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