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.6.0.tar.gz (16.8 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.6.0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ms1isotopes-0.6.0.tar.gz
Algorithm Hash digest
SHA256 08660eeab7a93bf192d83361a13838f22d442f915e07697eec4a336ea171e95a
MD5 c6dbd93385ff6e155ff4a1cac348ec00
BLAKE2b-256 9051ea21042e6965bb95023682547c7a8876d046528ec841a4e94b16109e759b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ms1isotopes-0.6.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.6.0-py3-none-any.whl.

File metadata

  • Download URL: ms1isotopes-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 15.2 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.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 356e010e18708e37c19e11e6e4f07d8a21ae2f5015c387fa5ce783cc4240ef6e
MD5 63f01da653616f5473df35c72139f744
BLAKE2b-256 87e3e060f9f4b1a6dcb764e5b8ca4c723c15dd5bd47bcf52ff7fd36490a5c942

See more details on using hashes here.

Provenance

The following attestation bundles were made for ms1isotopes-0.6.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