44
55import os
66import sys
7+ from pathlib import Path
78from multiprocessing import Pool
89
910from corems .mass_spectra .calc .GC_RI_Calibration import get_rt_ri_pairs
@@ -39,14 +40,12 @@ def get_gcms(filepath):
3940 gcms = reader_gcms .get_gcms_obj ()
4041
4142 # # Process chromatogram
42- # gcms.process_chromatogram()
43+ gcms .process_chromatogram ()
4344
4445 return gcms
4546
4647
47- def run (args ):
48- # Unpack arguments
49- filepath , ref_dict , cal_filepath = args
48+ def run (filepath , ref_dict , cal_filepath ):
5049
5150 # Parse supplied file
5251 gcms = get_gcms (filepath )
@@ -57,7 +56,7 @@ def run(args):
5756 # Calibrate retention index
5857 gcms .calibrate_ri (ref_dict , cal_filepath )
5958
60- # Initialize GCMS refeerence database from MetabRef
59+ # Initialize GCMS reference database from MetabRef
6160 sql_obj = start_gcms_metabref_sql ()
6261
6362 # Initialize spectral match
@@ -71,22 +70,31 @@ def run(args):
7170
7271def test_gcms_workflow ():
7372 # # Define paths
74- # filepath = None
75- # calibration_filepath = None
76-
77- # # Set token
78- # TOKEN_PATH = "metabref.token"
79- # MetabRefGCInterface().set_token(TOKEN_PATH)
73+ filepath = (
74+ Path .cwd ()
75+ / "tests/tests_data/gcms/"
76+ / "GCMS_FAMES_01_GCMS-01_20191023.cdf"
77+ )
78+ calibration_filepath = (
79+ Path .cwd ()
80+ / "tests/tests_data/gcms/"
81+ / "GCMS_FAMES_01_GCMS-01_20191023.cdf"
82+ )
8083
8184 # # Parse supplied calibration data
82- # gcms_ref_obj = get_gcms(calibration_filepath)
85+ gcms_ref_obj = get_gcms (calibration_filepath )
8386
8487 # # Build calibration SQLite database from MetabRef
85- # fames_sql_obj = start_fames_metabref_sql()
88+ fames_sql_obj = start_fames_metabref_sql ()
8689
8790 # # Determine calibration pairs
88- # rt_ri_pairs = get_rt_ri_pairs(gcms_ref_obj, sql_obj=fames_sql_obj)
91+ rt_ri_pairs = get_rt_ri_pairs (gcms_ref_obj , sql_obj = fames_sql_obj )
92+
93+ # Execute
94+ output = run (filepath , rt_ri_pairs , calibration_filepath )
95+
96+ # Export results
97+ df = output .to_dataframe ()
8998
90- # # Execute
91- # run((filepath, rt_ri_pairs, calibration_filepath))
92- pass
99+ # Check results
100+ assert df ['Compound Name' ][0 ] == "N,N-dimethylglycine"
0 commit comments