From 459b4d2053f3252b0a93d3878b6b53c8a828a650 Mon Sep 17 00:00:00 2001 From: Philipbear Date: Mon, 16 Sep 2024 11:17:02 -0700 Subject: [PATCH] bug fix --- bin/create_library/merge_df.py | 4 +++- bin/create_library/summarize_df.py | 3 ++- workflowinput.yaml | 8 ++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/bin/create_library/merge_df.py b/bin/create_library/merge_df.py index f29eca0..2eb3bef 100755 --- a/bin/create_library/merge_df.py +++ b/bin/create_library/merge_df.py @@ -1,11 +1,13 @@ import pandas as pd -def merge_compound_feature_tables(compound_df, feature_df, mz_da=0.002, mz_ppm=10): +def merge_compound_feature_tables(compound_df, feature_df, mz_ppm=10): """ Merge compound DataFrame with feature table based on m/z values. """ + mz_da = 200 * mz_ppm / 1e6 + # Create empty list to store matches matches = [] diff --git a/bin/create_library/summarize_df.py b/bin/create_library/summarize_df.py index a56580d..b596575 100644 --- a/bin/create_library/summarize_df.py +++ b/bin/create_library/summarize_df.py @@ -27,7 +27,8 @@ def summarize_df(df): # for INCHI_AUX isomer_inchi_ls = df.loc[mask, 'inchi_adduct'].unique().tolist() # remove the current inchi_adduct - isomer_inchi_ls.remove(row['inchi_adduct']) + if row['inchi_adduct'] in isomer_inchi_ls: + isomer_inchi_ls.remove(row['inchi_adduct']) row['isomer_inchis'] = ';'.join(isomer_inchi_ls) mask2 = df['SMILES_adduct'] == row['SMILES_adduct'] diff --git a/workflowinput.yaml b/workflowinput.yaml index ceb6776..7950429 100644 --- a/workflowinput.yaml +++ b/workflowinput.yaml @@ -2,7 +2,7 @@ workflowname: reverse_metabolomics_create_library_workflow workflowdescription: This is to create MS/MS libraries for reverse metabolomics. workflowlongdescription: This is the workflow to create a tsv library from a set of mzML files and compound csv files. The tsv file is ready to be uploaded to GNPS library. A template for the compound csv file can be found [here](https://docs.google.com/spreadsheets/d/14VoG20s6C8GaoWk1fodWFzg2Ao8p9UuRcvuW7rgiEnA/edit?usp=sharing). -workflowversion: "2024.09.16" +workflowversion: "2024.09.16.2" workflowfile: nf_workflow.nf workflowautohide: false adminonly: false @@ -63,9 +63,9 @@ parameterlist: formvalue: "full" options: - value: "simple" - display: "Positive: M+H, M+Na, M+NH4 | Negative: M-H" + display: "Positive: M+H, M+Na, M+NH4 || Negative: M-H" - value: "full" - display: "Positive: M+H, M+Na, M+NH4, M+K, M+H-H2O, M+H-2H2O, M+H-3H2O | Negative: M-H, M+FA, M+Ac, M+Cl, M+Br, M-H-H2O" + display: "Positive: M+H, M+Na, M+NH4, M+K, M+H-H2O, M+H-2H2O, M+H-3H2O || Negative: M-H, M+FA, M+Ac, M+Cl, M+Br, M-H-H2O" - displayname: Core Adduct Filter paramtype: select @@ -76,5 +76,5 @@ parameterlist: display: "True" - value: "0" display: "False" - tooltip: "One chemical can have multiple candidate peaks in the LC-MS run. If true, candidate peaks without core adducts will be excluded. Core adducts: M+H, M+NH4, M+H-H2O, M+H-2H2O; M-H" + tooltip: "One chemical can have multiple candidate peaks in the LC-MS run. If true, candidate peaks without core adducts will be excluded. Core adducts: M+H, M+NH4, M+H-H2O, M+H-2H2O || M-H"