Skip to content

Commit

Permalink
Merge pull request #1 from JamesLAdair/main
Browse files Browse the repository at this point in the history
Added initial files for minimal test
  • Loading branch information
mpecchi committed Mar 22, 2024
2 parents 059c930 + 3721bc2 commit c90a5eb
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/gcms_data_analysis/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ def name_to_properties(
)

# print(f"{df.loc[comp_name, :]}")
# mol_weigth = df.loc[comp_name, "molecular_weight"]
# mol_weight = df.loc[comp_name, "molecular_weight"]

for cl in classes: # get counts and mf of each class in compound
newdf.loc[comp_name, cl] = fragmentation[cl] # counts in
Expand Down Expand Up @@ -1649,7 +1649,7 @@ class Project:
]
semi_calibration = True
tanimoto_similarity_threshold = 0.4
delta_mol_weigth_threshold = 100
delta_mol_weight_threshold = 100
column_to_sort_values_in_samples = "retention_time"

@classmethod
Expand All @@ -1665,7 +1665,7 @@ class attributes related to the project's directory structure,
cls.shared_path = cls.in_path.parents[0]

@classmethod
def set_auto_save_to_excel(cls, new_auto_save_to_excel):
def set_auto_save_to_excel(cls, new_auto_save_to_excel: bool):
"""Enable or disable automatic saving of results to Excel (default True).
This method updates the class attribute that controls whether
analysis results are automatically saved in an Excel file."""
Expand All @@ -1686,11 +1686,11 @@ def set_tanimoto_similarity_threshold(cls, new_tanimoto_similarity_threshold):
cls.tanimoto_similarity_threshold = new_tanimoto_similarity_threshold

@classmethod
def set_delta_mol_weigth_threshold(cls, new_delta_mol_weigth_threshold):
def set_delta_mol_weight_threshold(cls, new_delta_mol_weight_threshold):
"""Set the delta molecular weight threshold for compound matching (default 100).
This method updates the class attribute that specifies the threshold used for
comparing molecular weights in compound matching."""
cls.delta_mol_weigth_threshold = new_delta_mol_weigth_threshold
cls.delta_mol_weight_threshold = new_delta_mol_weight_threshold

@classmethod
def set_plot_grid(cls, new_plot_grid):
Expand Down Expand Up @@ -2434,7 +2434,7 @@ def _apply_calib_to_file(self, filename, calibration, df_comps):
df_sim.Similarity >= Project.tanimoto_similarity_threshold
]
df_sim = df_sim[
df_sim.delta_mw < Project.delta_mol_weigth_threshold
df_sim.delta_mw < Project.delta_mol_weight_threshold
]
# if a compound matches the requirements
if not df_sim.empty: # assign the calibration
Expand Down Expand Up @@ -2813,7 +2813,7 @@ def create_files_param_aggrrep(self, param="conc_vial_mg_L"):
# each compound contributes to the cumulative sum of each
# functional group for the based on the mass fraction it has
# of that functional group (fg_mf act as weights)
# if fg_mf in subrep: multiply signal for weigth and sum
# if fg_mf in subrep: multiply signal for weight and sum
# to get aggregated
weights = fg_mf_all.loc[list_iupac, fg_mf].astype(signal.dtype)

Expand Down Expand Up @@ -2964,7 +2964,7 @@ def create_samples_param_aggrrep(self, param: str = "conc_vial_mg_L"):
# # each compound contributes to the cumulative sum of each
# # functional group for the based on the mass fraction it has
# # of that functional group (fg_mf act as weights)
# # if fg_mf in subrep: multiply signal for weigth and sum
# # if fg_mf in subrep: multiply signal for weight and sum
# # to get aggregated
# weights = fg_mf_all.loc[list_iupac, fg_mf].astype(signal.dtype)

Expand Down
12 changes: 12 additions & 0 deletions tests/minimal_set/S_1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Header]
Data File Name C:\Users\user\Documents\jla278\T1.qgd
Output Date 3/18/2024
Output Time 11:00:20 AM

