Skip to main content

Mass spectrometry utility functions

Project description

spectrum_utils

Build status Python 3.6 Python 3.7

Simple MS/MS spectrum preprocessing and visualization in Python.

Features

  • Spectrum (pre)processing
    • Precursor & noise peak removal
    • Intensity filtering
    • Intensity scaling
    • Modification-aware fragment ion annotating (powered by Pyteomics)
  • Spectrum plotting
    • Single spectrum with annotated ions
    • Mirror plot of matching spectra
    • Interactive spectrum plots

Example

import matplotlib.pyplot as plt

from spectrum_utils import plot
from spectrum_utils import spectrum


# Initialize spectrum information first...

spec = spectrum.MsmsSpectrum(identifier, precursor_mz, precursor_charge,
                             mz, intensity, retention_time=retention_time,
                             peptide=peptide)

# Preprocess the MS/MS spectrum.
fragment_tol_mass = 10
fragment_tol_mode = 'ppm'
spec = (spec.set_mz_range(min_mz=100, max_mz=1400)
            .remove_precursor_peak(fragment_tol_mass, fragment_tol_mode)
            .filter_intensity(min_intensity=0.05, max_num_peaks=150)
            .scale_intensity(scaling='root')
            .annotate_peaks(fragment_tol_mass, fragment_tol_mode,
                            ion_types='aby'))

# Plot the MS/MS spectrum.
plot.spectrum(spec)

plt.show()
plt.close()

(Condensed example. See here for the full code to generate the figure below.)

spectrum_utils

Installation

spectrum_utils can be installed easily via pip:

pip install spectrum_utils

Or via conda:

conda install -c bioconda spectrum_utils

Dependencies

spectrum_utils has the following dependencies:

Missing dependencies will be automatically installed when you install spectrum_utils.

API documentation

You can find the API documentation here.

Contact

For more information you can visit the official code website or send an email to wout.bittremieux@uantwerpen.be.

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

spectrum_utils-0.2.0.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

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

spectrum_utils-0.2.0-py3.7.egg (26.0 kB view details)

Uploaded Egg

File details

Details for the file spectrum_utils-0.2.0.tar.gz.

File metadata

  • Download URL: spectrum_utils-0.2.0.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for spectrum_utils-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a60ae818acdbca66d078f6fd5310eece64caeb09f8ac523e97a93f997ebac400
MD5 a0fa3794fc6da5081b81923be765dc66
BLAKE2b-256 73219b504f7e26e25b585ee5485337df8f763d9771b705077c8f23f35899d521

See more details on using hashes here.

File details

Details for the file spectrum_utils-0.2.0-py3.7.egg.

File metadata

  • Download URL: spectrum_utils-0.2.0-py3.7.egg
  • Upload date:
  • Size: 26.0 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for spectrum_utils-0.2.0-py3.7.egg
Algorithm Hash digest
SHA256 1f681436ee2d9a312db4f8bc93a961896d9d6bc69ead19341650b27dcce3560d
MD5 3e6299cbd04e037321f7d2130fb54ae6
BLAKE2b-256 b916faf9821a675bb12b3042606f3b1a440654c78b5cf10eb43ea13177f6142b

See more details on using hashes here.

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