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