masster 0.3.15__py3-none-any.whl → 0.3.16__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/_version.py +1 -1
- masster/sample/h5.py +577 -0
- masster/sample/load.py +57 -0
- masster/sample/sample.py +4 -0
- masster/spectrum.py +3 -0
- masster/study/defaults/fill_def.py +3 -3
- masster/study/export.py +3 -0
- masster/study/load.py +565 -215
- masster/study/study.py +8 -0
- masster/study/study5_schema.json +3 -0
- {masster-0.3.15.dist-info → masster-0.3.16.dist-info}/METADATA +1 -1
- {masster-0.3.15.dist-info → masster-0.3.16.dist-info}/RECORD +15 -15
- {masster-0.3.15.dist-info → masster-0.3.16.dist-info}/WHEEL +0 -0
- {masster-0.3.15.dist-info → masster-0.3.16.dist-info}/entry_points.txt +0 -0
- {masster-0.3.15.dist-info → masster-0.3.16.dist-info}/licenses/LICENSE +0 -0
masster/sample/sample.py
CHANGED
|
@@ -49,6 +49,7 @@ from masster.sample.defaults.get_spectrum_def import get_spectrum_defaults
|
|
|
49
49
|
|
|
50
50
|
# Sample-specific imports
|
|
51
51
|
from masster.sample.h5 import _load_sample5
|
|
52
|
+
from masster.sample.h5 import _load_sample5_study
|
|
52
53
|
from masster.sample.h5 import _save_sample5
|
|
53
54
|
from masster.sample.helpers import _delete_ms2
|
|
54
55
|
from masster.sample.helpers import _estimate_memory_usage
|
|
@@ -72,6 +73,7 @@ from masster.sample.load import _load_wiff
|
|
|
72
73
|
from masster.sample.load import chrom_extract
|
|
73
74
|
from masster.sample.load import index_file
|
|
74
75
|
from masster.sample.load import load
|
|
76
|
+
from masster.sample.load import load_study
|
|
75
77
|
from masster.sample.load import sanitize
|
|
76
78
|
from masster.sample.plot import plot_2d
|
|
77
79
|
from masster.sample.plot import plot_2d_oracle
|
|
@@ -203,6 +205,7 @@ class Sample:
|
|
|
203
205
|
|
|
204
206
|
# Attach module functions as class methods
|
|
205
207
|
load = load
|
|
208
|
+
load_study = load_study
|
|
206
209
|
save = save
|
|
207
210
|
find_features = find_features
|
|
208
211
|
find_adducts = find_adducts
|
|
@@ -243,6 +246,7 @@ class Sample:
|
|
|
243
246
|
|
|
244
247
|
# Additional method assignments for all imported functions
|
|
245
248
|
_load_sample5 = _load_sample5
|
|
249
|
+
_load_sample5_study = _load_sample5_study
|
|
246
250
|
_save_sample5 = _save_sample5
|
|
247
251
|
_delete_ms2 = _delete_ms2
|
|
248
252
|
_estimate_memory_usage = _estimate_memory_usage
|
masster/spectrum.py
CHANGED
|
@@ -229,6 +229,9 @@ class Spectrum:
|
|
|
229
229
|
elif isinstance(value, (list, dict)):
|
|
230
230
|
# Create copies of mutable objects
|
|
231
231
|
result[key] = copy.deepcopy(value)
|
|
232
|
+
elif isinstance(value, np.number):
|
|
233
|
+
# Handle numpy scalar types (float32, int32, etc.)
|
|
234
|
+
result[key] = value.item()
|
|
232
235
|
else:
|
|
233
236
|
# Immutable objects can be copied directly
|
|
234
237
|
result[key] = value
|
|
@@ -23,7 +23,7 @@ class fill_defaults:
|
|
|
23
23
|
uids: Optional[list] = None
|
|
24
24
|
mz_tol: float = 0.010
|
|
25
25
|
rt_tol: float = 10.0
|
|
26
|
-
min_samples_rel: float = 0.
|
|
26
|
+
min_samples_rel: float = 0.00
|
|
27
27
|
min_samples_abs: int = 5
|
|
28
28
|
|
|
29
29
|
_param_metadata: dict[str, dict[str, Any]] = field(
|
|
@@ -37,7 +37,7 @@ class fill_defaults:
|
|
|
37
37
|
"dtype": float,
|
|
38
38
|
"description": "m/z tolerance for chromatogram extraction (Da)",
|
|
39
39
|
"default": 0.010,
|
|
40
|
-
"min_value": 0.
|
|
40
|
+
"min_value": 0.0002,
|
|
41
41
|
"max_value": 0.1,
|
|
42
42
|
},
|
|
43
43
|
"rt_tol": {
|
|
@@ -51,7 +51,7 @@ class fill_defaults:
|
|
|
51
51
|
"dtype": float,
|
|
52
52
|
"description": "Minimum relative samples threshold (fraction)",
|
|
53
53
|
"default": 0.05,
|
|
54
|
-
"min_value": 0.
|
|
54
|
+
"min_value": 0.0,
|
|
55
55
|
"max_value": 1.0,
|
|
56
56
|
},
|
|
57
57
|
"min_samples_abs": {
|
masster/study/export.py
CHANGED
|
@@ -180,6 +180,9 @@ def _get_mgf_df(self, **kwargs):
|
|
|
180
180
|
for e in energies:
|
|
181
181
|
cons_ms2_e = cons_ms2[cons_ms2["energy"] == e]
|
|
182
182
|
if selection == "best":
|
|
183
|
+
# Check if the filtered DataFrame is empty
|
|
184
|
+
if len(cons_ms2_e) == 0:
|
|
185
|
+
continue
|
|
183
186
|
idx = cons_ms2_e["prec_inty"].idxmax()
|
|
184
187
|
cons_ms2_e_row = cons_ms2_e.loc[idx]
|
|
185
188
|
spect = cons_ms2_e_row["spec"]
|