Skip to content

Commit ccbafa6

Browse files
authored
Merge pull request #172 from RECETOX/hechth/issue163
updated docs
2 parents 9b34fdd + a1088d7 commit ccbafa6

4 files changed

Lines changed: 49 additions & 2 deletions

File tree

MSMetaEnhancer/app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ async def annotate_spectra(
8383

8484
# start converters status checker and wait for first status
8585
try:
86-
monitor.start()
86+
if not monitor.is_alive():
87+
monitor.start()
8788
monitor.first_check.wait()
8889

8990
# create all possible jobs if not given

MSMetaEnhancer/libs/utils/Monitor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def run(self):
5555
Such a converter is considered available.
5656
This is checked periodically to always have up-to-date information.
5757
"""
58-
while not self.stop_request.isSet():
58+
while not self.stop_request.is_set():
5959
for converter in self.converters.values():
6060
url = self.get_base_url(converter)
6161
converter.is_available = self.check_service(url)

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: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
12+
def test_integration(tmp_path):
13+
app = Application()
14+
15+
# import your .msp file
16+
app.load_data("tests/test_data/sample.msp", file_format="msp")
17+
18+
# curate given metadata (e.g. fix CAS numbers)
19+
app.curate_metadata()
20+
21+
# specify requested services (these are supported)
22+
services = ["CTS", "CIR", "IDSM", "PubChem", "BridgeDb", "RDKit"]
23+
24+
# specify requested jobs
25+
jobs = [
26+
("compound_name", "inchi", "IDSM"),
27+
("inchi", "formula", "IDSM"),
28+
("inchi", "inchikey", "IDSM"),
29+
("inchi", "iupac_name", "IDSM"),
30+
("inchi", "canonical_smiles", "IDSM"),
31+
]
32+
33+
# run asynchronous annotations of spectra data
34+
asyncio.run(app.annotate_spectra(services, jobs))
35+
36+
# export .msp file
37+
outpath = os.path.join(tmp_path, "sample_out.msp")
38+
app.save_data(outpath, file_format="msp")
39+
assert os.path.isfile(outpath)
40+
41+
os.remove(outpath)

0 commit comments

Comments
 (0)