martenson / pyMSPannotator

Repository for tool that adds more annotations (e.g. SMILES, InChI, CAS number) to MSP files (Python version).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python package

pyMSPannotator

Repository for tool that adds more annotations (e.g. SMILES, InChI, CAS number) to MSP files (Python version).

How to use this tool

import asyncio

from app import Application

app = Application()

# import your .msp file
app.load_spectra('tests/test_data/sample.msp', file_format='msp')

# curate given metadata (e.g. fix CAS numbers)
app.curate_spectra()

# specify requested services (these are supported)
services = ['CTS', 'CIR', 'NLM', 'PubChem']

# specify requested jobs
jobs = [('name', 'inchi', 'PubChem'), ('inchi', 'formula', 'PubChem'), ('inchi', 'inchikey', 'PubChem'),
        ('inchi', 'iupac_name', 'PubChem'), ('inchi', 'smiles', 'PubChem')]

# run asynchronous annotations of spectra data
asyncio.run(app.annotate_spectra(services, jobs))

# execute without jobs parameter to run all possible jobs
asyncio.run(app.annotate_spectra(services))

# export .msp file 
app.save_spectra('tests/test_data/sample_out.msp', file_format='msp')

About

Repository for tool that adds more annotations (e.g. SMILES, InChI, CAS number) to MSP files (Python version).


Languages

Language:Python 100.0%