Skip to main content

A Python-based gloss of the RaMS package in R

Project description

pylgrams

A Python language gloss of the RaMS package for rapid and intuitive access to mass-spectrometry data. This package parses the open source mass-spectrometry mzML and mzXML file types in Python and returns the retention time, m/z ratio, and intensity values to the user as a Pandas data frame. This allows for easy chromatogram extraction and visualization.

The package currently lacks much of the expanded functionality of RaMS and is currently comparable to RaMS v1.0. I don't have plans to expand this much further - for additional functionality, consider using the rpy2 package to port the R code directly.

Installation

pip install pylgrams

Demo

import matplotlib.pyplot as plt
import seaborn as sns
import os
import pylgrams

msdata = pylgrams.grabMSdata("src/pylgrams/example_data/S30657.mzML.gz")
bet_chrom = msdata["MS1"][(msdata["MS1"]["mz"]>118.085) & (msdata["MS1"]["mz"]<118.087)]
bet_chrom = bet_chrom[(bet_chrom["rt"]>7) & (bet_chrom["rt"]<9)]
sns.relplot(bet_chrom, kind="line", x="rt", y="int")
plt.show()

bet_frags = msdata["MS2"][(msdata["MS2"]["premz"]>118.0865) & (msdata["MS2"]["premz"]<118.0867)]
plt.stem(bet_frags["fragmz"], bet_frags["int"], linefmt='-k', markerfmt='ko', basefmt=" ")
plt.show()

dir_path = "src/pylgrams/example_data/"
only_mzML_files_os = [os.path.join(dir_path, f) for f in os.listdir(dir_path) if f.endswith('.mzML.gz')]
msdata = pylgrams.grabMSdata(only_mzML_files_os)
bet_chrom = msdata["MS1"][(msdata["MS1"]["mz"]>118.085) & (msdata["MS1"]["mz"]<118.087)]
sns.relplot(bet_chrom, kind="line", x="rt", y="int", hue="filename")
plt.show()

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

pylgrams-1.0.1.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

pylgrams-1.0.1-py3-none-any.whl (1.7 MB view details)

Uploaded Python 3

File details

Details for the file pylgrams-1.0.1.tar.gz.

File metadata

  • Download URL: pylgrams-1.0.1.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.1

File hashes

Hashes for pylgrams-1.0.1.tar.gz
Algorithm Hash digest
SHA256 cdac4e1881055a2156bbe7cdaca0b762110a4e094ec947286cb9fbc81d6190bf
MD5 10a75fe07410b2bb2633a76ea338f607
BLAKE2b-256 6205d86d9089742d081a5f7a741eae9d714593f42dba7657bdc683aa3d43815d

See more details on using hashes here.

File details

Details for the file pylgrams-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pylgrams-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.1

File hashes

Hashes for pylgrams-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a5d57324768f097bb5dc5ff823b9bdda1a160cfdaf1771edb49c2dccae31466f
MD5 9e612aa33b12d76215dfa14e5c1bef9b
BLAKE2b-256 d2887e9fa062329ef9affa48210edcaa6b8a932a77a88b45bff0f0813a34b222

See more details on using hashes here.

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