Skip to content

Commit 7c474c5

Browse files
committed
Update lipid workflow in preparation for MetaMS
1 parent f540281 commit 7c474c5

1 file changed

Lines changed: 1 addition & 44 deletions

File tree

support_code/nmdc/lipidomics/lipidomics_workflow.py

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -206,28 +206,6 @@ def molecular_formula_search(myLCMSobj):
206206
print("searching mf: ", str(i), " of ", str(total_decon_parent))
207207

208208
scan = myLCMSobj.mass_features[mf_id].apex_scan
209-
"""
210-
# Search single spectrum for single peak
211-
time_start = time.time()
212-
SearchMolecularFormulas(
213-
myLCMSobj._ms[scan],
214-
first_hit=False,
215-
find_isotopologues=True,
216-
).run_worker_ms_peaks([myLCMSobj.mass_features[mf_id].ms1_peak])
217-
print("time to search whole spectrum for single peak: ", time.time() - time_start)
218-
# 139 s for mf_id = 1 (single peak annotated), 145s for mf_id = 2 (single peak annotated)
219-
220-
# Search single deconvoluted spectrum for single peak
221-
time_start = time.time()
222-
SearchMolecularFormulas(
223-
myLCMSobj.mass_features[mf_id].mass_spectrum_deconvoluted,
224-
first_hit=False,
225-
find_isotopologues=True,
226-
).run_worker_ms_peaks([myLCMSobj.mass_features[mf_id].ms1_peak])
227-
print("time to search whole deconvoluted spectrum for single peak: ", time.time() - time_start)
228-
# very similar time to above (actually slightly longer probably due to pulling up the deconvoluted spectrum)
229-
"""
230-
231209
# Search single spectrum for all peaks that correspond to the same scan
232210
mf_df_scan = mf_df[mf_df.apex_scan == scan]
233211
peaks_to_search = [
@@ -244,27 +222,6 @@ def molecular_formula_search(myLCMSobj):
244222
time.time() - time_start,
245223
)
246224
i += 1
247-
"""
248-
# get unique scans to search
249-
unique_scans = mf_df.apex_scan.unique()
250-
251-
# search molecular formulas for each mass feature
252-
for scan in unique_scans:
253-
if i > 3: # only search first 3 scans for testing
254-
break
255-
print("searching mz for scan: ", str(i), " of ", str(len(unique_scans)))
256-
# gather mass features for this scan
257-
mf_df_scan = mf_df[mf_df.apex_scan == scan]
258-
peaks_to_search = [
259-
myLCMSobj.mass_features[x].ms1_peak for x in mf_df_scan.index.tolist()
260-
]
261-
SearchMolecularFormulas(
262-
myLCMSobj._ms[scan],
263-
first_hit=False,
264-
find_isotopologues=True,
265-
).run_worker_ms_peaks(peaks_to_search)
266-
i += 1
267-
"""
268225
print("Finished molecular search")
269226

270227

@@ -603,7 +560,7 @@ def run_lipid_workflow(
603560
token_path,
604561
scan_translator=None,
605562
verbose=True,
606-
ms1_molecular_search=False,
563+
ms1_molecular_search=True,
607564
cores=1,
608565
):
609566
"""Run lipidomics workflow

0 commit comments

Comments
 (0)