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.1.tar.gz (12.5 kB view hashes)

Uploaded Source

Built Distribution

spectrum_utils-0.2.1-py3.7.egg (26.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page