Skip to main content

This program calculates the high-resolution filter score while doing GC/MS annotation.

Project description

pyMSHRF - HRF Calculator for GC/MS annotation

Theoritical Background

High-resolution filtering (HRF) approach is both feasible and highly specific toward correct identifications, which bridges the gap between unit resolution GC/MS spectra and accurate mass data dubious. (ref)

The isotope pattern calculator module is based on pyISOPACh package. (ref)

Installation

pyMSHRF requires Python 3+ and is unfortunately not compatible with Python 2. If you are still using Python 2, a clever workaround is to install Python 3 and use that instead.

The easiest way of installing pyMSHRF is using pip:

pip install pyMSHRF

Usage

Usage of HRF calculation function

import pyMSHRF
import numpy as np

formula = 'C5H7N3O2'
peaks_query = np.array([[191.09071, 14670.0], [124.05742, 3543.0], [141.09334, 6191.0]], dtype = np.float32)

# Add TMS-derived group if desired
formula_derived = pyMSHRF.derivatization(formula, num_tms=1, num_meox=0)

# Calculate HRF score
HRF_score = pyMSHRF.HRF(formula, peaks_query, delta_da = 0.02)
print(f"HRF score is {HRF_score}.")

Calculate the reverse high-resolution filtering (RHRF) score need reference spectrum:

peaks_reference = np.array([[82, 6.99], [141, 999.0], [124, 562.49]], dtype = np.float32)

# Calculate RHRF score
RHRF_score = pyMSHRF.RHRF(formula, peaks_query, peaks_reference, delta_da = 0.02)
print(f"RHRF score is {RHRF_score}.")

Useful functions

Reading Spectra from a File

For ease of use, a function named read_one_spectrum is provided in the pyMSHRF package, allowing you to easily read spectra from a file.(ref) Here is an example of how you can use it:

import pyMSHRF

# Load all spectra from file into python
spectra_list = list(pyMSHRF.read_one_spectrum('path/to/spectrum/file'))

# Get spectrum peak list
for spectrum in spectra_list:
    query_spec = spectrum['peaks']

This function returns a dictionary, where each key-value pair corresponds to a specific metadata of the spectrum.

Currently, the read_one_spectrum function supports the following file formats: .mgf, .msp, .mzML, and .lbm2.

Reference

  1. N. W. Kwiecien et al., High-Resolution Filtering for Improved Small Molecule Identification via GC/MS. Analytical Chemistry 87, 8328-8335 (2015).

  2. https://github.com/AberystwythSystemsBiology/pyISOPACh

  3. https://github.com/YuanyueLi/MSEntropy

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

pyMSHRF-0.1.1.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

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

pyMSHRF-0.1.1-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file pyMSHRF-0.1.1.tar.gz.

File metadata

  • Download URL: pyMSHRF-0.1.1.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.17

File hashes

Hashes for pyMSHRF-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b7380b49cca6566b6a7c851cfc69a5bf15d6bf2858c031810f8191ef84504c33
MD5 86db13bad704b7658d4a91b9b1577b69
BLAKE2b-256 93bd75a1374d22242230a185f928484a2b4c31a2116172df296e71cce5ce593b

See more details on using hashes here.

File details

Details for the file pyMSHRF-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pyMSHRF-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.17

File hashes

Hashes for pyMSHRF-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4f0c64b35d5cf60c6edc5ebba2e5a402a8bb7059f9e346e0775c24bfe7caafd6
MD5 25f7191e3ec13cb33ef684e9ebbb4cde
BLAKE2b-256 25d3fe97425e8e28f53c28aad2c185340b306587fcaaea5c8baf625805816e75

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