Skip to content

Commit 40ec5d7

Browse files
committed
Resolve merge conflicts with master
2 parents 65c6313 + d0ed67c commit 40ec5d7

29 files changed

Lines changed: 1659 additions & 1436 deletions

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 2.0.11
2+
current_version = 2.1.0
33
commit = False
44
tag = False
55

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ CoreMS aims to provide
5050

5151
## Current Version
5252

53-
`2.0.11`
53+
`2.1.0`
5454

5555
***
5656

@@ -323,7 +323,7 @@ UML (unified modeling language) diagrams for Direct Infusion FT-MS and GC-MS cla
323323
324324
If you use CoreMS in your work, please use the following citation:
325325
326-
Version [2.0.11 Release on GitHub](https://github.com/EMSL-Computing/CoreMS/releases/tag/v2.0.11), archived on Zenodo:
326+
Version [2.0.10 Release on GitHub](https://github.com/EMSL-Computing/CoreMS/releases/tag/v2.0.10), archived on Zenodo:
327327
328328
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4641552.svg)](https://doi.org/10.5281/zenodo.4641552)
329329

corems/__init__.py

Lines changed: 2 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = 'Yuri E. Corilo'
2-
__version__ = '2.0.11'
2+
__version__ = '2.1.0'
33
__doc__ = '''
44
<div align="left">
55
@@ -362,94 +362,6 @@ def __exit__(self, exc_type, exc_val, exc_tb):
362362
sys.stdout.close()
363363
sys.stdout = self._original_stdout
364364

365-
def get_filenames(app=None):
366-
367-
from PySide2.QtCore import Qt, QCoreApplication
368-
from PySide2.QtWidgets import QApplication, QFileDialog
369-
from pathlib import Path
370-
371-
app = QApplication(sys.argv)
372-
file_dialog = QFileDialog()
373-
file_dialog.setWindowFlags(Qt.WindowStaysOnTopHint)
374-
file_location, _ = file_dialog.getOpenFileNames()
375-
376-
if file_location:
377-
QCoreApplication.processEvents()
378-
return file_location
379-
380-
else:
381-
382-
return None
383-
384-
def get_filename(app=None):
385-
386-
from PySide2.QtCore import Qt, QCoreApplication
387-
from PySide2.QtWidgets import QApplication, QFileDialog
388-
from pathlib import Path
389-
390-
app = QApplication(sys.argv)
391-
file_dialog = QFileDialog()
392-
file_dialog.setWindowFlags(Qt.WindowStaysOnTopHint)
393-
file_location, _ = file_dialog.getOpenFileName()
394-
395-
if file_location:
396-
QCoreApplication.processEvents()
397-
return Path(file_location)
398-
399-
else:
400-
401-
return None
402-
403-
def get_dirname(app=None):
404-
405-
from PySide2.QtCore import Qt, QCoreApplication
406-
from PySide2.QtWidgets import QApplication, QFileDialog
407-
from pathlib import Path
408-
409-
app = QApplication(sys.argv)
410-
file_dialog = QFileDialog()
411-
file_dialog.setWindowFlags(Qt.WindowStaysOnTopHint)
412-
file_location = file_dialog.getExistingDirectory()
413-
414-
if file_location:
415-
QCoreApplication.processEvents()
416-
return Path(file_location)
417-
418-
else:
419-
420-
return None
421-
422-
def get_dirnames(app=None):
423-
424-
from PySide2.QtCore import Qt, QCoreApplication
425-
from PySide2.QtWidgets import QApplication, QFileDialog, QTreeView, QListView, QAbstractItemView
426-
from pathlib import Path
427-
428-
if not app:
429-
app = QApplication(sys.argv)
430-
# file_dialog = QFileDialog()
431-
# file_dialog.setWindowFlags(Qt.WindowStaysOnTopHint)
432-
# file_location = file_dialog.getOpenFileNames()
433-
434-
file_dialog = QFileDialog()
435-
file_dialog.setFileMode(QFileDialog.DirectoryOnly)
436-
file_dialog.setOption(QFileDialog.DontUseNativeDialog, True)
437-
file_view = file_dialog.findChild(QListView, 'listView')
438-
439-
# to make it possible to select multiple directories:
440-
if file_view:
441-
file_view.setSelectionMode(QAbstractItemView.MultiSelection)
442-
f_tree_view = file_dialog.findChild(QTreeView)
443-
if f_tree_view:
444-
f_tree_view.setSelectionMode(QAbstractItemView.MultiSelection)
445-
446-
if file_dialog.exec():
447-
paths = file_dialog.selectedFiles()
448-
449-
QCoreApplication.processEvents()
450-
for path in paths:
451-
yield Path(path)
452-
453365
def chunks(lst, n):
454366
"""Yield successive n-sized chunks from lst."""
455367
for i in range(0, len(lst), n):
@@ -461,4 +373,4 @@ def corems_md5(fname):
461373

462374
md5_returned = hashlib.sha256(bytes_io).hexdigest()
463375

464-
return "{}:{}".format("sha256", md5_returned)
376+
return "{}:{}".format("sha256", md5_returned)

corems/encapsulation/factory/parameters.py

Lines changed: 89 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,40 @@
1+
import dataclasses
2+
13
from corems.encapsulation.factory.processingSetting import LiquidChromatographSetting, MolecularFormulaSearchSettings, TransientSetting, MassSpecPeakSetting, MassSpectrumSetting
24
from corems.encapsulation.factory.processingSetting import CompoundSearchSettings, GasChromatographSetting
35
from corems.encapsulation.factory.processingSetting import DataInputSetting
46

7+
def reset_ms_parameters():
8+
"""Reset the MSParameter class to the default values"""
9+
MSParameters.molecular_search = MolecularFormulaSearchSettings()
10+
MSParameters.transient = TransientSetting()
11+
MSParameters.mass_spectrum = MassSpectrumSetting()
12+
MSParameters.ms_peak = MassSpecPeakSetting()
13+
MSParameters.data_input = DataInputSetting()
14+
15+
def reset_gcms_parameters():
16+
"""Reset the GCMSParameters class to the default values"""
17+
GCMSParameters.molecular_search = CompoundSearchSettings()
18+
GCMSParameters.gc_ms = GasChromatographSetting()
19+
20+
def reset_lcms_parameters():
21+
"""Reset the LCMSParameters class to the default values"""
22+
LCMSParameters.lc_ms = LiquidChromatographSetting()
23+
LCMSParameters.mass_spectrum = MassSpectrumSetting()
24+
LCMSParameters.ms_peak = MassSpecPeakSetting()
25+
LCMSParameters.ms1_molecular_search = MolecularFormulaSearchSettings()
26+
LCMSParameters.ms2_molecular_search = MolecularFormulaSearchSettings()
27+
528
class MSParameters:
629
"""MSParameters class is used to store the parameters used for the processing of the mass spectrum
730
831
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.
932
33+
Parameters
34+
----------
35+
use_defaults: bool, optional
36+
if True, the class will be instantiated with the default values, otherwise the current values will be used. Default is False.
37+
1038
Attributes
1139
-----------
1240
molecular_search: MolecularFormulaSearchSettings
@@ -19,6 +47,11 @@ class MSParameters:
1947
MassSpecPeakSetting object
2048
data_input: DataInputSetting
2149
DataInputSetting object
50+
51+
Notes
52+
-----
53+
One can use the use_defaults parameter to reset the parameters to the default values.
54+
Alternatively, to use the current values - modify the class's contents before instantiating the class.
2255
"""
2356

2457
molecular_search = MolecularFormulaSearchSettings()
@@ -27,27 +60,64 @@ class MSParameters:
2760
ms_peak = MassSpecPeakSetting()
2861
data_input = DataInputSetting()
2962

63+
def __init__(self, use_defaults = False) -> None:
64+
if not use_defaults:
65+
self.molecular_search = dataclasses.replace(MSParameters.molecular_search)
66+
self.transient = dataclasses.replace(MSParameters.transient)
67+
self.mass_spectrum = dataclasses.replace(MSParameters.mass_spectrum)
68+
self.ms_peak = dataclasses.replace(MSParameters.ms_peak)
69+
self.data_input = dataclasses.replace(MSParameters.data_input)
70+
else:
71+
self.molecular_search = MolecularFormulaSearchSettings()
72+
self.transient = TransientSetting()
73+
self.mass_spectrum = MassSpectrumSetting()
74+
self.ms_peak = MassSpecPeakSetting()
75+
self.data_input = DataInputSetting()
76+
3077
class GCMSParameters:
3178
"""GCMSParameters class is used to store the parameters used for the processing of the gas chromatograph mass spectrum
3279
3380
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.
3481
82+
Parameters
83+
----------
84+
use_defaults: bool, optional
85+
if True, the class will be instantiated with the default values, otherwise the current values will be used. Default is False.
86+
3587
Attributes
3688
-----------
3789
molecular_search: MolecularFormulaSearchSettings
3890
MolecularFormulaSearchSettings object
3991
gc_ms: GasChromatographSetting
4092
GasChromatographSetting object
93+
94+
Notes
95+
-----
96+
One can use the use_defaults parameter to reset the parameters to the default values.
97+
Alternatively, to use the current values - modify the class's contents before instantiating the class.
4198
"""
4299

43100
molecular_search = CompoundSearchSettings()
44101
gc_ms = GasChromatographSetting()
45102

103+
def __init__(self, use_defaults = False) -> None:
104+
if not use_defaults:
105+
self.molecular_search = dataclasses.replace(GCMSParameters.molecular_search)
106+
self.gc_ms = dataclasses.replace(GCMSParameters.gc_ms)
107+
else:
108+
self.molecular_search = CompoundSearchSettings()
109+
self.gc_ms = GasChromatographSetting()
110+
46111
class LCMSParameters:
47112
"""LCMSParameters class is used to store the parameters used for the processing of the liquid chromatograph mass spectrum
48113
49114
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.
50115
116+
Parameters
117+
----------
118+
use_defaults: bool, optional
119+
if True, the class will be instantiated with the default values, otherwise the current values will be used. Default is False.
120+
51121
Attributes
52122
-----------
53123
lc_ms: LiquidChromatographSetting
@@ -60,17 +130,32 @@ class LCMSParameters:
60130
MolecularFormulaSearchSettings object
61131
ms2_molecular_search: MolecularFormulaSearchSettings
62132
MolecularFormulaSearchSettings object
133+
134+
Notes
135+
-----
136+
One can use the use_defaults parameter to reset the parameters to the default values.
137+
Alternatively, to use the current values - modify the class's contents before instantiating the class.
63138
"""
64139
lc_ms = LiquidChromatographSetting()
65-
66140
mass_spectrum = MassSpectrumSetting()
67-
68141
ms_peak = MassSpecPeakSetting()
69-
70142
ms1_molecular_search = MolecularFormulaSearchSettings()
71-
72143
ms2_molecular_search = MolecularFormulaSearchSettings()
73144

145+
def __init__(self, use_defaults = False) -> None:
146+
if not use_defaults:
147+
self.lc_ms = dataclasses.replace(LCMSParameters.lc_ms)
148+
self.mass_spectrum = dataclasses.replace(LCMSParameters.mass_spectrum)
149+
self.ms_peak = dataclasses.replace(LCMSParameters.ms_peak)
150+
self.ms1_molecular_search = dataclasses.replace(LCMSParameters.ms1_molecular_search)
151+
self.ms2_molecular_search = dataclasses.replace(LCMSParameters.ms2_molecular_search)
152+
else:
153+
self.lc_ms = LiquidChromatographSetting()
154+
self.mass_spectrum = MassSpectrumSetting()
155+
self.ms_peak = MassSpecPeakSetting()
156+
self.ms1_molecular_search = MolecularFormulaSearchSettings()
157+
self.ms2_molecular_search = MolecularFormulaSearchSettings()
158+
74159
def default_parameters(file_location): # pragma: no cover
75160
"""Generate parameters dictionary with the default parameters for data processing
76161
To gather parameters from instrument data during the data parsing step, a parameters dictionary with the default parameters needs to be generated.

corems/mass_spectra/calc/SignalProcessing.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
from pandas import Series, DataFrame
66

7-
from scipy.signal import savgol_filter, boxcar
7+
from scipy.signal import savgol_filter
8+
from scipy.signal.windows import boxcar
89
from scipy import interpolate
910
from matplotlib import pyplot as plt
1011
from numpy import abs

0 commit comments

Comments
 (0)