Skip to main content

MassCube

PyPI Downloads

masscube is an integrated Python package for liquid chromatography-mass spectrometry (LC-MS) data processing.

It provides:

  • Highly accurate nontargeted peak detection and segmentation.
  • Comprehensive feature quality evaluation.
  • Confident annotation of feature groups including isotopes, adducts and in-source fragments.
  • Annotation of MS/MS spectra via identity search and fuzzy search (i.e. analog search).

Installation

To install masscube, open a terminal and run:

pip install masscube

To upgrade masscube to the latest version, run:

pip install masscube --upgrade

Quick start

Start your nontargeted metabolomics data processing from here

Bruker timsTOF .d input

MassCube can read DDA-PASEF TDF2 directories directly, including calibrated m/z and inverse reduced ion mobility (1/K0):

from masscube import read_raw_file_to_obj

data = read_raw_file_to_obj("sample.d")
scan = data.scans[data.ms1_idx_arr[0]]
print(scan.signals)             # columns: m/z, intensity
print(scan.inv_mobility)        # aligned intensity-weighted 1/K0
print(scan.inv_mobility_range)  # aligned observed [min, max] 1/K0

The reader does not use OpenTIMS, AlphaTims, or Bruker's TDF-SDK. Its binary decoder uses the Python standard library and loads the system libzstd runtime through ctypes; on macOS it can be installed with brew install zstd. Set MASSCUBE_ZSTD_LIBRARY when the library is in a nonstandard location.

Currently supported Bruker data are TDF2 (TimsCompressionType=2), DDA-PASEF (MsMsType=8), m/z calibration model 1 with dC2=0 and C3=C4=0, and static TIMS calibration model 2. The complete model-1 quadratic (C0, C1, and C2) m/z calibration stored in each frame is applied. The reported 1/K0 applies the stored static mobility calibration but not the vendor's proprietary per-frame pressure compensation; this is recorded as data.metadata.mobility_pressure_compensated == False.

For development-time verification against an installed official TDF-SDK, run:

python tools/validate_tdf_sdk.py sample.d /path/to/libtimsdata.so \
  --output tdf_sdk_validation.json

The validation tool compares exact scan/TOF/intensity coordinates before mobility collapse, calibrated m/z, and all three SDK pressure-compensation strategies. It is not imported by MassCube and does not make TDF-SDK a runtime dependency.

Native .mcraw workflow cache

The untargeted workflow decodes each mzML or supported Bruker .d source once and stores a versioned .mcraw cache under the project tmp directory. Feature detection, gap filling, and aligned feature grouping then reload this cache instead of reparsing the source. Shared MS1/MS2 metadata are stored once; only scan-varying values and concatenated peak arrays are written as NumPy columns. The original vendor data should still be retained as the archival source.

Single-file TXT output keeps the peak_shape column for compatibility but does not embed full chromatographic traces by default. Set Params.output_peak_shape = True when those traces are explicitly needed.

Contribute to masscube

The masscube project is excited to have your expertise and passion on board!

We value all enhancements or corrections. For those thinking about making significant contributions to the codebase, we encourage you to get in touch with us!

License

MassCube is licensed under the Apache License 2.0.

Metadata

Release files for masscube 1.2.23

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for masscube 1.2.23
File Size Uploaded Provenance Actions
masscube-1.2.23.tar.gz 132.8 kB Without provenance Details for masscube-1.2.23.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for masscube 1.2.23
File Interpreter ABI Platform Actions
masscube-1.2.23-py3-none-any.whl Python 3 none any Details for masscube-1.2.23-py3-none-any.whl

Total release size: 260.1 kB

Release files / masscube-1.2.23.tar.gz

Download URL masscube-1.2.23.tar.gz
Size 132.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8a1b050484e5b6cf19b9f20bdb3ff2a5e229c0a9de199b10eada853d856cc8ff
BLAKE2b-256 checksum
How to use checksums
96eff1f2916061c6a3957e8e98f42a2dcdaca0bc7db32787e073f88851776307
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.7

Release files / masscube-1.2.23-py3-none-any.whl

Download URL masscube-1.2.23-py3-none-any.whl
Size 127.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad73672459ee3ca49bcc52b02e49a3745e32e433b10fb4392164273a18992bf2
BLAKE2b-256 checksum
How to use checksums
6ced1c04cdef7499a04923834d311af74093d9129df3b3eeb1bb8638a6b896b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.7

Security for masscube 1.2.23

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.2.23 This release

2 release files No provenance

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