masster 0.4.3__py3-none-any.whl → 0.4.5__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.
- masster/__init__.py +8 -8
- masster/_version.py +1 -1
- masster/chromatogram.py +1 -1
- masster/data/dda/20250530_VH_IQX_KW_RP_HSST3_100mm_12min_pos_v4_DDA_OT_C-MiLUT_QC_dil2_01_20250602151849.sample5 +0 -0
- masster/data/dda/20250530_VH_IQX_KW_RP_HSST3_100mm_12min_pos_v4_DDA_OT_C-MiLUT_QC_dil3_01_20250602150634.sample5 +0 -0
- masster/data/dda/20250530_VH_IQX_KW_RP_HSST3_100mm_12min_pos_v4_MS1_C-MiLUT_C008_v6_r38_01.sample5 +0 -0
- masster/data/dda/20250530_VH_IQX_KW_RP_HSST3_100mm_12min_pos_v4_MS1_C-MiLUT_C008_v7_r37_01.sample5 +0 -0
- masster/data/dda/20250530_VH_IQX_KW_RP_HSST3_100mm_12min_pos_v4_MS1_C-MiLUT_C017_v5_r99_01.sample5 +0 -0
- masster/data/libs/__pycache__/ccm.cpython-312.pyc +0 -0
- masster/data/libs/__pycache__/urine.cpython-312.pyc +0 -0
- masster/data/libs/ccm.csv +120 -0
- masster/data/libs/urine.csv +4693 -0
- masster/data/wiff/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.timeseries.data +0 -0
- masster/data/wiff/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.wiff +0 -0
- masster/data/wiff/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.wiff.scan +0 -0
- masster/data/wiff/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.wiff2 +0 -0
- masster/logger.py +11 -11
- masster/sample/__init__.py +1 -1
- masster/sample/adducts.py +338 -264
- masster/sample/defaults/find_adducts_def.py +21 -8
- masster/sample/h5.py +561 -282
- masster/sample/helpers.py +131 -75
- masster/sample/lib.py +4 -4
- masster/sample/load.py +31 -17
- masster/sample/parameters.py +1 -1
- masster/sample/plot.py +7 -7
- masster/sample/processing.py +117 -87
- masster/sample/sample.py +103 -90
- masster/sample/sample5_schema.json +196 -0
- masster/sample/save.py +35 -12
- masster/spectrum.py +1 -1
- masster/study/__init__.py +1 -1
- masster/study/defaults/align_def.py +5 -1
- masster/study/defaults/identify_def.py +3 -1
- masster/study/defaults/study_def.py +58 -25
- masster/study/export.py +360 -210
- masster/study/h5.py +560 -158
- masster/study/helpers.py +496 -203
- masster/study/helpers_optimized.py +1 -1
- masster/study/id.py +538 -349
- masster/study/load.py +233 -143
- masster/study/plot.py +71 -71
- masster/study/processing.py +456 -254
- masster/study/save.py +15 -5
- masster/study/study.py +213 -131
- masster/study/study5_schema.json +360 -0
- masster-0.4.5.dist-info/METADATA +131 -0
- masster-0.4.5.dist-info/RECORD +71 -0
- masster-0.4.3.dist-info/METADATA +0 -791
- masster-0.4.3.dist-info/RECORD +0 -56
- {masster-0.4.3.dist-info → masster-0.4.5.dist-info}/WHEEL +0 -0
- {masster-0.4.3.dist-info → masster-0.4.5.dist-info}/entry_points.txt +0 -0
- {masster-0.4.3.dist-info → masster-0.4.5.dist-info}/licenses/LICENSE +0 -0
- {masster-0.4.3.dist-info → masster-0.4.5.dist-info}/top_level.txt +0 -0
|
@@ -33,7 +33,7 @@ class study_defaults:
|
|
|
33
33
|
|
|
34
34
|
eic_mz_tol: float = 0.01
|
|
35
35
|
eic_rt_tol: float = 10.0
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
polarity: str = "positive"
|
|
38
38
|
adducts: list[str] | None = None
|
|
39
39
|
adduct_min_probability: float = 0.04
|
|
@@ -54,7 +54,14 @@ class study_defaults:
|
|
|
54
54
|
"dtype": str,
|
|
55
55
|
"description": "Logging level to be set for the logger",
|
|
56
56
|
"default": "INFO",
|
|
57
|
-
"allowed_values": [
|
|
57
|
+
"allowed_values": [
|
|
58
|
+
"TRACE",
|
|
59
|
+
"DEBUG",
|
|
60
|
+
"INFO",
|
|
61
|
+
"WARNING",
|
|
62
|
+
"ERROR",
|
|
63
|
+
"CRITICAL",
|
|
64
|
+
],
|
|
58
65
|
},
|
|
59
66
|
"log_label": {
|
|
60
67
|
"dtype": "Optional[str]",
|
|
@@ -92,14 +99,19 @@ class study_defaults:
|
|
|
92
99
|
"default": ["H:+:0.8", "Na:+:0.1", "NH4:+:0.1"],
|
|
93
100
|
"examples": {
|
|
94
101
|
"positive": ["H:+:0.8", "Na:+:0.1", "NH4:+:0.1"],
|
|
95
|
-
"negative": [
|
|
102
|
+
"negative": [
|
|
103
|
+
"H-1:-:0.95",
|
|
104
|
+
"Cl:-:0.05",
|
|
105
|
+
"CH2O2:0:0.2",
|
|
106
|
+
"H-2-O:0:0.2",
|
|
107
|
+
],
|
|
96
108
|
},
|
|
97
109
|
"validation_rules": [
|
|
98
110
|
"Format: element:charge:probability",
|
|
99
111
|
"Charge must be +, -, or 0 (neutral)",
|
|
100
112
|
"Probability must be between 0.0 and 1.0",
|
|
101
|
-
"Sum of all charged adduct probabilities must equal 1.0"
|
|
102
|
-
]
|
|
113
|
+
"Sum of all charged adduct probabilities must equal 1.0",
|
|
114
|
+
],
|
|
103
115
|
},
|
|
104
116
|
"adduct_min_probability": {
|
|
105
117
|
"dtype": float,
|
|
@@ -116,54 +128,71 @@ class study_defaults:
|
|
|
116
128
|
"""Set polarity-specific defaults for adducts if not explicitly provided."""
|
|
117
129
|
# If adducts is None, set based on polarity
|
|
118
130
|
if self.adducts is None:
|
|
119
|
-
if self.polarity.lower() in [
|
|
120
|
-
self.adducts = [
|
|
121
|
-
|
|
122
|
-
|
|
131
|
+
if self.polarity.lower() in ["positive", "pos"]:
|
|
132
|
+
self.adducts = [
|
|
133
|
+
"+H:1:0.65",
|
|
134
|
+
"+Na:1:0.15",
|
|
135
|
+
"+NH4:1:0.15",
|
|
136
|
+
"+K:1:0.05",
|
|
137
|
+
"-H2O:0:0.15",
|
|
138
|
+
]
|
|
139
|
+
elif self.polarity.lower() in ["negative", "neg"]:
|
|
140
|
+
self.adducts = [
|
|
141
|
+
"-H:-1:0.9",
|
|
142
|
+
"+Cl:-1:0.1",
|
|
143
|
+
"+CH2O2:0:0.15",
|
|
144
|
+
"-H2O:0:0.15",
|
|
145
|
+
]
|
|
123
146
|
else:
|
|
124
147
|
# Default to positive if polarity is not recognized
|
|
125
|
-
self.adducts = [
|
|
148
|
+
self.adducts = [
|
|
149
|
+
"+H:1:0.65",
|
|
150
|
+
"+Na:1:0.15",
|
|
151
|
+
"+NH4:1:0.15",
|
|
152
|
+
"+K:1:0.05",
|
|
153
|
+
"-H2O:0:0.15",
|
|
154
|
+
]
|
|
126
155
|
|
|
127
156
|
def _validate_adducts(self, adduct_list: list[str]) -> bool:
|
|
128
157
|
"""
|
|
129
158
|
Validate adducts according to OpenMS convention.
|
|
130
|
-
|
|
159
|
+
|
|
131
160
|
Format: element:charge:probability
|
|
132
161
|
- Elements can be molecular formulas (e.g., H, Na, NH4, H-1, CH2O2)
|
|
133
162
|
- Charge must be +, -, or 0 (for neutral)
|
|
134
163
|
- Probability must be a float between 0 and 1
|
|
135
164
|
- Total probability of all charged adducts should sum to 1.0
|
|
136
|
-
|
|
165
|
+
|
|
137
166
|
Args:
|
|
138
167
|
adduct_list: List of adduct strings in OpenMS format
|
|
139
|
-
|
|
168
|
+
|
|
140
169
|
Returns:
|
|
141
170
|
True if all adducts are valid, False otherwise
|
|
142
171
|
"""
|
|
143
172
|
if not adduct_list: # Empty list is valid
|
|
144
173
|
return True
|
|
145
|
-
|
|
174
|
+
|
|
146
175
|
charged_total_prob = 0.0
|
|
147
176
|
neutral_total_prob = 0.0
|
|
148
|
-
|
|
177
|
+
|
|
149
178
|
for adduct in adduct_list:
|
|
150
179
|
if not isinstance(adduct, str):
|
|
151
180
|
return False
|
|
152
|
-
|
|
181
|
+
|
|
153
182
|
parts = adduct.split(":")
|
|
154
183
|
if len(parts) != 3:
|
|
155
184
|
return False
|
|
156
|
-
|
|
185
|
+
|
|
157
186
|
element, charge, prob_str = parts
|
|
158
|
-
|
|
187
|
+
|
|
159
188
|
# Validate element (non-empty string)
|
|
160
189
|
if not element:
|
|
161
190
|
return False
|
|
162
|
-
|
|
191
|
+
|
|
163
192
|
# Validate charge
|
|
164
193
|
if charge not in ["+", "-", "0"]:
|
|
165
194
|
return False
|
|
166
|
-
|
|
195
|
+
|
|
167
196
|
# Validate probability
|
|
168
197
|
try:
|
|
169
198
|
probability = float(prob_str)
|
|
@@ -171,20 +200,20 @@ class study_defaults:
|
|
|
171
200
|
return False
|
|
172
201
|
except (ValueError, TypeError):
|
|
173
202
|
return False
|
|
174
|
-
|
|
203
|
+
|
|
175
204
|
# Sum probabilities by charge type
|
|
176
205
|
if charge in ["+", "-"]:
|
|
177
206
|
charged_total_prob += probability
|
|
178
207
|
else: # charge == "0" (neutral)
|
|
179
208
|
neutral_total_prob += probability
|
|
180
|
-
|
|
209
|
+
|
|
181
210
|
# Validate probability constraints
|
|
182
211
|
# Charged adducts should sum to 1.0 (within tolerance)
|
|
183
212
|
if charged_total_prob > 0 and abs(charged_total_prob - 1.0) > 1e-6:
|
|
184
213
|
return False
|
|
185
|
-
|
|
214
|
+
|
|
186
215
|
# Neutral adducts can have any total probability (they're optional)
|
|
187
|
-
|
|
216
|
+
|
|
188
217
|
return True
|
|
189
218
|
|
|
190
219
|
def get_info(self, param_name: str) -> dict[str, Any]:
|
|
@@ -316,7 +345,11 @@ class study_defaults:
|
|
|
316
345
|
expected_dtype = self._param_metadata[param_name]["dtype"]
|
|
317
346
|
|
|
318
347
|
# Handle optional types
|
|
319
|
-
if
|
|
348
|
+
if (
|
|
349
|
+
isinstance(expected_dtype, str)
|
|
350
|
+
and expected_dtype.startswith("Optional")
|
|
351
|
+
and value is not None
|
|
352
|
+
):
|
|
320
353
|
if "int" in expected_dtype and not isinstance(value, int):
|
|
321
354
|
try:
|
|
322
355
|
value = int(value)
|