jms-metabolite-services


Namejms-metabolite-services JSON
Version 0.5.8 PyPI version JSON
download
home_pagehttps://github.com/shuzhao-li/JMS
Summaryconversion, search of metabolic models and metabolomics data
upload_time2024-04-15 19:44:20
maintainerNone
docs_urlNone
authorShuzhao Li, Minghao Gong
requires_python>=3
licensePython
keywords metabolomics chemistry bioinformatics mass spectrometry
VCS
bugtrack_url
requirements mass2chem khipu-metabolomics
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Json's Metabolite Services (JMS)
================================

A Python library for 
- mapping identifiers between genome scale metabolic models and metabolite databases
- reusable data structures for peaks, compounds and indexed data stores
- efficient mass and empirical compound search functions

As the name suggests, JSON or similar Python dictionaries are used widely in this library.
The definition of these data structures was a result of patterning our scientific work, 
and we encourage reuse and community contributions.
A few examples:

```
// A LC-MS peak:
{
    'id_number': 555,
    'mz': 133.0970, 
    'rtime': 654, 
    'height': 14388.0, 
    'left_base': 648, 
    'right_base': 662, 
}

// A compound (i.e. metabolite):
{
    'primary_id': HMDB0000195,
    'primary_db': 'HMDB',
    'name': 'Inosine',
    "neutral_formula": C10H12N4O5,
    "neutral_formula_mass": 268.08077, 
    'SMILES': 'OC[C@H]1O[C@H]([C@H](O)[C@@H]1O)N1C=NC2=C(O)N=CN=C12', 
    'inchikey': 'UGQMRVRMYYASKQ-KQYNXXCUSA-N',
    'LogP': -2.10,
    'other_ids': {'PubChem': '6021',
                  'KEGG': 'C00294',
                  'ChEBI': '17596',
                  'MetaNetX': 'MNXM1103335',
                  },
}

// An empirical compound:
{
    "neutral_formula_mass": 268.08077, 
    "neutral_formula": C10H12N4O5,
    "alternative_formulas": [],
    "interim_id": C10H12N4O5_268.08077,
    "identity": [
            {'compounds': ['HMDB0000195'], 'names': ['Inosine'], 
                    'score': 0.6, 'probability': null},
            {'compounds': ['HMDB0000195', 'HMDB0000481'], 'names': ['Inosine', 'Allopurinol riboside'], 
                    'score': 0.1, 'probability': null},
            {'compounds': ['HMDB0000481'], 'names': ['Allopurinol riboside'], 
                    'score': 0.1, 'probability': null},
            {'compounds': ['HMDB0003040''], 'names': ['Arabinosylhypoxanthine'], 
                    'score': 0.05, 'probability': null},
            ],
    "MS1_pseudo_Spectra": [
            {'feature_id': 'FT1705', 'mz': 269.0878, 'rtime': 99.90, 
                    'isotope': 'M0', 'modification': '+H', 'charged_formula': '', 'ion_relation': 'M+H[1+]'},
            {'feature_id': 'FT1876', 'mz': 291.0697, 'rtime': 99.53, 
                    'isotope': 'M0', 'modification': '+Na', 'charged_formula': '', 'ion_relation': 'M+Na[1+]'},
            {'feature_id': 'FT1721', 'mz': 270.0912, 'rtime': 99.91, 
                    'isotope': '13C', 'modification': '+H', 'charged_formula': '', 'ion_relation': 'M(C13)+H[1+]'},
            {'feature_id': 'FT1993', 'mz': 307.0436, 'rtime': 99.79, 
                    'isotope': 'M0', 'modification': '+K', 'charged_formula': '', 'ion_relation': 'M+K[1+]'},
            ],
    "MS2_Spectra": [
            'AZ0000711', 'AZ0002101'
            ],
    "Database_referred": ["Azimuth", "HMDB", "MONA"],
}
```

These examples show a core set of attributes. 
Users can extend to include other attributes that meet their own project needs.
With consistent core concepts, some simple mapping dictionaries will produce interoperability between projects. 

In empirical compound, MS1_pseudo_Spectra are for adduction ions (A-ions); the biological_ion is usually different (B-ions).


Install
=======

`pip install jms-metabolite-services`


How to use
==========

See notebooks under docs/ for demonstration.

Run test:
```
# decompress the HMDB4 data if needed
➜  JMS✗ xz -d jms/data/compounds/list_compounds_HMDB4.json.xz 
# run test from top dir
➜  JMS✗ python3 -m jms.test 
```

Example code of annotating a feature table against HMDB as in test.py:

