Skip to content

Commit 678977d

Browse files
committed
adding more testing code
1 parent d01d285 commit 678977d

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

download.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def _resolve_exists_local(usi, temp_folder="temp"):
256256

257257

258258
# Returns remote_link and local filepath
259-
def _resolve_usi(usi, temp_folder="temp"):
259+
def _resolve_usi(usi, temp_folder="temp", cleanup=True):
260260
usi_splits = usi.split(":")
261261

262262
converted_local_filename = os.path.join(temp_folder, _usi_to_local_filename(usi))
@@ -306,7 +306,7 @@ def _resolve_usi(usi, temp_folder="temp"):
306306

307307
# Cleanup
308308
try:
309-
if local_filename != converted_local_filename:
309+
if local_filename != converted_local_filename and cleanup:
310310
os.remove(local_filename)
311311
except:
312312
pass
@@ -338,11 +338,14 @@ def _convert_mzML(input_mzXML, output_mzML):
338338
This will convert mzXML and mzML to mzML
339339
"""
340340

341+
# These are old versions of the convert
341342
#conversion_cmd = "export LC_ALL=C && ./bin/msconvert {} --mzML --32 --outfile {} --outdir {} --filter 'threshold count 500 most-intense' --filter 'msLevel 1' --filter 'MS2Denoise 0 4000'".format(input_mzXML, output_mzML, os.path.dirname(output_mzML))
342343
#conversion_cmd = "export LC_ALL=C && ./bin/msconvert {} --mzML --32 --outfile {} --outdir {} --filter 'threshold count 500 most-intense' --filter 'MS2Denoise 0 4000'".format(input_mzXML, output_mzML, os.path.dirname(output_mzML))
343344
#conversion_cmd = "export LC_ALL=C && ./bin/msconvert {} --mzML --32 --outfile {} --outdir {} --filter 'threshold count 500 most-intense'".format(input_mzXML, output_mzML, os.path.dirname(output_mzML))
344-
conversion_cmd = "export LC_ALL=C && ./bin/msconvert {} --mzML --32 --outfile {} --outdir {} --filter 'threshold absolute 1 most-intense' --filter 'msLevel 1-4'".format(input_mzXML, output_mzML, os.path.dirname(output_mzML))
345345
#conversion_cmd = "export LC_ALL=C && ./bin/msconvert {} --mzML --32 --outfile {} --outdir {}".format(input_mzXML, output_mzML, os.path.dirname(output_mzML))
346+
347+
conversion_cmd = "export LC_ALL=C && ./bin/msconvert {} --mzML --32 --outfile {} --outdir {} --filter 'threshold absolute 1 most-intense' --filter 'msLevel 1-4'".format(input_mzXML, output_mzML, os.path.dirname(output_mzML))
348+
346349
conversion_ret_code = os.system(conversion_cmd)
347350

348351
# Checking the conversion only if the source is mzXML

test/test_debug.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
import sys
3+
sys.path.insert(0, "..")
4+
import xic
5+
import lcms_map
6+
import pandas as pd
7+
import utils
8+
import tic
9+
import ms2
10+
import download
11+
12+
13+
def test_scan_in_usi():
14+
usi = "mzspec:MSV000086838:peak/ST001652/10_D6_CT1.mzXML"
15+
remote_link, local_filename = download._resolve_usi(usi, cleanup=False)
16+
17+
print(remote_link, local_filename)

test/test_usi_resolution.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ def test_resolve_download():
1818
remote_link, local_filename = download._resolve_usi(record["usi"])
1919

2020
assert(os.path.exists(local_filename))
21+
22+
# We should also check the number of spectra
23+
#TODO: Check this
2124

2225

2326
def test_resolve_filename():

0 commit comments

Comments
 (0)