pyMSHRF


NamepyMSHRF JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryThis program calculates the high-resolution filter score while doing GC/MS annotation.
upload_time2024-11-21 07:58:55
maintainerNone
docs_urlNone
authorZinuo Huang
requires_python>=3.2
licenseNone
keywords cheminformatics gc/ms annotation metabolomics
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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)](https://doi.org/10.1021/acs.analchem.5b01503)

The isotope pattern calculator module is based on pyISOPACh package. [(ref)](https://github.com/AberystwythSystemsBiology/pyISOPACh)


# 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
```python
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:

```python
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)](https://github.com/YuanyueLi/MSEntropy) Here is an example of how you can use it:

```python
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>

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyMSHRF",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.2",
    "maintainer_email": null,
    "keywords": "cheminformatics, GC/MS annotation, metabolomics",
    "author": "Zinuo Huang",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/ef/fc/10d9a44324c7ec282613511afb3b131e24891b65e5474ca267109a8c4508/pyMSHRF-0.1.0.tar.gz",
    "platform": null,
    "description": "# pyMSHRF - HRF Calculator for GC/MS annotation\n\n# Theoritical Background\n`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)](https://doi.org/10.1021/acs.analchem.5b01503)\n\nThe isotope pattern calculator module is based on pyISOPACh package. [(ref)](https://github.com/AberystwythSystemsBiology/pyISOPACh)\n\n\n# Installation\n\npyMSHRF 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.\n\nThe easiest way of installing pyMSHRF is using ```pip```:\n\n```\npip install pyMSHRF\n```\n# Usage\n## Usage of HRF calculation function\n```python\nimport pyMSHRF\nimport numpy as np\n\nformula = 'C5H7N3O2'\npeaks_query = np.array([[191.09071, 14670.0], [124.05742, 3543.0], [141.09334, 6191.0]], dtype = np.float32)\n\n# Add TMS-derived group if desired\nformula_derived = pyMSHRF.derivatization(formula, num_tms=1, num_meox=0)\n\n# Calculate HRF score\nHRF_score = pyMSHRF.HRF(formula, peaks_query, delta_da = 0.02)\nprint(f\"HRF score is {HRF_score}.\")\n```\nCalculate the `reverse high-resolution filtering (RHRF)` score need reference spectrum:\n\n```python\npeaks_reference = np.array([[82, 6.99], [141, 999.0], [124, 562.49]], dtype = np.float32)\n\n# Calculate RHRF score\nRHRF_score = pyMSHRF.RHRF(formula, peaks_query, peaks_reference, delta_da = 0.02)\nprint(f\"RHRF score is {RHRF_score}.\")\n```\n\n\n## Useful functions\n### Reading Spectra from a File\nFor 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)](https://github.com/YuanyueLi/MSEntropy) Here is an example of how you can use it:\n\n```python\nimport pyMSHRF\n\n# Load all spectra from file into python\nspectra_list = list(pyMSHRF.read_one_spectrum('path/to/spectrum/file'))\n\n# Get spectrum peak list\nfor spectrum in spectra_list:\n    query_spec = spectrum['peaks']\n```\nThis function returns a dictionary, where each key-value pair corresponds to a specific metadata of the spectrum.\n\nCurrently, the `read_one_spectrum` function supports the following file formats: `.mgf`, `.msp`, `.mzML`, and `.lbm2`.\n\n# Reference\n1. N. W. Kwiecien et al., High-Resolution Filtering for Improved Small Molecule Identification via GC/MS. Analytical Chemistry 87, 8328-8335 (2015).\n\n2. <https://github.com/AberystwythSystemsBiology/pyISOPACh>\n\n3. <https://github.com/YuanyueLi/MSEntropy>\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "This program calculates the high-resolution filter score while doing GC/MS annotation.",
    "version": "0.1.0",
    "project_urls": null,
    "split_keywords": [
        "cheminformatics",
        " gc/ms annotation",
        " metabolomics"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fa2ebaedf159d777986e74d5663760e920e6943e7f1ae98ce4d32be3a491a883",
                "md5": "04311e3194b4a53d3bea576e1345d825",
                "sha256": "bdeaff260ec4c97f4a7dc457754eea574f032d112f69950face9fe3647c0a40b"
            },
            "downloads": -1,
            "filename": "pyMSHRF-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "04311e3194b4a53d3bea576e1345d825",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.2",
            "size": 21066,
            "upload_time": "2024-11-21T07:58:54",
            "upload_time_iso_8601": "2024-11-21T07:58:54.035526Z",
            "url": "https://files.pythonhosted.org/packages/fa/2e/baedf159d777986e74d5663760e920e6943e7f1ae98ce4d32be3a491a883/pyMSHRF-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "effc10d9a44324c7ec282613511afb3b131e24891b65e5474ca267109a8c4508",
                "md5": "8a7a54a2ee8b74e9148ab57fc6e6e0e0",
                "sha256": "325098f94e7d8502404283abaf3e17200cf42b82c8fb0df26648bac22ceb5c58"
            },
            "downloads": -1,
            "filename": "pyMSHRF-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "8a7a54a2ee8b74e9148ab57fc6e6e0e0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.2",
            "size": 18430,
            "upload_time": "2024-11-21T07:58:55",
            "upload_time_iso_8601": "2024-11-21T07:58:55.446892Z",
            "url": "https://files.pythonhosted.org/packages/ef/fc/10d9a44324c7ec282613511afb3b131e24891b65e5474ca267109a8c4508/pyMSHRF-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-21 07:58:55",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pymshrf"
}
        
Elapsed time: 2.93308s