```
import json
from jms.dbStructures import annotate_peaks_against_kcds
from jms.io import read_table_to_peaks

list_compounds = json.load(open('jms/data/compounds/list_compounds_HMDB4.json'))
mydata = read_table_to_peaks('testdata/full_Feature_table.tsv', '\t')

annotate_peaks_against_kcds(mydata, list_compounds, 
                                export_file_name_prefix='jms_annotated_',
                                mode='pos',  mz_tolerance_ppm=5)
```

Links
=====
Source code: https://github.com/shuzhao-li/JMS

Package Repository: https://pypi.org/project/jms-metabolite-services/

Related projects:

metDataModel: data models for metabolomics

mass2chem: common utilities in interpreting mass spectrometry data, annotation

khipu: a Python library for generalized, low-level annotation of MS metabolomics

Asari: trackable and scalable LC-MS data preprocessing

mummichog: metabolomics pathway/network analysis


Dev notes
=========
The PyPi package excludes subdirectories in /data.

The App Engine web tool will be in a different repository.


Citation
========
To come.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/shuzhao-li/JMS",
    "name": "jms-metabolite-services",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3",
    "maintainer_email": null,
    "keywords": "metabolomics, chemistry, bioinformatics, mass spectrometry",
    "author": "Shuzhao Li, Minghao Gong",
    "author_email": "shuzhao.li@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/3a/0b/65b514616aa58d624db7b2c890039cd008129477b62d60f98a98a38845c8/jms_metabolite_services-0.5.8.tar.gz",
    "platform": null,
    "description": "Json's Metabolite Services (JMS)\n================================\n\nA Python library for \n- mapping identifiers between genome scale metabolic models and metabolite databases\n- reusable data structures for peaks, compounds and indexed data stores\n- efficient mass and empirical compound search functions\n\nAs the name suggests, JSON or similar Python dictionaries are used widely in this library.\nThe definition of these data structures was a result of patterning our scientific work, \nand we encourage reuse and community contributions.\nA few examples:\n\n```\n// A LC-MS peak:\n{\n    'id_number': 555,\n    'mz': 133.0970, \n    'rtime': 654, \n    'height': 14388.0, \n    'left_base': 648, \n    'right_base': 662, \n}\n\n// A compound (i.e. metabolite):\n{\n    'primary_id': HMDB0000195,\n    'primary_db': 'HMDB',\n    'name': 'Inosine',\n    \"neutral_formula\": C10H12N4O5,\n    \"neutral_formula_mass\": 268.08077, \n    'SMILES': 'OC[C@H]1O[C@H]([C@H](O)[C@@H]1O)N1C=NC2=C(O)N=CN=C12', \n    'inchikey': 'UGQMRVRMYYASKQ-KQYNXXCUSA-N',\n    'LogP': -2.10,\n    'other_ids': {'PubChem': '6021',\n                  'KEGG': 'C00294',\n                  'ChEBI': '17596',\n                  'MetaNetX': 'MNXM1103335',\n                  },\n}\n\n// An empirical compound:\n{\n    \"neutral_formula_mass\": 268.08077, \n    \"neutral_formula\": C10H12N4O5,\n    \"alternative_formulas\": [],\n    \"interim_id\": C10H12N4O5_268.08077,\n    \"identity\": [\n            {'compounds': ['HMDB0000195'], 'names': ['Inosine'], \n                    'score': 0.6, 'probability': null},\n            {'compounds': ['HMDB0000195', 'HMDB0000481'], 'names': ['Inosine', 'Allopurinol riboside'], \n                    'score': 0.1, 'probability': null},\n            {'compounds': ['HMDB0000481'], 'names': ['Allopurinol riboside'], \n                    'score': 0.1, 'probability': null},\n            {'compounds': ['HMDB0003040''], 'names': ['Arabinosylhypoxanthine'], \n                    'score': 0.05, 'probability': null},\n            ],\n    \"MS1_pseudo_Spectra\": [\n            {'feature_id': 'FT1705', 'mz': 269.0878, 'rtime': 99.90, \n                    'isotope': 'M0', 'modification': '+H', 'charged_formula': '', 'ion_relation': 'M+H[1+]'},\n            {'feature_id': 'FT1876', 'mz': 291.0697, 'rtime': 99.53, \n                    'isotope': 'M0', 'modification': '+Na', 'charged_formula': '', 'ion_relation': 'M+Na[1+]'},\n            {'feature_id': 'FT1721', 'mz': 270.0912, 'rtime': 99.91, \n                    'isotope': '13C', 'modification': '+H', 'charged_formula': '', 'ion_relation': 'M(C13)+H[1+]'},\n            {'feature_id': 'FT1993', 'mz': 307.0436, 'rtime': 99.79, \n                    'isotope': 'M0', 'modification': '+K', 'charged_formula': '', 'ion_relation': 'M+K[1+]'},\n            ],\n    \"MS2_Spectra\": [\n            'AZ0000711', 'AZ0002101'\n            ],\n    \"Database_referred\": [\"Azimuth\", \"HMDB\", \"MONA\"],\n}\n```\n\nThese examples show a core set of attributes. \nUsers can extend to include other attributes that meet their own project needs.\nWith consistent core concepts, some simple mapping dictionaries will produce interoperability between projects. \n\nIn empirical compound, MS1_pseudo_Spectra are for adduction ions (A-ions); the biological_ion is usually different (B-ions).\n\n\nInstall\n=======\n\n`pip install jms-metabolite-services`\n\n\nHow to use\n==========\n\nSee notebooks under docs/ for demonstration.\n\nRun test:\n```\n# decompress the HMDB4 data if needed\n\u279c  JMS\u2717 xz -d jms/data/compounds/list_compounds_HMDB4.json.xz \n# run test from top dir\n\u279c  JMS\u2717 python3 -m jms.test \n```\n\nExample code of annotating a feature table against HMDB as in test.py:\n\n```\nimport json\nfrom jms.dbStructures import annotate_peaks_against_kcds\nfrom jms.io import read_table_to_peaks\n\nlist_compounds = json.load(open('jms/data/compounds/list_compounds_HMDB4.json'))\nmydata = read_table_to_peaks('testdata/full_Feature_table.tsv', '\\t')\n\nannotate_peaks_against_kcds(mydata, list_compounds, \n                                export_file_name_prefix='jms_annotated_',\n                                mode='pos',  mz_tolerance_ppm=5)\n```\n\nLinks\n=====\nSource code: https://github.com/shuzhao-li/JMS\n\nPackage Repository: https://pypi.org/project/jms-metabolite-services/\n\nRelated projects:\n\nmetDataModel: data models for metabolomics\n\nmass2chem: common utilities in interpreting mass spectrometry data, annotation\n\nkhipu: a Python library for generalized, low-level annotation of MS metabolomics\n\nAsari: trackable and scalable LC-MS data preprocessing\n\nmummichog: metabolomics pathway/network analysis\n\n\nDev notes\n=========\nThe PyPi package excludes subdirectories in /data.\n\nThe App Engine web tool will be in a different repository.\n\n\nCitation\n========\nTo come.\n\n",
    "bugtrack_url": null,
    "license": "Python",
    "summary": "conversion, search of metabolic models and metabolomics data",
    "version": "0.5.8",
    "project_urls": {
        "Homepage": "https://github.com/shuzhao-li/JMS"
    },
    "split_keywords": [
        "metabolomics",
        " chemistry",
        " bioinformatics",
        " mass spectrometry"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d3d2c0a9022ff7a8272dc4317bc4694f2d48d1d9b21f34eec5e8328ed944adf3",
                "md5": "802c27afe59eb96a9f2bfc19ace852ef",
                "sha256": "6e40c1a6dbe42fafc3b6346fd81f89aa78bd24943d8a3c6e55f37028880e8793"
            },
            "downloads": -1,
            "filename": "jms_metabolite_services-0.5.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "802c27afe59eb96a9f2bfc19ace852ef",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3",
            "size": 3184909,
            "upload_time": "2024-04-15T19:44:17",
            "upload_time_iso_8601": "2024-04-15T19:44:17.720027Z",
            "url": "https://files.pythonhosted.org/packages/d3/d2/c0a9022ff7a8272dc4317bc4694f2d48d1d9b21f34eec5e8328ed944adf3/jms_metabolite_services-0.5.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a0b65b514616aa58d624db7b2c890039cd008129477b62d60f98a98a38845c8",
                "md5": "64d54d563b642507db8337fb4e088e7e",
                "sha256": "0067d4804ebf10aed93556be6e2f7113173b9f5a50c36ea81ef6a2d0254772e7"
            },
            "downloads": -1,
            "filename": "jms_metabolite_services-0.5.8.tar.gz",
            "has_sig": false,
            "md5_digest": "64d54d563b642507db8337fb4e088e7e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3",
            "size": 3083005,
            "upload_time": "2024-04-15T19:44:20",
            "upload_time_iso_8601": "2024-04-15T19:44:20.008655Z",
            "url": "https://files.pythonhosted.org/packages/3a/0b/65b514616aa58d624db7b2c890039cd008129477b62d60f98a98a38845c8/jms_metabolite_services-0.5.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-15 19:44:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "shuzhao-li",
    "github_project": "JMS",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "mass2chem",
            "specs": []
        },
        {
            "name": "khipu-metabolomics",
            "specs": [
                [
                    ">=",
                    "0.7.0"
                ]
            ]
        }
    ],
    "lcname": "jms-metabolite-services"
}
        
Elapsed time: 0.27884s