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)

How to use this package

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 pyISOPACh is using pip:

pip install pyMSHRF

Usage of HRF calculation function

import pyMSHRF

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

# 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.

License

Code released under the MIT license.

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.0.2.tar.gz (17.3 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.0.2-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyMSHRF-0.0.2.tar.gz
Algorithm Hash digest
SHA256 c3a5090d29bc29e35b8cc538635e5fb8039ffaad3641226f8ca6be43bb1ba2c3
MD5 b7e82254754ab1651e391d80c9659802
BLAKE2b-256 e02dbaba593a0077c9bfbad00e68b4905cc76d17b84a6821f0764ccd1da67535

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyMSHRF-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 20.0 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.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 27b8989ebc19db083a7ffb1946b2b65c837e48fd36783f4a3d5b3e3b093cc30b
MD5 71179bb276916f6b85841670dff77e7e
BLAKE2b-256 9a337eba2620e8c314c2e6fdd58b1de17665cfff5c4b33900dc197ad921a7ead

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