masster 0.2.4__py3-none-any.whl → 0.3.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.

Potentially problematic release.


This version of masster might be problematic. Click here for more details.

Files changed (55) hide show
  1. masster/__init__.py +27 -27
  2. masster/_version.py +17 -17
  3. masster/chromatogram.py +497 -503
  4. masster/data/examples/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.featureXML +199787 -0
  5. masster/data/examples/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.sample5 +0 -0
  6. masster/logger.py +318 -244
  7. masster/sample/__init__.py +9 -9
  8. masster/sample/defaults/__init__.py +15 -15
  9. masster/sample/defaults/find_adducts_def.py +325 -325
  10. masster/sample/defaults/find_features_def.py +366 -366
  11. masster/sample/defaults/find_ms2_def.py +285 -285
  12. masster/sample/defaults/get_spectrum_def.py +314 -318
  13. masster/sample/defaults/sample_def.py +374 -378
  14. masster/sample/h5.py +1321 -1297
  15. masster/sample/helpers.py +833 -364
  16. masster/sample/lib.py +762 -0
  17. masster/sample/load.py +1220 -1187
  18. masster/sample/parameters.py +131 -131
  19. masster/sample/plot.py +1610 -1622
  20. masster/sample/processing.py +1402 -1416
  21. masster/sample/quant.py +209 -0
  22. masster/sample/sample.py +391 -387
  23. masster/sample/sample5_schema.json +181 -181
  24. masster/sample/save.py +737 -719
  25. masster/sample/sciex.py +1213 -0
  26. masster/spectrum.py +1287 -1319
  27. masster/study/__init__.py +9 -9
  28. masster/study/defaults/__init__.py +21 -19
  29. masster/study/defaults/align_def.py +267 -267
  30. masster/study/defaults/export_def.py +41 -40
  31. masster/study/defaults/fill_chrom_def.py +264 -264
  32. masster/study/defaults/fill_def.py +260 -0
  33. masster/study/defaults/find_consensus_def.py +256 -256
  34. masster/study/defaults/find_ms2_def.py +163 -163
  35. masster/study/defaults/integrate_chrom_def.py +225 -225
  36. masster/study/defaults/integrate_def.py +221 -0
  37. masster/study/defaults/merge_def.py +256 -0
  38. masster/study/defaults/study_def.py +272 -269
  39. masster/study/export.py +674 -287
  40. masster/study/h5.py +1398 -886
  41. masster/study/helpers.py +1650 -433
  42. masster/study/helpers_optimized.py +317 -0
  43. masster/study/load.py +1201 -1078
  44. masster/study/parameters.py +99 -99
  45. masster/study/plot.py +632 -645
  46. masster/study/processing.py +1057 -1046
  47. masster/study/save.py +149 -134
  48. masster/study/study.py +606 -522
  49. masster/study/study5_schema.json +247 -241
  50. {masster-0.2.4.dist-info → masster-0.3.0.dist-info}/METADATA +15 -10
  51. masster-0.3.0.dist-info/RECORD +59 -0
  52. {masster-0.2.4.dist-info → masster-0.3.0.dist-info}/licenses/LICENSE +661 -661
  53. masster-0.2.4.dist-info/RECORD +0 -50
  54. {masster-0.2.4.dist-info → masster-0.3.0.dist-info}/WHEEL +0 -0
  55. {masster-0.2.4.dist-info → masster-0.3.0.dist-info}/entry_points.txt +0 -0
