Python¶
Cython-backed bindings to the mscompress C core. Multi-threaded
compression, random-access reads on .msz, and adapters for Parquet,
PyTorch, and JAX.
- Quick Start — open mzML, iterate spectra, compress to MSZ, read it back.
- Guides — task-oriented recipes for each major feature.
- API Reference — generated from docstrings.
- Build modes — debug, linetrace, Valgrind workflow.
- Troubleshooting — common errors and how to diagnose them.
At a glance¶
import mscompress
# Auto-detect mzML vs MSZ
with mscompress.read("data.mzML") as f:
print(f"{len(f.spectra)} spectra")
for s in f.spectra:
print(s.scan, s.ms_level, s.mz.shape)
f.arguments.threads = 8
f.arguments.zstd_compression_level = 9
f.compress("data.msz")
with mscompress.read("data.msz") as f:
spec = f.spectra[100] # O(1) seek + one block decompress
peaks = spec.peaks # numpy (N, 2) array