Skip to content

Commit 2c1efab

Browse files
committed
updated docs
1 parent 9b34fdd commit 2c1efab

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ Troják et al., (2022). MSMetaEnhancer: A Python package for mass spectra metada
2020
import asyncio
2121

2222
from MSMetaEnhancer import Application
23+
from MSMetaEnhancer.libs.converters.web import CTS, CIR, IDSM, PubChem, BridgeDb
24+
from MSMetaEnhancer.libs.converters.compute import RDKit
25+
from MSMetaEnhancer.libs.utils.ConverterBuilder import ConverterBuilder
26+
27+
ConverterBuilder.register([CTS, CIR, IDSM, PubChem, BridgeDb, RDKit])
2328

2429
app = Application()
2530

tests/test_integration.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import asyncio
2+
import os
3+
4+
from MSMetaEnhancer import Application
5+
from MSMetaEnhancer.libs.converters.web import CTS, CIR, IDSM, PubChem, BridgeDb
6+
from MSMetaEnhancer.libs.converters.compute import RDKit
7+
from MSMetaEnhancer.libs.utils.ConverterBuilder import ConverterBuilder
8+
9+
ConverterBuilder.register([CTS, CIR, IDSM, PubChem, BridgeDb, RDKit])
10+
11+
def test_integration(tmp_path):
12+
app = Application()
13+
14+
# import your .msp file
15+
app.load_data('tests/test_data/sample.msp', file_format='msp')
16+
17+
# curate given metadata (e.g. fix CAS numbers)
18+
app.curate_metadata()
19+
20+
# specify requested services (these are supported)
21+
services = ['CTS', 'CIR', 'IDSM', 'PubChem', 'BridgeDb', 'RDKit']
22+
23+
# specify requested jobs
24+
jobs = [('name', 'inchi', 'IDSM'), ('inchi', 'formula', 'IDSM'), ('inchi', 'inchikey', 'IDSM'),
25+
('inchi', 'iupac_name', 'IDSM'), ('inchi', 'canonical_smiles', 'IDSM')]
26+
27+
# run asynchronous annotations of spectra data
28+
asyncio.run(app.annotate_spectra(services, jobs))
29+
30+
# export .msp file
31+
outpath = os.path.join(tmp_path, 'sample_out.msp')
32+
app.save_data(outpath, file_format='msp')
33+
assert os.path.isfile(outpath)
34+
35+
os.remove(outpath)

0 commit comments

Comments
 (0)