masster 0.3.13__py3-none-any.whl → 0.3.15__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/sample/helpers.py +9 -2
- masster/sample/load.py +11 -7
- masster/sample/plot.py +43 -34
- masster/study/defaults/study_def.py +20 -0
- masster/study/h5.py +120 -23
- masster/study/helpers.py +974 -13
- masster/study/load.py +28 -15
- masster/study/plot.py +270 -98
- masster/study/processing.py +9 -0
- masster/study/study.py +32 -38
- masster/study/study5_schema.json +14 -5
- {masster-0.3.13.dist-info → masster-0.3.15.dist-info}/METADATA +2 -1
- {masster-0.3.13.dist-info → masster-0.3.15.dist-info}/RECORD +16 -20
- masster/data/examples/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.featureXML +0 -199787
- masster/data/examples/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.sample5 +0 -0
- masster/docs/SCX_API_Documentation.md +0 -0
- masster/docs/SCX_DLL_Analysis.md +0 -0
- {masster-0.3.13.dist-info → masster-0.3.15.dist-info}/WHEEL +0 -0
- {masster-0.3.13.dist-info → masster-0.3.15.dist-info}/entry_points.txt +0 -0
- {masster-0.3.13.dist-info → masster-0.3.15.dist-info}/licenses/LICENSE +0 -0
masster/study/load.py
CHANGED
|
@@ -71,11 +71,8 @@ def add(
|
|
|
71
71
|
|
|
72
72
|
# Build search pattern
|
|
73
73
|
if any(char in folder for char in ["*", "?", "[", "]"]):
|
|
74
|
-
# If folder already contains glob patterns,
|
|
75
|
-
|
|
76
|
-
pattern = folder.replace("*.sample5", f"*{ext}")
|
|
77
|
-
else:
|
|
78
|
-
pattern = os.path.join(search_folder, "**", f"*{ext}")
|
|
74
|
+
# If folder already contains glob patterns, use it as-is
|
|
75
|
+
pattern = folder
|
|
79
76
|
else:
|
|
80
77
|
pattern = os.path.join(search_folder, "**", f"*{ext}")
|
|
81
78
|
|
|
@@ -187,7 +184,9 @@ def add_sample(self, file, type=None, reset=False, adducts=None):
|
|
|
187
184
|
sample_type = "qc"
|
|
188
185
|
if "blank" in sample_name.lower():
|
|
189
186
|
sample_type = "blank"
|
|
190
|
-
|
|
187
|
+
|
|
188
|
+
# Use the index of the feature map in self.features_maps as map_id
|
|
189
|
+
map_id_value = len(self.features_maps) - 1
|
|
191
190
|
|
|
192
191
|
# Determine the final sample path based on file type
|
|
193
192
|
if file.endswith(".sample5"):
|
|
@@ -222,28 +221,39 @@ def add_sample(self, file, type=None, reset=False, adducts=None):
|
|
|
222
221
|
ms1_count = int(ddaobj.scans_df.filter(pl.col("ms_level") == 1).height)
|
|
223
222
|
ms2_count = int(ddaobj.scans_df.filter(pl.col("ms_level") == 2).height)
|
|
224
223
|
|
|
224
|
+
# Calculate next sequence number
|
|
225
|
+
next_sequence = len(self.samples_df) + 1 if not self.samples_df.is_empty() else 1
|
|
226
|
+
|
|
225
227
|
new_sample = pl.DataFrame(
|
|
226
228
|
{
|
|
227
229
|
"sample_uid": [int(len(self.samples_df) + 1)],
|
|
228
230
|
"sample_name": [sample_name],
|
|
229
231
|
"sample_path": [final_sample_path], # Use the determined path
|
|
230
232
|
"sample_type": [sample_type],
|
|
231
|
-
"size": [int(ddaobj.features.size())],
|
|
232
233
|
"map_id": [map_id_value],
|
|
233
|
-
"
|
|
234
|
-
"
|
|
235
|
-
"
|
|
234
|
+
"sample_source": [getattr(ddaobj, "file_source", file)],
|
|
235
|
+
"sample_color": [None], # Will be set by set_sample_color below
|
|
236
|
+
"sample_group": [""], # Default empty string
|
|
237
|
+
"sample_batch": [1], # Default batch 1
|
|
238
|
+
"sample_sequence": [next_sequence], # Increasing sequence number
|
|
239
|
+
"num_features": [int(ddaobj.features.size())],
|
|
240
|
+
"num_ms1": [ms1_count],
|
|
241
|
+
"num_ms2": [ms2_count],
|
|
236
242
|
},
|
|
237
243
|
schema={
|
|
238
244
|
"sample_uid": pl.Int64,
|
|
239
245
|
"sample_name": pl.Utf8,
|
|
240
246
|
"sample_path": pl.Utf8,
|
|
241
247
|
"sample_type": pl.Utf8,
|
|
242
|
-
"
|
|
243
|
-
"
|
|
244
|
-
"
|
|
245
|
-
"
|
|
246
|
-
"
|
|
248
|
+
"map_id": pl.Int64,
|
|
249
|
+
"sample_source": pl.Utf8,
|
|
250
|
+
"sample_color": pl.Utf8,
|
|
251
|
+
"sample_group": pl.Utf8,
|
|
252
|
+
"sample_batch": pl.Int64,
|
|
253
|
+
"sample_sequence": pl.Int64,
|
|
254
|
+
"num_features": pl.Int64,
|
|
255
|
+
"num_ms1": pl.Int64,
|
|
256
|
+
"num_ms2": pl.Int64,
|
|
247
257
|
},
|
|
248
258
|
)
|
|
249
259
|
self.samples_df = pl.concat([self.samples_df, new_sample])
|
|
@@ -309,6 +319,9 @@ def add_sample(self, file, type=None, reset=False, adducts=None):
|
|
|
309
319
|
# Ensure features_df column order matches schema
|
|
310
320
|
self._ensure_features_df_schema_order()
|
|
311
321
|
|
|
322
|
+
# Auto-assign colors when new sample is added (reset all colors using turbo colormap based on UID)
|
|
323
|
+
self.sample_color_reset()
|
|
324
|
+
|
|
312
325
|
self.logger.debug(
|
|
313
326
|
f"Added sample {sample_name} with {ddaobj.features.size()} features to the study.",
|
|
314
327
|
)
|