@@ -1,99 +1,99 @@
1
- """
2
- Study Parameters Module for study operations.
3
-
4
- This module contains parameter management functions for the Study class,
5
- similar to the sample parameters module but for study-level operations.
6
- """
7
-
8
- from __future__ import annotations
9
-
10
-
11
- def store_history(self, keys, value):
12
- """
13
- Store parameters in a nested dictionary structure.
14
-
15
- Parameters:
16
- keys (list): List of keys to identify the position in nested dicts
17
- value: The value to store (can be a parameter object, dict, or any other value)
18
- """
19
- if not isinstance(keys, list) or len(keys) == 0:
20
- raise ValueError("keys must be a non-empty list")
21
-
22
- # Initialize self.history if it doesn't exist
23
- if not hasattr(self, "history"):
24
- self.history = {}
25
-
26
- # Navigate to the target location, creating nested dicts as needed
27
- current_dict = self.history
28
- for key in keys[:-1]:
29
- if key not in current_dict:
30
- current_dict[key] = {}
31
- elif not isinstance(current_dict[key], dict):
32
- # If the existing value is not a dict, replace it with a dict
33
- current_dict[key] = {}
34
- current_dict = current_dict[key]
35
-
36
- # Store the value at the final key
37
- current_dict[keys[-1]] = value
38
-
39
-
40
- def get_parameters(self, keys):
41
- """
42
- Retrieve parameters from nested dictionary structure.
43
-
44
- Parameters:
45
- keys (list): List of keys to identify the position in nested dicts
46
-
47
- Returns:
48
- The value at the specified location, or None if not found
49
- """
50
- if not isinstance(keys, list) or len(keys) == 0:
51
- raise ValueError("keys must be a non-empty list")
52
-
53
- current_dict = self.parameters
54
- for key in keys:
55
- if isinstance(current_dict, dict) and key in current_dict:
56
- current_dict = current_dict[key]
57
- else:
58
- return None
59
-
60
- return current_dict
61
-
62
-
63
- def update_parameters(self, **kwargs):
64
- """
65
- Update study parameters using the new parameter system.
66
-
67
- Parameters:
68
- **kwargs: Keyword arguments for parameter updates. Can include:
69
- - Study parameter defaults instances to set parameters
70
- - Individual parameter names and values
71
- """
72
- # Handle parameter overrides from kwargs
73
- for key, value in kwargs.items():
74
- # Check if it's a parameter defaults instance
75
- if hasattr(value, "to_dict") and callable(getattr(value, "to_dict")):
76
- # Store the parameter object
77
- self.store_history([key], value.to_dict())
78
- else:
79
- # Store individual parameter
80
- self.store_history([key], value)
81
-
82
-
83
- def get_parameters_property(self):
84
- """
85
- Property getter to provide backward compatibility for parameter access.
86
- Returns a dictionary that combines nested parameter objects.
87
- """
88
- # Create a combined view
89
- result = dict(self.parameters) if hasattr(self, "parameters") else {}
90
-
91
- return result
92
-
93
-
94
- def set_parameters_property(self, value):
95
- """Property setter to allow setting parameters for backward compatibility."""
96
- if isinstance(value, dict):
97
- self.parameters = value
98
- else:
99
- raise ValueError("parameters must be a dictionary")
1
+ """
2
+ Study Parameters Module for study operations.
3
+
4
+ This module contains parameter management functions for the Study class,
5
+ similar to the sample parameters module but for study-level operations.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+
11
+ def store_history(self, keys, value):
12
+ """
13
+ Store parameters in a nested dictionary structure.
14
+
15
+ Parameters:
16
+ keys (list): List of keys to identify the position in nested dicts
17
+ value: The value to store (can be a parameter object, dict, or any other value)
18
+ """
19
+ if not isinstance(keys, list) or len(keys) == 0:
20
+ raise ValueError("keys must be a non-empty list")
21
+
22
+ # Initialize self.history if it doesn't exist
23
+ if not hasattr(self, "history"):
24
+ self.history = {}
25
+
26
+ # Navigate to the target location, creating nested dicts as needed
27
+ current_dict = self.history
28
+ for key in keys[:-1]:
29
+ if key not in current_dict:
30
+ current_dict[key] = {}
31
+ elif not isinstance(current_dict[key], dict):
32
+ # If the existing value is not a dict, replace it with a dict
33
+ current_dict[key] = {}
34
+ current_dict = current_dict[key]
35
+
36
+ # Store the value at the final key
37
+ current_dict[keys[-1]] = value
38
+
39
+
40
+ def get_parameters(self, keys):
41
+ """
42
+ Retrieve parameters from nested dictionary structure.
43
+
44
+ Parameters:
45
+ keys (list): List of keys to identify the position in nested dicts
46
+
47
+ Returns:
48
+ The value at the specified location, or None if not found
49
+ """
50
+ if not isinstance(keys, list) or len(keys) == 0:
51
+ raise ValueError("keys must be a non-empty list")
52
+
53
+ current_dict = self.parameters
54
+ for key in keys:
55
+ if isinstance(current_dict, dict) and key in current_dict:
56
+ current_dict = current_dict[key]
57
+ else:
58
+ return None
59
+
60
+ return current_dict
61
+
62
+
63
+ def update_parameters(self, **kwargs):
64
+ """
65
+ Update study parameters using the new parameter system.
66
+
67
+ Parameters:
68
+ **kwargs: Keyword arguments for parameter updates. Can include:
69
+ - Study parameter defaults instances to set parameters
70
+ - Individual parameter names and values
71
+ """
72
+ # Handle parameter overrides from kwargs
73
+ for key, value in kwargs.items():
74
+ # Check if it's a parameter defaults instance
75
+ if hasattr(value, "to_dict") and callable(getattr(value, "to_dict")):
76
+ # Store the parameter object
77
+ self.store_history([key], value.to_dict())
78
+ else:
79
+ # Store individual parameter
80
+ self.store_history([key], value)
81
+
82
+
83
+ def get_parameters_property(self):
84
+ """
85
+ Property getter to provide backward compatibility for parameter access.
86
+ Returns a dictionary that combines nested parameter objects.
87
+ """
88
+ # Create a combined view
89
+ result = dict(self.parameters) if hasattr(self, "parameters") else {}
90
+
91
+ return result
92
+
93
+
94
+ def set_parameters_property(self, value):
95
+ """Property setter to allow setting parameters for backward compatibility."""
96
+ if isinstance(value, dict):
97
+ self.parameters = value
98
+ else:
99
+ raise ValueError("parameters must be a dictionary")