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/processing.py
CHANGED
|
@@ -683,6 +683,15 @@ def merge(self, **kwargs):
|
|
|
683
683
|
min_samples = 1
|
|
684
684
|
if min_samples < 1:
|
|
685
685
|
min_samples = int(min_samples * len(self.samples_df))
|
|
686
|
+
|
|
687
|
+
# Validate that min_samples doesn't exceed the number of samples
|
|
688
|
+
if min_samples > len(self.samples_df):
|
|
689
|
+
self.logger.warning(
|
|
690
|
+
f"min_samples ({min_samples}) exceeds the number of samples ({len(self.samples_df)}). "
|
|
691
|
+
f"Setting min_samples to {len(self.samples_df)}."
|
|
692
|
+
)
|
|
693
|
+
min_samples = len(self.samples_df)
|
|
694
|
+
|
|
686
695
|
# filter out consensus features with less than min_samples features
|
|
687
696
|
l1 = len(self.consensus_df)
|
|
688
697
|
self.consensus_df = self.consensus_df.filter(
|
masster/study/study.py
CHANGED
|
@@ -59,6 +59,7 @@ from masster.study.h5 import _save_study5_compressed
|
|
|
59
59
|
from masster.study.helpers import _get_consensus_uids
|
|
60
60
|
from masster.study.helpers import _get_feature_uids
|
|
61
61
|
from masster.study.helpers import _get_sample_uids
|
|
62
|
+
from masster.study.helpers import _ensure_features_df_schema_order
|
|
62
63
|
from masster.study.helpers import compress
|
|
63
64
|
from masster.study.helpers import compress_features
|
|
64
65
|
from masster.study.helpers import compress_ms2
|
|
@@ -77,14 +78,19 @@ from masster.study.helpers import get_gaps_stats
|
|
|
77
78
|
from masster.study.helpers import align_reset
|
|
78
79
|
from masster.study.helpers import set_folder
|
|
79
80
|
from masster.study.helpers import set_source
|
|
80
|
-
from masster.study.helpers import
|
|
81
|
-
from masster.study.helpers import
|
|
81
|
+
from masster.study.helpers import sample_color
|
|
82
|
+
from masster.study.helpers import sample_color_reset
|
|
83
|
+
from masster.study.helpers import sample_name_replace
|
|
84
|
+
from masster.study.helpers import sample_name_reset
|
|
85
|
+
from masster.study.helpers import samples_select
|
|
86
|
+
from masster.study.helpers import samples_delete
|
|
82
87
|
from masster.study.helpers import features_select
|
|
83
88
|
from masster.study.helpers import features_filter
|
|
84
89
|
from masster.study.helpers import features_delete
|
|
85
90
|
from masster.study.helpers import consensus_select
|
|
86
91
|
from masster.study.helpers import consensus_filter
|
|
87
92
|
from masster.study.helpers import consensus_delete
|
|
93
|
+
from masster.study.helpers import migrate_map_id_to_index
|
|
88
94
|
from masster.study.load import add
|
|
89
95
|
from masster.study.load import add_sample
|
|
90
96
|
from masster.study.load import fill_single
|
|
@@ -276,22 +282,30 @@ class Study:
|
|
|
276
282
|
"sample_name": [],
|
|
277
283
|
"sample_path": [],
|
|
278
284
|
"sample_type": [],
|
|
279
|
-
"size": [],
|
|
280
285
|
"map_id": [],
|
|
281
|
-
"
|
|
282
|
-
"
|
|
283
|
-
"
|
|
286
|
+
"sample_source": [],
|
|
287
|
+
"sample_color": [],
|
|
288
|
+
"sample_group": [],
|
|
289
|
+
"sample_batch": [],
|
|
290
|
+
"sample_sequence": [],
|
|
291
|
+
"num_features": [],
|
|
292
|
+
"num_ms1": [],
|
|
293
|
+
"num_ms2": [],
|
|
284
294
|
},
|
|
285
295
|
schema={
|
|
286
296
|
"sample_uid": pl.Int64,
|
|
287
297
|
"sample_name": pl.Utf8,
|
|
288
298
|
"sample_path": pl.Utf8,
|
|
289
299
|
"sample_type": pl.Utf8,
|
|
290
|
-
"
|
|
291
|
-
"
|
|
292
|
-
"
|
|
293
|
-
"
|
|
294
|
-
"
|
|
300
|
+
"map_id": pl.Int64,
|
|
301
|
+
"sample_source": pl.Utf8,
|
|
302
|
+
"sample_color": pl.Utf8,
|
|
303
|
+
"sample_group": pl.Utf8,
|
|
304
|
+
"sample_batch": pl.Int64,
|
|
305
|
+
"sample_sequence": pl.Int64,
|
|
306
|
+
"num_features": pl.Int64,
|
|
307
|
+
"num_ms1": pl.Int64,
|
|
308
|
+
"num_ms2": pl.Int64,
|
|
295
309
|
},
|
|
296
310
|
)
|
|
297
311
|
self.features_maps = []
|
|
@@ -362,8 +376,12 @@ class Study:
|
|
|
362
376
|
fill_reset = fill_reset
|
|
363
377
|
align_reset = align_reset
|
|
364
378
|
set_source = set_source
|
|
365
|
-
|
|
366
|
-
|
|
379
|
+
sample_color = sample_color
|
|
380
|
+
sample_color_reset = sample_color_reset
|
|
381
|
+
name_replace = sample_name_replace
|
|
382
|
+
name_reset = sample_name_reset
|
|
383
|
+
samples_select = samples_select
|
|
384
|
+
samples_delete = samples_delete
|
|
367
385
|
features_select = features_select
|
|
368
386
|
features_filter = features_filter
|
|
369
387
|
features_delete = features_delete
|
|
@@ -387,6 +405,7 @@ class Study:
|
|
|
387
405
|
_get_consensus_uids = _get_consensus_uids
|
|
388
406
|
_get_feature_uids = _get_feature_uids
|
|
389
407
|
_get_sample_uids = _get_sample_uids
|
|
408
|
+
_ensure_features_df_schema_order = _ensure_features_df_schema_order
|
|
390
409
|
get_consensus_matrix = get_consensus_matrix
|
|
391
410
|
get_gaps_matrix = get_gaps_matrix
|
|
392
411
|
get_gaps_stats = get_gaps_stats
|
|
@@ -685,31 +704,6 @@ class Study:
|
|
|
685
704
|
|
|
686
705
|
print(summary)
|
|
687
706
|
|
|
688
|
-
def _ensure_features_df_schema_order(self):
|
|
689
|
-
"""
|
|
690
|
-
Ensure features_df columns are ordered according to study5_schema.json.
|
|
691
|
-
|
|
692
|
-
This method should be called after operations that might scramble the column order.
|
|
693
|
-
"""
|
|
694
|
-
if self.features_df is None or self.features_df.is_empty():
|
|
695
|
-
return
|
|
696
|
-
|
|
697
|
-
try:
|
|
698
|
-
import os
|
|
699
|
-
import json
|
|
700
|
-
from masster.study.h5 import _reorder_columns_by_schema
|
|
701
|
-
|
|
702
|
-
# Load schema
|
|
703
|
-
schema_path = os.path.join(os.path.dirname(__file__), "study5_schema.json")
|
|
704
|
-
with open(schema_path, 'r') as f:
|
|
705
|
-
schema = json.load(f)
|
|
706
|
-
|
|
707
|
-
# Reorder columns to match schema
|
|
708
|
-
self.features_df = _reorder_columns_by_schema(self.features_df, schema, 'features_df')
|
|
709
|
-
|
|
710
|
-
except Exception as e:
|
|
711
|
-
self.logger.warning(f"Failed to reorder features_df columns: {e}")
|
|
712
|
-
|
|
713
707
|
|
|
714
708
|
if __name__ == "__main__":
|
|
715
709
|
# This block is executed when the script is run directly
|
masster/study/study5_schema.json
CHANGED
|
@@ -225,9 +225,9 @@
|
|
|
225
225
|
"dtype": "pl.Int64"
|
|
226
226
|
},
|
|
227
227
|
"map_id": {
|
|
228
|
-
"dtype": "pl.
|
|
228
|
+
"dtype": "pl.Int64"
|
|
229
229
|
},
|
|
230
|
-
"
|
|
230
|
+
"sample_source": {
|
|
231
231
|
"dtype": "pl.Utf8"
|
|
232
232
|
},
|
|
233
233
|
"sample_name": {
|
|
@@ -239,13 +239,22 @@
|
|
|
239
239
|
"sample_type": {
|
|
240
240
|
"dtype": "pl.Utf8"
|
|
241
241
|
},
|
|
242
|
-
"
|
|
242
|
+
"sample_group": {
|
|
243
|
+
"dtype": "pl.Utf8"
|
|
244
|
+
},
|
|
245
|
+
"sample_batch": {
|
|
246
|
+
"dtype": "pl.Int64"
|
|
247
|
+
},
|
|
248
|
+
"sample_sequence": {
|
|
249
|
+
"dtype": "pl.Int64"
|
|
250
|
+
},
|
|
251
|
+
"num_features": {
|
|
243
252
|
"dtype": "pl.Int64"
|
|
244
253
|
},
|
|
245
|
-
"
|
|
254
|
+
"num_ms1": {
|
|
246
255
|
"dtype": "pl.Int64"
|
|
247
256
|
},
|
|
248
|
-
"
|
|
257
|
+
"num_ms2": {
|
|
249
258
|
"dtype": "pl.Int64"
|
|
250
259
|
}
|
|
251
260
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: masster
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.15
|
|
4
4
|
Summary: Mass spectrometry data analysis package
|
|
5
5
|
Project-URL: homepage, https://github.com/zamboni-lab/masster
|
|
6
6
|
Project-URL: repository, https://github.com/zamboni-lab/masster
|
|
@@ -684,6 +684,7 @@ Requires-Dist: alphabase>=1.0.0
|
|
|
684
684
|
Requires-Dist: alpharaw>=0.4.8
|
|
685
685
|
Requires-Dist: altair>=5.5.0
|
|
686
686
|
Requires-Dist: bokeh>=3.7.3
|
|
687
|
+
Requires-Dist: cmap>=0.6.2
|
|
687
688
|
Requires-Dist: datashader>=0.18.1
|
|
688
689
|
Requires-Dist: h5py>=3.14.0
|
|
689
690
|
Requires-Dist: holoviews>=1.21.0
|
|
@@ -3,22 +3,18 @@ masster/_version.py,sha256=ioQa4W_2pWdKSoU7hw7Pn6WMBm3nMuuLKfSR4f8171A,256
|
|
|
3
3
|
masster/chromatogram.py,sha256=NgPr1uLGJHjRu6PWZZGOrS3pCl7sye1yQCJjlRi9ZSY,19305
|
|
4
4
|
masster/logger.py,sha256=W50V_uh8RSYwGxDrDFhOuj5jpu2tKJyt_16lMw9kQwA,14755
|
|
5
5
|
masster/spectrum.py,sha256=LuDa7qP_JInctzkmxC9c5468opHOholy321KpUgyW2U,47550
|
|
6
|
-
masster/data/examples/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.featureXML,sha256=033IjCWBaYVymnPhVHneytilC-XIa6T-6wkeBB0BXvc,10980374
|
|
7
6
|
masster/data/examples/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.mzML,sha256=3RS_crLN-aoPSacMYaQ45sxszmp_EcQElrg8tiuAQyA,39741920
|
|
8
|
-
masster/data/examples/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.sample5,sha256=T3LxClfe3Uaqx4Rb7lY57e2uWpuJHzPy-VEl3cy4b7k,11109448
|
|
9
7
|
masster/data/examples/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.timeseries.data,sha256=01vC6m__Qqm2rLvlTMZoeKIKowFvovBTUnrNl8Uav3E,24576
|
|
10
8
|
masster/data/examples/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.wiff,sha256=go5N9gAM1rn4PZAVaoCmdteY9f7YGEM9gyPdSmkQ8PE,1447936
|
|
11
9
|
masster/data/examples/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.wiff.scan,sha256=ahi1Y3UhAj9Bj4Q2MlbgPekNdkJvMOoMXVOoR6CeIxc,13881220
|
|
12
10
|
masster/data/examples/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.wiff2,sha256=TFB0HW4Agkig6yht7FtgjUdbXax8jjKaHpSZSvuU5vs,3252224
|
|
13
|
-
masster/docs/SCX_API_Documentation.md,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
-
masster/docs/SCX_DLL_Analysis.md,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
11
|
masster/sample/__init__.py,sha256=HL0m1ept0PMAYUCQtDDnkdOS12IFl6oLAq4TZQz83uY,170
|
|
16
12
|
masster/sample/h5.py,sha256=IdfbdkDgKcij-jMQTxnjW-gsBhb6vwi8w1XXL795yEs,63793
|
|
17
|
-
masster/sample/helpers.py,sha256=
|
|
13
|
+
masster/sample/helpers.py,sha256=ThmabX_-gXxLFyok-mYMNOr5JErIO_zcrIHwqovXE1c,36541
|
|
18
14
|
masster/sample/lib.py,sha256=l5YdU9TxEWJI0kJxXxrRCxgDDwbzO5zBf1_Qi_HY87w,33556
|
|
19
|
-
masster/sample/load.py,sha256=
|
|
15
|
+
masster/sample/load.py,sha256=jeGP-f4nYDJlDt4MoqVEYXJ7ZQEwV8ZtM34S1ATEaNc,47774
|
|
20
16
|
masster/sample/parameters.py,sha256=Gg2KcuNbV_wZ_Wwv93QlM5J19ji0oSIvZLPV1NoBmq0,4456
|
|
21
|
-
masster/sample/plot.py,sha256=
|
|
17
|
+
masster/sample/plot.py,sha256=mXrQbgBfMhXtfat_xAuliyXNTanW_kezq4hmWQYtFiQ,78445
|
|
22
18
|
masster/sample/processing.py,sha256=-H93MEUysA-B9PB4nU31WFjtaU_flqbu2gY35ce4vVs,57827
|
|
23
19
|
masster/sample/quant.py,sha256=tHNjvUFTdehKR31BXBZnVsBxMD9XJHgaltITOjr71uE,7562
|
|
24
20
|
masster/sample/sample.py,sha256=QxKjXPO5lWRrIq5eDsYzNQPjp0zI_vuPdPlRQe1y3uI,16925
|
|
@@ -33,16 +29,16 @@ masster/sample/defaults/get_spectrum_def.py,sha256=o62p31PhGd-LiIkTOzKQhwPtnO2At
|
|
|
33
29
|
masster/sample/defaults/sample_def.py,sha256=keoXyMyrm_iLgbYqfIbqCpJ3XHBVlNwCNmb5iMQL0iY,14579
|
|
34
30
|
masster/study/__init__.py,sha256=Zspv6U8jFqjkHGYdNdDy1rfUnCSolCzUdgSSg98PRgE,166
|
|
35
31
|
masster/study/export.py,sha256=9Bhz8wpO3ZHdwV0iWSX0E38GS3UfqfAFlW9VN8ht2-Y,28845
|
|
36
|
-
masster/study/h5.py,sha256=
|
|
37
|
-
masster/study/helpers.py,sha256=
|
|
32
|
+
masster/study/h5.py,sha256=Tl_jdV75yOZ5PH76jvMvTdOJdhiup6uINPC04DhcDX0,71815
|
|
33
|
+
masster/study/helpers.py,sha256=PZ0Lb3eFSnEmPQ3sFzHn-cYr_OehHGzTOogfo3r5K-0,133432
|
|
38
34
|
masster/study/helpers_optimized.py,sha256=sd87kNPIEPdMijekXzZWSyeZzJ_DTAW8HQjAry-jVyY,13922
|
|
39
|
-
masster/study/load.py,sha256=
|
|
35
|
+
masster/study/load.py,sha256=xh-5CX7rCiw_AIY8Wwe_jr4n6BPRSAUIoRr6x6EG8Cs,50192
|
|
40
36
|
masster/study/parameters.py,sha256=0elaF7YspTsB7qyajWAbRNL2VfKlGz5GJLifmO8IGkk,3276
|
|
41
|
-
masster/study/plot.py,sha256=
|
|
42
|
-
masster/study/processing.py,sha256=
|
|
37
|
+
masster/study/plot.py,sha256=RZ-ko0ocsXzaPtsa5QzBDX4FIwQkx4lYf5RPLJAH5Ss,76147
|
|
38
|
+
masster/study/processing.py,sha256=ijLaVKZlPJQpcQh_u-Cj6acrSEOaB3vKMNzS9alXdzg,52661
|
|
43
39
|
masster/study/save.py,sha256=YjFEiuiB4OFLVvW_AX4-kgnsbjCWrYZeqF85VNEtbdw,6560
|
|
44
|
-
masster/study/study.py,sha256=
|
|
45
|
-
masster/study/study5_schema.json,sha256=
|
|
40
|
+
masster/study/study.py,sha256=IrgkZPFwdgRFyAFrm0KpA7pRXuhvtwzHuVq2ee-3Hj8,31292
|
|
41
|
+
masster/study/study5_schema.json,sha256=k1D6LhHWVioe4GY9-Xg0ro2wp9Z_Oc1MbZ4lBkrAkys,5316
|
|
46
42
|
masster/study/defaults/__init__.py,sha256=m3Z5KXGqsTdh7GjYzZoENERt39yRg0ceVRV1DeCt1P0,610
|
|
47
43
|
masster/study/defaults/align_def.py,sha256=QSJXfe5kAtYp_IN8LUuXjq61IkxT74ml84k5kmmRjqM,19846
|
|
48
44
|
masster/study/defaults/export_def.py,sha256=eXl3h4aoLX88XkHTpqahLd-QZ2gjUqrmjq8IJULXeWo,1203
|
|
@@ -53,9 +49,9 @@ masster/study/defaults/find_ms2_def.py,sha256=RL0DFG41wQ05U8UQKUGr3vzSl3mU0m0knQ
|
|
|
53
49
|
masster/study/defaults/integrate_chrom_def.py,sha256=0MNIWGTjty-Zu-NTQsIweuj3UVqEY3x1x8pK0mPwYak,7264
|
|
54
50
|
masster/study/defaults/integrate_def.py,sha256=Vf4SAzdBfnsSZ3IRaF0qZvWu3gMDPHdgPfMYoPKeWv8,7246
|
|
55
51
|
masster/study/defaults/merge_def.py,sha256=EBsKE3hsAkTEzN9dpdRD5W3_suTKy_WZ_96rwS0uBuE,8572
|
|
56
|
-
masster/study/defaults/study_def.py,sha256=
|
|
57
|
-
masster-0.3.
|
|
58
|
-
masster-0.3.
|
|
59
|
-
masster-0.3.
|
|
60
|
-
masster-0.3.
|
|
61
|
-
masster-0.3.
|
|
52
|
+
masster/study/defaults/study_def.py,sha256=v2V5i5y288gydhMOM78m8u_GaWC2XdjLM5nJP6e17sI,10476
|
|
53
|
+
masster-0.3.15.dist-info/METADATA,sha256=RZMq52mkrHMq9vTYpMRwAcZ-hZkCYkYaZDMm68tcYw0,44320
|
|
54
|
+
masster-0.3.15.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
55
|
+
masster-0.3.15.dist-info/entry_points.txt,sha256=ZHguQ_vPmdbpqq2uGtmEOLJfgP-DQ1T0c07Lxh30wc8,58
|
|
56
|
+
masster-0.3.15.dist-info/licenses/LICENSE,sha256=bx5iLIKjgAdYQ7sISn7DsfHRKkoCUm1154sJJKhgqnU,35184
|
|
57
|
+
masster-0.3.15.dist-info/RECORD,,
|