CoreMS 4.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- corems/__init__.py +63 -0
- corems/chroma_peak/__init__.py +0 -0
- corems/chroma_peak/calc/ChromaPeakCalc.py +480 -0
- corems/chroma_peak/calc/__init__.py +0 -0
- corems/chroma_peak/calc/subset.py +196 -0
- corems/chroma_peak/factory/__init__.py +0 -0
- corems/chroma_peak/factory/chroma_peak_classes.py +1178 -0
- corems/encapsulation/__init__.py +0 -0
- corems/encapsulation/constant.py +1283 -0
- corems/encapsulation/factory/__init__.py +0 -0
- corems/encapsulation/factory/parameters.py +392 -0
- corems/encapsulation/factory/processingSetting.py +1244 -0
- corems/encapsulation/input/__init__.py +0 -0
- corems/encapsulation/input/parameter_from_json.py +579 -0
- corems/encapsulation/output/__init__.py +0 -0
- corems/encapsulation/output/parameter_to_dict.py +142 -0
- corems/encapsulation/output/parameter_to_json.py +332 -0
- corems/mass_spectra/__init__.py +0 -0
- corems/mass_spectra/calc/GC_Calc.py +84 -0
- corems/mass_spectra/calc/GC_Deconvolution.py +558 -0
- corems/mass_spectra/calc/GC_RI_Calibration.py +44 -0
- corems/mass_spectra/calc/MZSearch.py +249 -0
- corems/mass_spectra/calc/SignalProcessing.py +656 -0
- corems/mass_spectra/calc/__init__.py +0 -0
- corems/mass_spectra/calc/lc_calc.py +5790 -0
- corems/mass_spectra/calc/lc_calc_operations.py +1127 -0
- corems/mass_spectra/factory/GC_Class.py +791 -0
- corems/mass_spectra/factory/__init__.py +0 -0
- corems/mass_spectra/factory/chromat_data.py +51 -0
- corems/mass_spectra/factory/lc_class.py +2721 -0
- corems/mass_spectra/input/__init__.py +0 -0
- corems/mass_spectra/input/andiNetCDF.py +200 -0
- corems/mass_spectra/input/boosterHDF5.py +216 -0
- corems/mass_spectra/input/brukerSolarix.py +153 -0
- corems/mass_spectra/input/brukerSolarix_utils.py +73 -0
- corems/mass_spectra/input/corems_hdf5.py +1710 -0
- corems/mass_spectra/input/massList.py +133 -0
- corems/mass_spectra/input/mzml.py +668 -0
- corems/mass_spectra/input/parserbase.py +239 -0
- corems/mass_spectra/input/rawFileReader.py +1839 -0
- corems/mass_spectra/output/__init__.py +0 -0
- corems/mass_spectra/output/export.py +2800 -0
- corems/mass_spectrum/__init__.py +0 -0
- corems/mass_spectrum/calc/AutoRecalibration.py +237 -0
- corems/mass_spectrum/calc/Calibration.py +602 -0
- corems/mass_spectrum/calc/CalibrationCalc.py +253 -0
- corems/mass_spectrum/calc/KendrickGroup.py +239 -0
- corems/mass_spectrum/calc/MassErrorPrediction.py +436 -0
- corems/mass_spectrum/calc/MassSpectrumCalc.py +303 -0
- corems/mass_spectrum/calc/MeanResolvingPowerFilter.py +212 -0
- corems/mass_spectrum/calc/NoiseCalc.py +371 -0
- corems/mass_spectrum/calc/NoiseCalc_Bayes.py +93 -0
- corems/mass_spectrum/calc/PeakPicking.py +994 -0
- corems/mass_spectrum/calc/__init__.py +0 -0
- corems/mass_spectrum/factory/MassSpectrumClasses.py +1753 -0
- corems/mass_spectrum/factory/__init__.py +0 -0
- corems/mass_spectrum/input/__init__.py +0 -0
- corems/mass_spectrum/input/baseClass.py +531 -0
- corems/mass_spectrum/input/boosterHDF5.py +161 -0
- corems/mass_spectrum/input/coremsHDF5.py +475 -0
- corems/mass_spectrum/input/massList.py +402 -0
- corems/mass_spectrum/input/numpyArray.py +133 -0
- corems/mass_spectrum/output/__init__.py +0 -0
- corems/mass_spectrum/output/export.py +841 -0
- corems/molecular_formula/__init__.py +0 -0
- corems/molecular_formula/calc/MolecularFormulaCalc.py +885 -0
- corems/molecular_formula/calc/__init__.py +0 -0
- corems/molecular_formula/factory/MolecularFormulaFactory.py +895 -0
- corems/molecular_formula/factory/__init__.py +0 -0
- corems/molecular_formula/input/__init__.py +0 -0
- corems/molecular_formula/input/masslist_ref.py +355 -0
- corems/molecular_id/__init__.py +0 -0
- corems/molecular_id/calc/ClusterFilter.py +251 -0
- corems/molecular_id/calc/MolecularFilter.py +122 -0
- corems/molecular_id/calc/SpectralSimilarity.py +632 -0
- corems/molecular_id/calc/__init__.py +0 -0
- corems/molecular_id/calc/math_distance.py +1637 -0
- corems/molecular_id/data/FAMES_REF.msp +980 -0
- corems/molecular_id/data/PNNLMetV20191015.msp +157267 -0
- corems/molecular_id/factory/EI_SQL.py +650 -0
- corems/molecular_id/factory/MolecularLookupTable.py +914 -0
- corems/molecular_id/factory/__init__.py +0 -0
- corems/molecular_id/factory/classification.py +884 -0
- corems/molecular_id/factory/lipid_molecular_metadata.py +50 -0
- corems/molecular_id/factory/molecularSQL.py +827 -0
- corems/molecular_id/factory/spectrum_search_results.py +119 -0
- corems/molecular_id/input/__init__.py +0 -0
- corems/molecular_id/input/nistMSI.py +148 -0
- corems/molecular_id/search/__init__.py +0 -0
- corems/molecular_id/search/compoundSearch.py +214 -0
- corems/molecular_id/search/database_interfaces.py +1527 -0
- corems/molecular_id/search/findOxygenPeaks.py +330 -0
- corems/molecular_id/search/lcms_spectral_search.py +348 -0
- corems/molecular_id/search/molecularFormulaSearch.py +1117 -0
- corems/molecular_id/search/priorityAssignment.py +723 -0
- corems/ms_peak/__init__.py +0 -0
- corems/ms_peak/calc/MSPeakCalc.py +1010 -0
- corems/ms_peak/calc/__init__.py +0 -0
- corems/ms_peak/factory/MSPeakClasses.py +542 -0
- corems/ms_peak/factory/__init__.py +0 -0
- corems/transient/__init__.py +0 -0
- corems/transient/calc/TransientCalc.py +362 -0
- corems/transient/calc/__init__.py +0 -0
- corems/transient/factory/TransientClasses.py +457 -0
- corems/transient/factory/__init__.py +0 -0
- corems/transient/input/__init__.py +0 -0
- corems/transient/input/brukerSolarix.py +461 -0
- corems/transient/input/midasDatFile.py +172 -0
- corems-4.0.0.dist-info/METADATA +475 -0
- corems-4.0.0.dist-info/RECORD +171 -0
- corems-4.0.0.dist-info/WHEEL +5 -0
- corems-4.0.0.dist-info/licenses/LICENSE +22 -0
- corems-4.0.0.dist-info/top_level.txt +4 -0
- examples/archive/scripts/CoreMS_tutorial.py +94 -0
- examples/archive/scripts/DI HR-MS Halogens Bruker.py +196 -0
- examples/archive/scripts/DI HR-MS MassList.py +385 -0
- examples/archive/scripts/GC-MS MetabRef.py +213 -0
- examples/archive/scripts/GC-MS NetCDF.py +217 -0
- examples/archive/scripts/HR-MS Thermo Raw 21T.py +136 -0
- examples/archive/scripts/LC-ICPMS_metal_peaks.py +297 -0
- examples/archive/scripts/LCMS-Thermo.py +460 -0
- examples/archive/scripts/LCMS_isotopes.py +283 -0
- examples/archive/scripts/MSParams_example.py +21 -0
- examples/archive/scripts/Molecular Formula Data Aggreation.py +84 -0
- examples/archive/scripts/Single Mz Search.py +69 -0
- examples/test_notebooks.py +145 -0
- ext_lib/ChemstationMSFileReader.dll +0 -0
- ext_lib/ChemstationMSFileReader.xml +126 -0
- ext_lib/RawFileReaderLicense.doc +0 -0
- ext_lib/ThermoFisher.CommonCore.BackgroundSubtraction.dll +0 -0
- ext_lib/ThermoFisher.CommonCore.BackgroundSubtraction.xml +2307 -0
- ext_lib/ThermoFisher.CommonCore.Data.dll +0 -0
- ext_lib/ThermoFisher.CommonCore.Data.xml +28974 -0
- ext_lib/ThermoFisher.CommonCore.MassPrecisionEstimator.dll +0 -0
- ext_lib/ThermoFisher.CommonCore.MassPrecisionEstimator.xml +241 -0
- ext_lib/ThermoFisher.CommonCore.RawFileReader.dll +0 -0
- ext_lib/ThermoFisher.CommonCore.RawFileReader.xml +31174 -0
- ext_lib/__init__.py +0 -0
- ext_lib/dotnet/OpenMcdf.Extensions.dll +0 -0
- ext_lib/dotnet/OpenMcdf.dll +0 -0
- ext_lib/dotnet/OpenMcdf.xml +1154 -0
- ext_lib/dotnet/System.IO.FileSystem.AccessControl.dll +0 -0
- ext_lib/dotnet/System.IO.FileSystem.AccessControl.xml +506 -0
- ext_lib/dotnet/System.Security.AccessControl.dll +0 -0
- ext_lib/dotnet/System.Security.AccessControl.xml +2043 -0
- ext_lib/dotnet/System.Security.Principal.Windows.dll +0 -0
- ext_lib/dotnet/System.Security.Principal.Windows.xml +1011 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.BackgroundSubtraction.dll +0 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.BackgroundSubtraction.xml +2307 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.Data.dll +0 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.Data.xml +29148 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.MassPrecisionEstimator.dll +0 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.MassPrecisionEstimator.xml +241 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.RawFileReader.dll +0 -0
- ext_lib/dotnet/ThermoFisher.CommonCore.RawFileReader.xml +31492 -0
- ext_lib/version +18 -0
- support_code/atom_parsers/AtomsDescription.py +359 -0
- support_code/atom_parsers/CreateAtomsDescription.py +56 -0
- support_code/nmdc/filefinder.py +90 -0
- support_code/nmdc/lipidomics/lipidomics_workflow.py +748 -0
- support_code/nmdc/lipidomics/manifest_examples.py +49 -0
- support_code/nmdc/metabolomics/gcms_workflow.py +158 -0
- support_code/nmdc/metabolomics/lcms_metabolomics_targeted_search.py +59 -0
- support_code/nmdc/metabolomics/lcms_metabolomics_workflow.py +248 -0
- support_code/nmdc/metabolomics/metabolomics_collection.py +628 -0
- support_code/nmdc/metadata/dms_api.py +42 -0
- support_code/nmdc/nom/archived_scripts/nmdc_metadata_gen.py +288 -0
- support_code/nmdc/nom/archived_scripts/nom_grow_workflow.py +209 -0
- support_code/nmdc/nom/nom_workflow.py +312 -0
- support_code/windows_only_importers/BrukerCompassXtract.py +180 -0
- support_code/windows_only_importers/ThermoMSFileReader.py +405 -0
|
File without changes
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import dataclasses
|
|
2
|
+
|
|
3
|
+
from corems.encapsulation.factory.processingSetting import (
|
|
4
|
+
LiquidChromatographSetting,
|
|
5
|
+
MolecularFormulaSearchSettings,
|
|
6
|
+
TransientSetting,
|
|
7
|
+
MassSpecPeakSetting,
|
|
8
|
+
MassSpectrumSetting,
|
|
9
|
+
LCMSCollectionSettings,
|
|
10
|
+
)
|
|
11
|
+
from corems.encapsulation.factory.processingSetting import (
|
|
12
|
+
CompoundSearchSettings,
|
|
13
|
+
GasChromatographSetting,
|
|
14
|
+
)
|
|
15
|
+
from corems.encapsulation.factory.processingSetting import DataInputSetting
|
|
16
|
+
|
|
17
|
+
def hush_output():
|
|
18
|
+
"""Toggle all the verbose_processing flags to False on the MSParameters, GCMSParameters and LCMSParameters classes"""
|
|
19
|
+
MSParameters.molecular_search.verbose_processing = False
|
|
20
|
+
MSParameters.mass_spectrum.verbose_processing = False
|
|
21
|
+
GCMSParameters.gc_ms.verbose_processing = False
|
|
22
|
+
LCMSParameters.lc_ms.verbose_processing = False
|
|
23
|
+
|
|
24
|
+
def reset_ms_parameters():
|
|
25
|
+
"""Reset the MSParameter class to the default values"""
|
|
26
|
+
MSParameters.molecular_search = MolecularFormulaSearchSettings()
|
|
27
|
+
MSParameters.transient = TransientSetting()
|
|
28
|
+
MSParameters.mass_spectrum = MassSpectrumSetting()
|
|
29
|
+
MSParameters.ms_peak = MassSpecPeakSetting()
|
|
30
|
+
MSParameters.data_input = DataInputSetting()
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def reset_gcms_parameters():
|
|
34
|
+
"""Reset the GCMSParameters class to the default values"""
|
|
35
|
+
GCMSParameters.molecular_search = CompoundSearchSettings()
|
|
36
|
+
GCMSParameters.gc_ms = GasChromatographSetting()
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def reset_lcms_parameters():
|
|
40
|
+
"""Reset the LCMSParameters class to the default values"""
|
|
41
|
+
reset_ms_parameters()
|
|
42
|
+
LCMSParameters.lc_ms = LiquidChromatographSetting()
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class MSParameters:
|
|
46
|
+
"""MSParameters class is used to store the parameters used for the processing of the mass spectrum
|
|
47
|
+
|
|
48
|
+
Each attibute is a class that contains the parameters for the processing of the mass spectrum, see the corems.encapsulation.factory.processingSetting module for more details.
|
|
49
|
+
|
|
50
|
+
Parameters
|
|
51
|
+
----------
|
|
52
|
+
use_defaults: bool, optional
|
|
53
|
+
if True, the class will be instantiated with the default values, otherwise the current values will be used. Default is False.
|
|
54
|
+
|
|
55
|
+
Attributes
|
|
56
|
+
-----------
|
|
57
|
+
molecular_search: MolecularFormulaSearchSettings
|
|
58
|
+
MolecularFormulaSearchSettings object
|
|
59
|
+
transient: TransientSetting
|
|
60
|
+
TransientSetting object
|
|
61
|
+
mass_spectrum: MassSpectrumSetting
|
|
62
|
+
MassSpectrumSetting object
|
|
63
|
+
ms_peak: MassSpecPeakSetting
|
|
64
|
+
MassSpecPeakSetting object
|
|
65
|
+
data_input: DataInputSetting
|
|
66
|
+
DataInputSetting object
|
|
67
|
+
|
|
68
|
+
Notes
|
|
69
|
+
-----
|
|
70
|
+
One can use the use_defaults parameter to reset the parameters to the default values.
|
|
71
|
+
Alternatively, to use the current values - modify the class's contents before instantiating the class.
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
molecular_search = MolecularFormulaSearchSettings()
|
|
75
|
+
transient = TransientSetting()
|
|
76
|
+
mass_spectrum = MassSpectrumSetting()
|
|
77
|
+
ms_peak = MassSpecPeakSetting()
|
|
78
|
+
data_input = DataInputSetting()
|
|
79
|
+
|
|
80
|
+
def __init__(self, use_defaults=False) -> None:
|
|
81
|
+
if not use_defaults:
|
|
82
|
+
self.molecular_search = dataclasses.replace(MSParameters.molecular_search)
|
|
83
|
+
self.transient = dataclasses.replace(MSParameters.transient)
|
|
84
|
+
self.mass_spectrum = dataclasses.replace(MSParameters.mass_spectrum)
|
|
85
|
+
self.ms_peak = dataclasses.replace(MSParameters.ms_peak)
|
|
86
|
+
self.data_input = dataclasses.replace(MSParameters.data_input)
|
|
87
|
+
else:
|
|
88
|
+
self.molecular_search = MolecularFormulaSearchSettings()
|
|
89
|
+
self.transient = TransientSetting()
|
|
90
|
+
self.mass_spectrum = MassSpectrumSetting()
|
|
91
|
+
self.ms_peak = MassSpecPeakSetting()
|
|
92
|
+
self.data_input = DataInputSetting()
|
|
93
|
+
|
|
94
|
+
def copy(self):
|
|
95
|
+
"""Create a copy of the MSParameters object"""
|
|
96
|
+
new_ms_parameters = MSParameters()
|
|
97
|
+
new_ms_parameters.molecular_search = dataclasses.replace(self.molecular_search)
|
|
98
|
+
new_ms_parameters.transient = dataclasses.replace(self.transient)
|
|
99
|
+
new_ms_parameters.mass_spectrum = dataclasses.replace(self.mass_spectrum)
|
|
100
|
+
new_ms_parameters.ms_peak = dataclasses.replace(self.ms_peak)
|
|
101
|
+
new_ms_parameters.data_input = dataclasses.replace(self.data_input)
|
|
102
|
+
|
|
103
|
+
return new_ms_parameters
|
|
104
|
+
|
|
105
|
+
def print(self):
|
|
106
|
+
"""Print the MSParameters object"""
|
|
107
|
+
for k, v in self.__dict__.items():
|
|
108
|
+
print(k, type(v).__name__)
|
|
109
|
+
|
|
110
|
+
for k2, v2 in v.__dict__.items():
|
|
111
|
+
print(" {}: {}".format(k2, v2))
|
|
112
|
+
|
|
113
|
+
def __eq__(self, value: object) -> bool:
|
|
114
|
+
# Check that the object is of the same type
|
|
115
|
+
if not isinstance(value, MSParameters):
|
|
116
|
+
return False
|
|
117
|
+
equality_check = []
|
|
118
|
+
equality_check.append(self.molecular_search == value.molecular_search)
|
|
119
|
+
equality_check.append(self.transient == value.transient)
|
|
120
|
+
equality_check.append(self.mass_spectrum == value.mass_spectrum)
|
|
121
|
+
equality_check.append(self.ms_peak == value.ms_peak)
|
|
122
|
+
equality_check.append(self.data_input == value.data_input)
|
|
123
|
+
|
|
124
|
+
return all(equality_check)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
class GCMSParameters:
|
|
128
|
+
"""GCMSParameters class is used to store the parameters used for the processing of the gas chromatograph mass spectrum
|
|
129
|
+
|
|
130
|
+
Each attibute is a class that contains the parameters for the processing of the data, see the corems.encapsulation.factory.processingSetting module for more details.
|
|
131
|
+
|
|
132
|
+
Parameters
|
|
133
|
+
----------
|
|
134
|
+
use_defaults: bool, optional
|
|
135
|
+
if True, the class will be instantiated with the default values, otherwise the current values will be used. Default is False.
|
|
136
|
+
|
|
137
|
+
Attributes
|
|
138
|
+
-----------
|
|
139
|
+
molecular_search: MolecularFormulaSearchSettings
|
|
140
|
+
MolecularFormulaSearchSettings object
|
|
141
|
+
gc_ms: GasChromatographSetting
|
|
142
|
+
GasChromatographSetting object
|
|
143
|
+
|
|
144
|
+
Notes
|
|
145
|
+
-----
|
|
146
|
+
One can use the use_defaults parameter to reset the parameters to the default values.
|
|
147
|
+
Alternatively, to use the current values - modify the class's contents before instantiating the class.
|
|
148
|
+
"""
|
|
149
|
+
|
|
150
|
+
molecular_search = CompoundSearchSettings()
|
|
151
|
+
gc_ms = GasChromatographSetting()
|
|
152
|
+
|
|
153
|
+
def __init__(self, use_defaults=False) -> None:
|
|
154
|
+
if not use_defaults:
|
|
155
|
+
self.molecular_search = dataclasses.replace(GCMSParameters.molecular_search)
|
|
156
|
+
self.gc_ms = dataclasses.replace(GCMSParameters.gc_ms)
|
|
157
|
+
else:
|
|
158
|
+
self.molecular_search = CompoundSearchSettings()
|
|
159
|
+
self.gc_ms = GasChromatographSetting()
|
|
160
|
+
|
|
161
|
+
def copy(self):
|
|
162
|
+
"""Create a copy of the GCMSParameters object"""
|
|
163
|
+
new_gcms_parameters = GCMSParameters()
|
|
164
|
+
new_gcms_parameters.molecular_search = dataclasses.replace(
|
|
165
|
+
self.molecular_search
|
|
166
|
+
)
|
|
167
|
+
new_gcms_parameters.gc_ms = dataclasses.replace(self.gc_ms)
|
|
168
|
+
|
|
169
|
+
return new_gcms_parameters
|
|
170
|
+
|
|
171
|
+
def __eq__(self, value: object) -> bool:
|
|
172
|
+
# Check that the object is of the same type
|
|
173
|
+
if not isinstance(value, GCMSParameters):
|
|
174
|
+
return False
|
|
175
|
+
equality_check = []
|
|
176
|
+
equality_check.append(self.molecular_search == value.molecular_search)
|
|
177
|
+
equality_check.append(self.gc_ms == value.gc_ms)
|
|
178
|
+
|
|
179
|
+
return all(equality_check)
|
|
180
|
+
|
|
181
|
+
def print(self):
|
|
182
|
+
"""Print the GCMSParameters object"""
|
|
183
|
+
for k, v in self.__dict__.items():
|
|
184
|
+
print(k, type(v).__name__)
|
|
185
|
+
|
|
186
|
+
for k2, v2 in v.__dict__.items():
|
|
187
|
+
print(" {}: {}".format(k2, v2))
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
class LCMSParameters:
|
|
191
|
+
"""LCMSParameters class is used to store the parameters used for the processing of the liquid chromatograph mass spectrum
|
|
192
|
+
|
|
193
|
+
Each attibute is a class that contains the parameters for the processing of the data, see the corems.encapsulation.factory.processingSetting module for more details.
|
|
194
|
+
|
|
195
|
+
Parameters
|
|
196
|
+
----------
|
|
197
|
+
use_defaults: bool, optional
|
|
198
|
+
if True, the class will be instantiated with the default values, otherwise the current values will be used. Default is False.
|
|
199
|
+
|
|
200
|
+
Attributes
|
|
201
|
+
-----------
|
|
202
|
+
lc_ms: LiquidChromatographSetting
|
|
203
|
+
LiquidChromatographSetting object
|
|
204
|
+
mass_spectrum: dict
|
|
205
|
+
dictionary with the mass spectrum parameters for ms1 and ms2, each value is a MSParameters object
|
|
206
|
+
|
|
207
|
+
Notes
|
|
208
|
+
-----
|
|
209
|
+
One can use the use_defaults parameter to reset the parameters to the default values.
|
|
210
|
+
Alternatively, to use the current values - modify the class's contents before instantiating the class.
|
|
211
|
+
"""
|
|
212
|
+
|
|
213
|
+
lc_ms = LiquidChromatographSetting()
|
|
214
|
+
mass_spectrum = {"ms1": MSParameters(), "ms2": MSParameters()}
|
|
215
|
+
|
|
216
|
+
def __init__(self, use_defaults=False) -> None:
|
|
217
|
+
if not use_defaults:
|
|
218
|
+
self.lc_ms = dataclasses.replace(LCMSParameters.lc_ms)
|
|
219
|
+
self.mass_spectrum = {
|
|
220
|
+
"ms1": MSParameters(use_defaults=False),
|
|
221
|
+
"ms2": MSParameters(use_defaults=False),
|
|
222
|
+
}
|
|
223
|
+
else:
|
|
224
|
+
self.lc_ms = LiquidChromatographSetting()
|
|
225
|
+
self.mass_spectrum = {
|
|
226
|
+
"ms1": MSParameters(use_defaults=True),
|
|
227
|
+
"ms2": MSParameters(use_defaults=True),
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
def copy(self):
|
|
231
|
+
"""Create a copy of the LCMSParameters object"""
|
|
232
|
+
new_lcms_parameters = LCMSParameters()
|
|
233
|
+
new_lcms_parameters.lc_ms = dataclasses.replace(self.lc_ms)
|
|
234
|
+
for key in self.mass_spectrum:
|
|
235
|
+
new_lcms_parameters.mass_spectrum[key] = self.mass_spectrum[key].copy()
|
|
236
|
+
|
|
237
|
+
return new_lcms_parameters
|
|
238
|
+
|
|
239
|
+
def __eq__(self, value: object) -> bool:
|
|
240
|
+
# Check that the object is of the same type
|
|
241
|
+
if not isinstance(value, LCMSParameters):
|
|
242
|
+
return False
|
|
243
|
+
equality_check = []
|
|
244
|
+
equality_check.append(self.lc_ms == value.lc_ms)
|
|
245
|
+
|
|
246
|
+
# Check that the mass_spectrum dictionary has the same keys
|
|
247
|
+
equality_check.append(self.mass_spectrum.keys() == value.mass_spectrum.keys())
|
|
248
|
+
|
|
249
|
+
# Check that the values of the mass_spectrum dictionary are equal
|
|
250
|
+
for key in self.mass_spectrum.keys():
|
|
251
|
+
equality_check.append(
|
|
252
|
+
self.mass_spectrum[key].mass_spectrum
|
|
253
|
+
== value.mass_spectrum[key].mass_spectrum
|
|
254
|
+
)
|
|
255
|
+
equality_check.append(
|
|
256
|
+
self.mass_spectrum[key].ms_peak == value.mass_spectrum[key].ms_peak
|
|
257
|
+
)
|
|
258
|
+
equality_check.append(
|
|
259
|
+
self.mass_spectrum[key].molecular_search
|
|
260
|
+
== value.mass_spectrum[key].molecular_search
|
|
261
|
+
)
|
|
262
|
+
equality_check.append(
|
|
263
|
+
self.mass_spectrum[key].transient == value.mass_spectrum[key].transient
|
|
264
|
+
)
|
|
265
|
+
equality_check.append(
|
|
266
|
+
self.mass_spectrum[key].data_input
|
|
267
|
+
== value.mass_spectrum[key].data_input
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
return all(equality_check)
|
|
271
|
+
|
|
272
|
+
def print(self):
|
|
273
|
+
"""Print the LCMSParameters object"""
|
|
274
|
+
# Print the lcms paramters
|
|
275
|
+
for k, v in self.__dict__.items():
|
|
276
|
+
if k == "lc_ms":
|
|
277
|
+
print(k, type(v).__name__)
|
|
278
|
+
|
|
279
|
+
for k2, v2 in self.mass_spectrum.items():
|
|
280
|
+
"""Print the MSParameters object"""
|
|
281
|
+
for k3, v3 in v2.__dict__.items():
|
|
282
|
+
print("{} - {}: {}".format(k2, k3, type(v3).__name__))
|
|
283
|
+
|
|
284
|
+
for k4, v4 in v3.__dict__.items():
|
|
285
|
+
print(" {}: {}".format(k4, v4))
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
class LCMSCollectionParameters:
|
|
289
|
+
"""LCMSCollectionParameters class is used to store the parameters used for the processing of the LCMS collection
|
|
290
|
+
|
|
291
|
+
Each attribute is a class that contains the parameters for the processing of the LCMS collection,
|
|
292
|
+
see the corems.encapsulation.factory.processingSetting module for more details.
|
|
293
|
+
|
|
294
|
+
Parameters
|
|
295
|
+
----------
|
|
296
|
+
use_defaults: bool, optional
|
|
297
|
+
if True, the class will be instantiated with the default values, otherwise the current values will be used.
|
|
298
|
+
Default is False.
|
|
299
|
+
|
|
300
|
+
Attributes
|
|
301
|
+
-----------
|
|
302
|
+
lcms_collection: LCMSCollectionSettings
|
|
303
|
+
LCMSCollectionSettings object
|
|
304
|
+
|
|
305
|
+
Notes
|
|
306
|
+
-----
|
|
307
|
+
One can use the use_defaults parameter to reset the parameters to the default values.
|
|
308
|
+
Alternatively, to use the current values - modify the class's contents before instantiating the class.
|
|
309
|
+
"""
|
|
310
|
+
|
|
311
|
+
lcms_collection = LCMSCollectionSettings()
|
|
312
|
+
|
|
313
|
+
def __init__(self, use_defaults=False) -> None:
|
|
314
|
+
if not use_defaults:
|
|
315
|
+
self.lcms_collection = dataclasses.replace(LCMSCollectionParameters.lcms_collection)
|
|
316
|
+
else:
|
|
317
|
+
self.lcms_collection = LCMSCollectionSettings()
|
|
318
|
+
|
|
319
|
+
def copy(self):
|
|
320
|
+
"""Create a copy of the LCMSCollectionParameters object"""
|
|
321
|
+
new_lcms_collection_parameters = LCMSCollectionParameters()
|
|
322
|
+
new_lcms_collection_parameters.lcms_collection = dataclasses.replace(self.lcms_collection)
|
|
323
|
+
return new_lcms_collection_parameters
|
|
324
|
+
|
|
325
|
+
def __eq__(self, value: object) -> bool:
|
|
326
|
+
# Check that the object is of the same type
|
|
327
|
+
if not isinstance(value, LCMSCollectionParameters):
|
|
328
|
+
return False
|
|
329
|
+
return self.lcms_collection == value.lcms_collection
|
|
330
|
+
|
|
331
|
+
def default_parameters(file_location): # pragma: no cover
|
|
332
|
+
"""Generate parameters dictionary with the default parameters for data processing
|
|
333
|
+
To gather parameters from instrument data during the data parsing step, a parameters dictionary with the default parameters needs to be generated.
|
|
334
|
+
This dictionary acts as a placeholder and is later used as an argument for all the class constructor methods during instantiation.
|
|
335
|
+
The data gathered from the instrument is added to the class properties.
|
|
336
|
+
|
|
337
|
+
Parameters
|
|
338
|
+
----------
|
|
339
|
+
file_location: str
|
|
340
|
+
path to the file
|
|
341
|
+
|
|
342
|
+
Returns
|
|
343
|
+
-------
|
|
344
|
+
parameters: dict
|
|
345
|
+
dictionary with the default parameters for data processing
|
|
346
|
+
"""
|
|
347
|
+
|
|
348
|
+
parameters = dict()
|
|
349
|
+
|
|
350
|
+
parameters["Aterm"] = 0
|
|
351
|
+
|
|
352
|
+
parameters["Bterm"] = 0
|
|
353
|
+
|
|
354
|
+
parameters["Cterm"] = 0
|
|
355
|
+
|
|
356
|
+
parameters["exc_high_freq"] = 0
|
|
357
|
+
|
|
358
|
+
parameters["exc_low_freq"] = 0
|
|
359
|
+
|
|
360
|
+
parameters["mw_low"] = 0
|
|
361
|
+
|
|
362
|
+
parameters["mw_high"] = 0
|
|
363
|
+
|
|
364
|
+
parameters["qpd_enabled"] = 0
|
|
365
|
+
|
|
366
|
+
parameters["bandwidth"] = 0
|
|
367
|
+
|
|
368
|
+
parameters["analyzer"] = "Unknown"
|
|
369
|
+
|
|
370
|
+
parameters["acquisition_time"] = None
|
|
371
|
+
|
|
372
|
+
parameters["instrument_label"] = "Unknown"
|
|
373
|
+
|
|
374
|
+
parameters["sample_name"] = "Unknown"
|
|
375
|
+
|
|
376
|
+
parameters["number_data_points"] = 0
|
|
377
|
+
|
|
378
|
+
parameters["polarity"] = "Unknown"
|
|
379
|
+
|
|
380
|
+
parameters["filename_path"] = str(file_location)
|
|
381
|
+
|
|
382
|
+
"""scan_number and rt will be need to lc ms"""
|
|
383
|
+
|
|
384
|
+
parameters["mobility_scan"] = 0
|
|
385
|
+
|
|
386
|
+
parameters["mobility_rt"] = 0
|
|
387
|
+
|
|
388
|
+
parameters["scan_number"] = 0
|
|
389
|
+
|
|
390
|
+
parameters["rt"] = 0
|
|
391
|
+
|
|
392
|
+
return parameters
|