[MC Peak Table]
# of Peaks 3
Mass TIC
Peak# Ret.Time Proc.From Proc.To Mass Area Height A/H Conc. Mark Name Ret. Index Area% Height% SI CAS #
1 13.703 13.580 13.900 TIC 20 20 1 0 V Phenol 2.59 3.01 97 108-95-2
2 20.942 20.767 21.020 TIC 200 200 1 0 V Naphthalene 8.11 9.20 98 91-20-3
3 21.426 21.373 21.500 TIC 2000 2000 1 0 V Dodecane 0.36 0.57 96 112-40-3
12 changes: 12 additions & 0 deletions tests/minimal_set/S_2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Header]
Data File Name C:\Users\user\Documents\jla278\T1.qgd
Output Date 3/18/2024
Output Time 11:00:20 AM

[MC Peak Table]
# of Peaks 3
Mass TIC
Peak# Ret.Time Proc.From Proc.To Mass Area Height A/H Conc. Mark Name Ret. Index Area% Height% SI CAS #
1 13.703 13.580 13.900 TIC 40 40 1 0 V Phenol 2.59 3.01 97 108-95-2
2 20.942 20.767 21.020 TIC 400 400 1 0 V Naphthalene 8.11 9.20 98 91-20-3
3 21.426 21.373 21.500 TIC 4000 4000 1 0 V Dodecane 0.36 0.57 96 112-40-3
12 changes: 12 additions & 0 deletions tests/minimal_set/T_1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Header]
Data File Name C:\Users\user\Documents\jla278\T1.qgd
Output Date 3/18/2024
Output Time 11:00:20 AM

[MC Peak Table]
# of Peaks 3
Mass TIC
Peak# Ret.Time Proc.From Proc.To Mass Area Height A/H Conc. Mark Name Ret. Index Area% Height% SI CAS #
1 13.703 13.580 13.900 TIC 20 20 1 0 V Phenol 2.59 3.01 97 108-95-2
2 20.942 20.767 21.020 TIC 50 50 1 0 V Naphthalene 8.11 9.20 98 91-20-3
3 21.426 21.373 21.500 TIC 500 500 1 0 V Dodecane 0.36 0.57 96 112-40-3
12 changes: 12 additions & 0 deletions tests/minimal_set/T_2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Header]
Data File Name C:\Users\user\Documents\jla278\T2.qgd
Output Date 3/18/2024
Output Time 11:00:20 AM

[MC Peak Table]
# of Peaks 3
Mass TIC
Peak# Ret.Time Proc.From Proc.To Mass Area Height A/H Conc. Mark Name Ret. Index Area% Height% SI CAS #
1 13.703 13.580 13.900 TIC 10 10 1 0 V Phenol 2.59 3.01 97 108-95-2
2 20.942 20.767 21.020 TIC 100 1000 1 0 V Naphthalene 8.11 9.20 98 91-20-3
3 21.426 21.373 21.500 TIC 1000 1000 1 0 V Dodecane 0.36 0.57 96 112-40-3
12 changes: 12 additions & 0 deletions tests/minimal_set/T_3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Header]
Data File Name C:\Users\user\Documents\jla278\T3.qgd
Output Date 3/18/2024
Output Time 11:00:20 AM

[MC Peak Table]
# of Peaks 3
Mass TIC
Peak# Ret.Time Proc.From Proc.To Mass Area Height A/H Conc. Mark Name Ret. Index Area% Height% SI CAS #
1 13.703 13.580 13.900 TIC 0 0 1 0 V Phenol 2.59 3.01 97 108-95-2
2 20.942 20.767 21.020 TIC 150 150 1 0 V Naphthalene 8.11 9.20 98 91-20-3
3 21.426 21.373 21.500 TIC 1500 1500 1 0 V Dodecane 0.36 0.57 96 112-40-3
Binary file added tests/minimal_set/cal_minimal.xlsx
Binary file not shown.
Binary file not shown.
Binary file added tests/minimal_set/files_info.xlsx
Binary file not shown.

0 comments on commit c90a5eb

Please sign in to comment.