masster 0.4.0__py3-none-any.whl → 0.4.1__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.
- masster/__init__.py +8 -8
- masster/_version.py +1 -1
- masster/chromatogram.py +3 -9
- masster/data/libs/README.md +1 -1
- masster/data/libs/ccm.csv +120 -120
- masster/data/libs/ccm.py +116 -62
- masster/data/libs/central_carbon_README.md +1 -1
- masster/data/libs/urine.py +161 -65
- masster/data/libs/urine_metabolites.csv +4693 -4693
- masster/data/wiff/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.mzML +2 -2
- masster/logger.py +43 -78
- masster/sample/__init__.py +1 -1
- masster/sample/adducts.py +264 -338
- masster/sample/defaults/find_adducts_def.py +8 -21
- masster/sample/defaults/find_features_def.py +1 -6
- masster/sample/defaults/get_spectrum_def.py +1 -5
- masster/sample/defaults/sample_def.py +1 -5
- masster/sample/h5.py +282 -561
- masster/sample/helpers.py +75 -131
- masster/sample/lib.py +17 -42
- masster/sample/load.py +17 -31
- masster/sample/parameters.py +2 -6
- masster/sample/plot.py +27 -88
- masster/sample/processing.py +87 -117
- masster/sample/quant.py +51 -57
- masster/sample/sample.py +90 -103
- masster/sample/sample5_schema.json +44 -44
- masster/sample/save.py +12 -35
- masster/sample/sciex.py +19 -66
- masster/spectrum.py +20 -58
- masster/study/__init__.py +1 -1
- masster/study/defaults/align_def.py +1 -5
- masster/study/defaults/fill_chrom_def.py +1 -5
- masster/study/defaults/fill_def.py +1 -5
- masster/study/defaults/integrate_chrom_def.py +1 -5
- masster/study/defaults/integrate_def.py +1 -5
- masster/study/defaults/study_def.py +25 -58
- masster/study/export.py +207 -233
- masster/study/h5.py +136 -470
- masster/study/helpers.py +202 -495
- masster/study/helpers_optimized.py +13 -40
- masster/study/id.py +110 -213
- masster/study/load.py +143 -230
- masster/study/plot.py +257 -518
- masster/study/processing.py +257 -469
- masster/study/save.py +5 -15
- masster/study/study.py +276 -379
- masster/study/study5_schema.json +96 -96
- {masster-0.4.0.dist-info → masster-0.4.1.dist-info}/METADATA +1 -1
- masster-0.4.1.dist-info/RECORD +67 -0
- masster-0.4.0.dist-info/RECORD +0 -67
- {masster-0.4.0.dist-info → masster-0.4.1.dist-info}/WHEEL +0 -0
- {masster-0.4.0.dist-info → masster-0.4.1.dist-info}/entry_points.txt +0 -0
- {masster-0.4.0.dist-info → masster-0.4.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -92,9 +92,7 @@ def features_select_optimized(
|
|
|
92
92
|
if mz is not None:
|
|
93
93
|
if isinstance(mz, tuple) and len(mz) == 2:
|
|
94
94
|
min_mz, max_mz = mz
|
|
95
|
-
filter_conditions.append(
|
|
96
|
-
(pl.col("mz") >= min_mz) & (pl.col("mz") <= max_mz),
|
|
97
|
-
)
|
|
95
|
+
filter_conditions.append((pl.col("mz") >= min_mz) & (pl.col("mz") <= max_mz))
|
|
98
96
|
else:
|
|
99
97
|
filter_conditions.append(pl.col("mz") >= mz)
|
|
100
98
|
|
|
@@ -102,9 +100,7 @@ def features_select_optimized(
|
|
|
102
100
|
if rt is not None:
|
|
103
101
|
if isinstance(rt, tuple) and len(rt) == 2:
|
|
104
102
|
min_rt, max_rt = rt
|
|
105
|
-
filter_conditions.append(
|
|
106
|
-
(pl.col("rt") >= min_rt) & (pl.col("rt") <= max_rt),
|
|
107
|
-
)
|
|
103
|
+
filter_conditions.append((pl.col("rt") >= min_rt) & (pl.col("rt") <= max_rt))
|
|
108
104
|
else:
|
|
109
105
|
filter_conditions.append(pl.col("rt") >= rt)
|
|
110
106
|
|
|
@@ -112,9 +108,7 @@ def features_select_optimized(
|
|
|
112
108
|
if inty is not None:
|
|
113
109
|
if isinstance(inty, tuple) and len(inty) == 2:
|
|
114
110
|
min_inty, max_inty = inty
|
|
115
|
-
filter_conditions.append(
|
|
116
|
-
(pl.col("inty") >= min_inty) & (pl.col("inty") <= max_inty),
|
|
117
|
-
)
|
|
111
|
+
filter_conditions.append((pl.col("inty") >= min_inty) & (pl.col("inty") <= max_inty))
|
|
118
112
|
else:
|
|
119
113
|
filter_conditions.append(pl.col("inty") >= inty)
|
|
120
114
|
|
|
@@ -124,10 +118,7 @@ def features_select_optimized(
|
|
|
124
118
|
if len(sample_uid) == 2 and not isinstance(sample_uid, list):
|
|
125
119
|
# Treat as range
|
|
126
120
|
min_uid, max_uid = sample_uid
|
|
127
|
-
filter_conditions.append(
|
|
128
|
-
(pl.col("sample_uid") >= min_uid)
|
|
129
|
-
& (pl.col("sample_uid") <= max_uid),
|
|
130
|
-
)
|
|
121
|
+
filter_conditions.append((pl.col("sample_uid") >= min_uid) & (pl.col("sample_uid") <= max_uid))
|
|
131
122
|
else:
|
|
132
123
|
# Treat as list
|
|
133
124
|
filter_conditions.append(pl.col("sample_uid").is_in(sample_uid))
|
|
@@ -157,10 +148,7 @@ def features_select_optimized(
|
|
|
157
148
|
if len(consensus_uid) == 2 and not isinstance(consensus_uid, list):
|
|
158
149
|
# Treat as range
|
|
159
150
|
min_uid, max_uid = consensus_uid
|
|
160
|
-
filter_conditions.append(
|
|
161
|
-
(pl.col("consensus_uid") >= min_uid)
|
|
162
|
-
& (pl.col("consensus_uid") <= max_uid),
|
|
163
|
-
)
|
|
151
|
+
filter_conditions.append((pl.col("consensus_uid") >= min_uid) & (pl.col("consensus_uid") <= max_uid))
|
|
164
152
|
else:
|
|
165
153
|
# Treat as list
|
|
166
154
|
filter_conditions.append(pl.col("consensus_uid").is_in(consensus_uid))
|
|
@@ -173,10 +161,7 @@ def features_select_optimized(
|
|
|
173
161
|
if len(feature_uid) == 2 and not isinstance(feature_uid, list):
|
|
174
162
|
# Treat as range
|
|
175
163
|
min_uid, max_uid = feature_uid
|
|
176
|
-
filter_conditions.append(
|
|
177
|
-
(pl.col("feature_uid") >= min_uid)
|
|
178
|
-
& (pl.col("feature_uid") <= max_uid),
|
|
179
|
-
)
|
|
164
|
+
filter_conditions.append((pl.col("feature_uid") >= min_uid) & (pl.col("feature_uid") <= max_uid))
|
|
180
165
|
else:
|
|
181
166
|
# Treat as list
|
|
182
167
|
filter_conditions.append(pl.col("feature_uid").is_in(feature_uid))
|
|
@@ -198,10 +183,7 @@ def features_select_optimized(
|
|
|
198
183
|
if "quality" in available_columns:
|
|
199
184
|
if isinstance(quality, tuple) and len(quality) == 2:
|
|
200
185
|
min_quality, max_quality = quality
|
|
201
|
-
filter_conditions.append(
|
|
202
|
-
(pl.col("quality") >= min_quality)
|
|
203
|
-
& (pl.col("quality") <= max_quality),
|
|
204
|
-
)
|
|
186
|
+
filter_conditions.append((pl.col("quality") >= min_quality) & (pl.col("quality") <= max_quality))
|
|
205
187
|
else:
|
|
206
188
|
filter_conditions.append(pl.col("quality") >= quality)
|
|
207
189
|
else:
|
|
@@ -213,8 +195,7 @@ def features_select_optimized(
|
|
|
213
195
|
if isinstance(chrom_coherence, tuple) and len(chrom_coherence) == 2:
|
|
214
196
|
min_coherence, max_coherence = chrom_coherence
|
|
215
197
|
filter_conditions.append(
|
|
216
|
-
(pl.col("chrom_coherence") >= min_coherence)
|
|
217
|
-
& (pl.col("chrom_coherence") <= max_coherence),
|
|
198
|
+
(pl.col("chrom_coherence") >= min_coherence) & (pl.col("chrom_coherence") <= max_coherence),
|
|
218
199
|
)
|
|
219
200
|
else:
|
|
220
201
|
filter_conditions.append(pl.col("chrom_coherence") >= chrom_coherence)
|
|
@@ -227,8 +208,7 @@ def features_select_optimized(
|
|
|
227
208
|
if isinstance(chrom_prominence, tuple) and len(chrom_prominence) == 2:
|
|
228
209
|
min_prominence, max_prominence = chrom_prominence
|
|
229
210
|
filter_conditions.append(
|
|
230
|
-
(pl.col("chrom_prominence") >= min_prominence)
|
|
231
|
-
& (pl.col("chrom_prominence") <= max_prominence),
|
|
211
|
+
(pl.col("chrom_prominence") >= min_prominence) & (pl.col("chrom_prominence") <= max_prominence),
|
|
232
212
|
)
|
|
233
213
|
else:
|
|
234
214
|
filter_conditions.append(pl.col("chrom_prominence") >= chrom_prominence)
|
|
@@ -238,19 +218,14 @@ def features_select_optimized(
|
|
|
238
218
|
# Filter by scaled chromatogram prominence
|
|
239
219
|
if chrom_prominence_scaled is not None:
|
|
240
220
|
if "chrom_prominence_scaled" in available_columns:
|
|
241
|
-
if (
|
|
242
|
-
isinstance(chrom_prominence_scaled, tuple)
|
|
243
|
-
and len(chrom_prominence_scaled) == 2
|
|
244
|
-
):
|
|
221
|
+
if isinstance(chrom_prominence_scaled, tuple) and len(chrom_prominence_scaled) == 2:
|
|
245
222
|
min_prominence_scaled, max_prominence_scaled = chrom_prominence_scaled
|
|
246
223
|
filter_conditions.append(
|
|
247
224
|
(pl.col("chrom_prominence_scaled") >= min_prominence_scaled)
|
|
248
225
|
& (pl.col("chrom_prominence_scaled") <= max_prominence_scaled),
|
|
249
226
|
)
|
|
250
227
|
else:
|
|
251
|
-
filter_conditions.append(
|
|
252
|
-
pl.col("chrom_prominence_scaled") >= chrom_prominence_scaled,
|
|
253
|
-
)
|
|
228
|
+
filter_conditions.append(pl.col("chrom_prominence_scaled") >= chrom_prominence_scaled)
|
|
254
229
|
else:
|
|
255
230
|
warnings.append("'chrom_prominence_scaled' column not found in features_df")
|
|
256
231
|
|
|
@@ -264,9 +239,7 @@ def features_select_optimized(
|
|
|
264
239
|
& (pl.col("chrom_height_scaled") <= max_height_scaled),
|
|
265
240
|
)
|
|
266
241
|
else:
|
|
267
|
-
filter_conditions.append(
|
|
268
|
-
pl.col("chrom_height_scaled") >= chrom_height_scaled,
|
|
269
|
-
)
|
|
242
|
+
filter_conditions.append(pl.col("chrom_height_scaled") >= chrom_height_scaled)
|
|
270
243
|
else:
|
|
271
244
|
warnings.append("'chrom_height_scaled' column not found in features_df")
|
|
272
245
|
|
|
@@ -372,7 +345,7 @@ def monkey_patch_study():
|
|
|
372
345
|
|
|
373
346
|
Call this function to replace the original features_select with the optimized version.
|
|
374
347
|
"""
|
|
375
|
-
from
|
|
348
|
+
from masster.study.study import Study
|
|
376
349
|
|
|
377
350
|
# Store original method for benchmarking
|
|
378
351
|
Study.features_select_original = Study.features_select
|