Skip to main content

Extract and evaluate MS1 isotope distributions from LC-MS/MS proteomics data

Project description

ms1isotopes

PyPI License: GPL v3 Tests

A Python package for extracting and evaluating MS1 isotope distributions from LC-MS/MS proteomics data.

What it does

Given an mzML file and a list of peptide identifications, ms1isotopes:

  1. Extracts experimental isotope envelopes (m/z + intensity for up to 6 peaks) across the chromatographic elution window
  2. Computes theoretical isotope distributions using the BRAIN algorithm (via brainpy)
  3. Scores similarity between experimental and theoretical distributions using the spectral angle
  4. Outputs annotated results in Excel, TSV, or hierarchical JSON

Installation

pip install ms1isotopes

Dependencies

  • Python ≥ 3.9
  • numpy, pandas, numba
  • pyteomics (for mzML parsing)
  • lxml (XML backend for pyteomics)
  • brainpy (brain-isotopic-distribution)
  • openpyxl (for Excel I/O)

Quick start

Command line

ms1isotopes extract \
    -m sample.mzML \
    -i identifications.xlsx \
    -o results \
    --tolerance 5

This produces results.xlsx, results.tsv, and results.json.

Python API

import ms1isotopes

# Load input list (Excel, CSV, or TSV)
input_list = ms1isotopes.read_input_list("identifications.xlsx")

# Run extraction
results = ms1isotopes.extract_ms1_isotope_distributions(
    mzml_path="sample.mzML",
    input_list=input_list,
    tolerance_ppm=5.0,
    n_isotopes=6,
)

# Save results
ms1isotopes.results_to_excel(results, "output.xlsx")
ms1isotopes.results_to_json(results, "output.json")

Computing isotope distributions without mzML data

import ms1isotopes
import numpy as np

# Peptide → atomic composition
comp = ms1isotopes.sequence_to_composition(
    "PEPTIDE", charge_state=2, n_carbamidomethyl=0
)
# → {'C': 34, 'H': 57, 'N': 7, 'O': 15, 'S': 0}

# Theoretical isotope distribution (via BRAIN)
mz_values, intensities = ms1isotopes.theoretical_isotope_distribution(comp, n_peaks=6)

# Spectral angle against experimental data
experimental = np.array([10000, 5500, 2000, 500, np.nan, np.nan])
sa = ms1isotopes.spectral_angle(intensities, experimental)

Input list format

The input list must contain these columns:

Column Description
Peptide_Sequence Amino acid sequence (single-letter codes)
Charge_State Precursor charge state
Modifications PTMs, e.g. C(57.0214)M(15.9949) or empty
RetentionTime PSM retention time (seconds)
RetentionTimeWindowBefore Extraction window before RT (seconds)
RetentionTimeWindowAfter Extraction window after RT (seconds)

Optional columns: MZ (observed m/z), ErrorTolerance (ppm).

Output columns

The output DataFrame contains experimental isotope peaks, theoretical distributions from BRAIN, atomic composition, spectral angle, peak counts, and metadata. See the documentation for the full schema.

Testing

pip install ms1isotopes[dev]
pytest tests/

Citation

If you use ms1isotopes in your research, please cite:

[Work in progress]

License

GPLv3. See LICENSE for details.

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

ms1isotopes-0.4.0.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

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

ms1isotopes-0.4.0-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ms1isotopes-0.4.0.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ms1isotopes-0.4.0.tar.gz
Algorithm Hash digest
SHA256 58b4d0c81e12feb2686496462f8676af5ccff7e2a634d9ecfb15d0e2ba37b12d
MD5 616b807a541c5a0d7c48328889305da7
BLAKE2b-256 84ae42b5aee74ded6b855a50d9034efbd6ab2d3a1f7e4313002d4d415a29418e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ms1isotopes-0.4.0.tar.gz:

Publisher: publish.yml on VilenneFrederique/ms1isotopes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: ms1isotopes-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ms1isotopes-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 21f62d3739478097a54cde30ce4e1498de0938c378bcc2baab72e1f54aa42f53
MD5 6524a8f3d9c2ab4038a239236196e521
BLAKE2b-256 c7dc4e5f934a19bb60fd8cdf0b359f66b88814a475a41e591eada2f342d6b355

See more details on using hashes here.

Provenance

The following attestation bundles were made for ms1isotopes-0.4.0-py3-none-any.whl:

Publisher: publish.yml on VilenneFrederique/ms1isotopes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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