masster 0.4.5__tar.gz → 0.4.6__tar.gz
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-0.4.5/src/masster.egg-info → masster-0.4.6}/PKG-INFO +3 -3
- {masster-0.4.5 → masster-0.4.6}/pyproject.toml +3 -3
- {masster-0.4.5 → masster-0.4.6}/src/masster/__init__.py +8 -8
- {masster-0.4.5 → masster-0.4.6}/src/masster/chromatogram.py +2 -2
- {masster-0.4.5 → masster-0.4.6}/src/masster/logger.py +3 -3
- {masster-0.4.5 → masster-0.4.6}/src/masster/sample/__init__.py +1 -1
- {masster-0.4.5 → masster-0.4.6}/src/masster/sample/adducts.py +1 -1
- {masster-0.4.5 → masster-0.4.6}/src/masster/sample/h5.py +4 -4
- {masster-0.4.5 → masster-0.4.6}/src/masster/sample/lib.py +2 -2
- {masster-0.4.5 → masster-0.4.6}/src/masster/sample/load.py +7 -7
- {masster-0.4.5 → masster-0.4.6}/src/masster/sample/parameters.py +1 -1
- {masster-0.4.5 → masster-0.4.6}/src/masster/sample/plot.py +2 -2
- {masster-0.4.5 → masster-0.4.6}/src/masster/sample/processing.py +2 -2
- {masster-0.4.5 → masster-0.4.6}/src/masster/sample/sample.py +85 -85
- {masster-0.4.5 → masster-0.4.6}/src/masster/sample/save.py +1 -1
- {masster-0.4.5 → masster-0.4.6}/src/masster/spectrum.py +2 -2
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/__init__.py +1 -1
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/export.py +6 -6
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/h5.py +3 -3
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/helpers.py +9 -9
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/helpers_optimized.py +1 -1
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/id.py +4 -4
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/load.py +5 -5
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/plot.py +3 -3
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/processing.py +1 -1
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/save.py +1 -1
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/study.py +97 -97
- {masster-0.4.5 → masster-0.4.6/src/masster.egg-info}/PKG-INFO +3 -3
- {masster-0.4.5 → masster-0.4.6}/src/masster.egg-info/requires.txt +2 -2
- {masster-0.4.5 → masster-0.4.6}/LICENSE +0 -0
- {masster-0.4.5 → masster-0.4.6}/MANIFEST.in +0 -0
- {masster-0.4.5 → masster-0.4.6}/README.md +0 -0
- {masster-0.4.5 → masster-0.4.6}/setup.cfg +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/_version.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/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-0.4.5 → masster-0.4.6}/src/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-0.4.5 → masster-0.4.6}/src/masster/data/dda/20250530_VH_IQX_KW_RP_HSST3_100mm_12min_pos_v4_MS1_C-MiLUT_C008_v6_r38_01.sample5 +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/data/dda/20250530_VH_IQX_KW_RP_HSST3_100mm_12min_pos_v4_MS1_C-MiLUT_C008_v7_r37_01.sample5 +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/data/dda/20250530_VH_IQX_KW_RP_HSST3_100mm_12min_pos_v4_MS1_C-MiLUT_C017_v5_r99_01.sample5 +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/data/libs/__pycache__/ccm.cpython-312.pyc +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/data/libs/__pycache__/urine.cpython-312.pyc +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/data/libs/ccm.csv +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/data/libs/urine.csv +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/data/wiff/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.timeseries.data +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/data/wiff/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.wiff +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/data/wiff/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.wiff.scan +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/data/wiff/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.wiff2 +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/lib/__init__.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/lib/lib.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/sample/defaults/__init__.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/sample/defaults/find_adducts_def.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/sample/defaults/find_features_def.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/sample/defaults/find_ms2_def.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/sample/defaults/get_spectrum_def.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/sample/defaults/sample_def.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/sample/helpers.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/sample/quant.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/sample/sample5_schema.json +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/sample/sciex.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/defaults/__init__.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/defaults/align_def.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/defaults/export_def.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/defaults/fill_chrom_def.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/defaults/fill_def.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/defaults/find_consensus_def.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/defaults/find_ms2_def.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/defaults/identify_def.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/defaults/integrate_chrom_def.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/defaults/integrate_def.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/defaults/merge_def.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/defaults/study_def.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/parameters.py +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster/study/study5_schema.json +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster.egg-info/SOURCES.txt +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster.egg-info/dependency_links.txt +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster.egg-info/entry_points.txt +0 -0
- {masster-0.4.5 → masster-0.4.6}/src/masster.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: masster
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.6
|
|
4
4
|
Summary: Mass spectrometry data analysis package
|
|
5
5
|
Author: Zamboni Lab
|
|
6
6
|
License-Expression: AGPL-3.0-only
|
|
@@ -32,17 +32,17 @@ Requires-Dist: marimo>=0.14.16
|
|
|
32
32
|
Requires-Dist: matplotlib>=3.8.0
|
|
33
33
|
Requires-Dist: pandas>=2.2.0
|
|
34
34
|
Requires-Dist: panel>=1.7.0
|
|
35
|
-
Requires-Dist: polars>=1.0.0
|
|
36
35
|
Requires-Dist: pyopenms>=3.3.0
|
|
37
36
|
Requires-Dist: pyteomics>=4.7.0
|
|
38
37
|
Requires-Dist: pythonnet>=3.0.0
|
|
39
|
-
Requires-Dist: scipy>=1.12.0
|
|
40
38
|
Requires-Dist: tqdm>=4.65.0
|
|
41
39
|
Requires-Dist: openpyxl>=3.1.5
|
|
42
40
|
Requires-Dist: cmap>=0.6.2
|
|
43
41
|
Requires-Dist: altair>=5.5.0
|
|
44
42
|
Requires-Dist: scikit-learn>=1.7.1
|
|
45
43
|
Requires-Dist: ipython>=9.4.0
|
|
44
|
+
Requires-Dist: scipy>=1.14.1
|
|
45
|
+
Requires-Dist: polars>=1.32.3
|
|
46
46
|
Provides-Extra: dev
|
|
47
47
|
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
48
48
|
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
[project]
|
|
3
3
|
name = "masster"
|
|
4
|
-
version = "0.4.
|
|
4
|
+
version = "0.4.6"
|
|
5
5
|
description = "Mass spectrometry data analysis package"
|
|
6
6
|
authors = [
|
|
7
7
|
{ name = "Zamboni Lab" }
|
|
@@ -39,17 +39,17 @@ dependencies = [
|
|
|
39
39
|
"matplotlib>=3.8.0",
|
|
40
40
|
"pandas>=2.2.0",
|
|
41
41
|
"panel>=1.7.0",
|
|
42
|
-
"polars>=1.0.0",
|
|
43
42
|
"pyopenms>=3.3.0",
|
|
44
43
|
"pyteomics>=4.7.0",
|
|
45
44
|
"pythonnet>=3.0.0",
|
|
46
|
-
"scipy>=1.12.0",
|
|
47
45
|
"tqdm>=4.65.0",
|
|
48
46
|
"openpyxl>=3.1.5",
|
|
49
47
|
"cmap>=0.6.2",
|
|
50
48
|
"altair>=5.5.0",
|
|
51
49
|
"scikit-learn>=1.7.1",
|
|
52
50
|
"ipython>=9.4.0",
|
|
51
|
+
"scipy>=1.14.1",
|
|
52
|
+
"polars>=1.32.3",
|
|
53
53
|
]
|
|
54
54
|
|
|
55
55
|
[project.optional-dependencies]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"""
|
|
2
|
-
|
|
2
|
+
masster - Mass Spectrometry Analysis Assistant
|
|
3
3
|
|
|
4
4
|
A comprehensive Python package for processing and analyzing untargeted metabolomics data,
|
|
5
5
|
supporting both DDA (Data-Dependent Acquisition) and DIA (Data-Independent Acquisition)
|
|
@@ -8,14 +8,14 @@ mass spectrometry workflows.
|
|
|
8
8
|
|
|
9
9
|
from __future__ import annotations
|
|
10
10
|
|
|
11
|
-
from
|
|
11
|
+
from masster._version import __version__
|
|
12
12
|
|
|
13
|
-
# from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
16
|
-
from
|
|
17
|
-
from
|
|
18
|
-
from
|
|
13
|
+
# from masster._version import get_version
|
|
14
|
+
from masster.chromatogram import Chromatogram
|
|
15
|
+
from masster.lib import Lib
|
|
16
|
+
from masster.sample.sample import Sample
|
|
17
|
+
from masster.spectrum import Spectrum
|
|
18
|
+
from masster.study.study import Study
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
__all__ = [
|
|
@@ -88,10 +88,10 @@ class Chromatogram:
|
|
|
88
88
|
|
|
89
89
|
Example Usage:
|
|
90
90
|
>>> import numpy as np
|
|
91
|
-
>>> from
|
|
91
|
+
>>> from masster import Chromatogram
|
|
92
92
|
>>> rt = np.linspace(0, 300, 1000)
|
|
93
93
|
>>> intensity = np.random.normal(1000, 100, 1000)
|
|
94
|
-
>>> chromatogram =
|
|
94
|
+
>>> chromatogram = Chromatogram(rt=rt, inty=intensity, label="EIC m/z 150")
|
|
95
95
|
>>> chromatogram.find_peaks()
|
|
96
96
|
>>> chromatogram.calculate_area()
|
|
97
97
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# masster/logger.py
|
|
2
2
|
"""
|
|
3
|
-
Simple logger system for
|
|
3
|
+
Simple logger system for masster Study and Sample instances.
|
|
4
4
|
Uses basic Python logging timestamp = dt.strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]
|
|
5
5
|
|
|
6
6
|
# Loguru-style colors for different log levels
|
|
@@ -59,7 +59,7 @@ class MasterLogger:
|
|
|
59
59
|
self.sink = sink
|
|
60
60
|
|
|
61
61
|
# Create a unique logger name for this instance
|
|
62
|
-
self.logger_name = f"
|
|
62
|
+
self.logger_name = f"masster.{self.instance_type}.{self.instance_id}"
|
|
63
63
|
|
|
64
64
|
# Get a Python logger instance
|
|
65
65
|
self.logger_instance = logging.getLogger(self.logger_name)
|
|
@@ -73,7 +73,7 @@ class MasterLogger:
|
|
|
73
73
|
# Create a stream handler
|
|
74
74
|
self.handler = logging.StreamHandler(self.sink)
|
|
75
75
|
|
|
76
|
-
# Create formatter that matches the original
|
|
76
|
+
# Create formatter that matches the original masster style
|
|
77
77
|
class masterFormatter(logging.Formatter):
|
|
78
78
|
def __init__(self, label):
|
|
79
79
|
super().__init__()
|
|
@@ -18,7 +18,7 @@ from typing import List, Dict
|
|
|
18
18
|
from itertools import combinations
|
|
19
19
|
|
|
20
20
|
# Import defaults class for external use
|
|
21
|
-
from
|
|
21
|
+
from masster.sample.defaults.find_adducts_def import find_adducts_defaults
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
def _get_adducts(self, adducts_list: list = None, **kwargs):
|
|
@@ -7,8 +7,8 @@ import polars as pl
|
|
|
7
7
|
|
|
8
8
|
from typing import Any, Dict, List, Optional, Tuple
|
|
9
9
|
|
|
10
|
-
from
|
|
11
|
-
from
|
|
10
|
+
from masster.chromatogram import Chromatogram
|
|
11
|
+
from masster.spectrum import Spectrum
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
def _save_sample5(
|
|
@@ -356,7 +356,7 @@ def _load_sample5(self, filename: str, map: bool = False):
|
|
|
356
356
|
loaded_data = load_parameters_from_metadata(metadata_group)
|
|
357
357
|
|
|
358
358
|
# Always create a fresh sample_defaults object
|
|
359
|
-
from
|
|
359
|
+
from masster.sample.defaults.sample_def import sample_defaults
|
|
360
360
|
|
|
361
361
|
self.parameters = sample_defaults()
|
|
362
362
|
|
|
@@ -1096,7 +1096,7 @@ def _load_sample5_study(self, filename: str, map: bool = False):
|
|
|
1096
1096
|
loaded_data = load_parameters_from_metadata(metadata_group)
|
|
1097
1097
|
|
|
1098
1098
|
# Always create a fresh sample_defaults object
|
|
1099
|
-
from
|
|
1099
|
+
from masster.sample.defaults.sample_def import sample_defaults
|
|
1100
1100
|
|
|
1101
1101
|
self.parameters = sample_defaults()
|
|
1102
1102
|
|
|
@@ -34,7 +34,7 @@ Supported Adducts:
|
|
|
34
34
|
|
|
35
35
|
Example Usage:
|
|
36
36
|
```python
|
|
37
|
-
from
|
|
37
|
+
from masster.sample.lib import Lib
|
|
38
38
|
|
|
39
39
|
# Create library instance
|
|
40
40
|
lib = Lib()
|
|
@@ -63,7 +63,7 @@ import pyopenms as oms
|
|
|
63
63
|
|
|
64
64
|
from tqdm import tqdm
|
|
65
65
|
|
|
66
|
-
from
|
|
66
|
+
from masster.chromatogram import Chromatogram
|
|
67
67
|
# Parameters removed - using hardcoded defaults
|
|
68
68
|
|
|
69
69
|
|
|
@@ -47,10 +47,10 @@ import pyopenms as oms
|
|
|
47
47
|
|
|
48
48
|
from tqdm import tqdm
|
|
49
49
|
|
|
50
|
-
from
|
|
50
|
+
from masster.chromatogram import Chromatogram
|
|
51
51
|
|
|
52
52
|
# Parameters removed - using hardcoded defaults
|
|
53
|
-
from
|
|
53
|
+
from masster.spectrum import Spectrum
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
def load(
|
|
@@ -556,12 +556,12 @@ def _load_wiff(
|
|
|
556
556
|
filename=None,
|
|
557
557
|
):
|
|
558
558
|
try:
|
|
559
|
-
# Use
|
|
560
|
-
from
|
|
559
|
+
# Use masster's own implementation first
|
|
560
|
+
from masster.sample.sciex import SciexWiffData as MasterSciexWiffData
|
|
561
561
|
|
|
562
562
|
SciexWiffDataClass = MasterSciexWiffData
|
|
563
563
|
except ImportError:
|
|
564
|
-
# Fallback to alpharaw if
|
|
564
|
+
# Fallback to alpharaw if masster implementation fails
|
|
565
565
|
from alpharaw.sciex import SciexWiffData as AlpharawSciexWiffData
|
|
566
566
|
|
|
567
567
|
SciexWiffDataClass = AlpharawSciexWiffData
|
|
@@ -972,8 +972,8 @@ def index_file(self):
|
|
|
972
972
|
try:
|
|
973
973
|
from alpharaw.sciex import SciexWiffData
|
|
974
974
|
except ImportError:
|
|
975
|
-
# Fallback to
|
|
976
|
-
from
|
|
975
|
+
# Fallback to masster's own implementation
|
|
976
|
+
from masster.sample.sciex import SciexWiffData
|
|
977
977
|
|
|
978
978
|
raw_data = SciexWiffData(centroided=False)
|
|
979
979
|
raw_data.keep_k_peaks_per_spec = self.parameters.max_points_per_spectrum
|
|
@@ -85,7 +85,7 @@ def update_parameters(self, **kwargs):
|
|
|
85
85
|
- Individual parameter names and values (see sample_defaults for details)
|
|
86
86
|
"""
|
|
87
87
|
# Import here to avoid circular imports
|
|
88
|
-
from
|
|
88
|
+
from masster.sample.defaults.sample_def import (
|
|
89
89
|
sample_defaults as SampleDefaults,
|
|
90
90
|
)
|
|
91
91
|
|
|
@@ -2073,7 +2073,7 @@ def plot_tic(
|
|
|
2073
2073
|
return
|
|
2074
2074
|
|
|
2075
2075
|
# Import helper locally to avoid circular imports
|
|
2076
|
-
from
|
|
2076
|
+
from masster.study.helpers import get_tic
|
|
2077
2077
|
|
|
2078
2078
|
# Delegate TIC computation to study helper which handles ms1_df and scans_df fallbacks
|
|
2079
2079
|
try:
|
|
@@ -2128,7 +2128,7 @@ def plot_bpc(
|
|
|
2128
2128
|
return
|
|
2129
2129
|
|
|
2130
2130
|
# Import helper locally to avoid circular imports
|
|
2131
|
-
from
|
|
2131
|
+
from masster.study.helpers import get_bpc
|
|
2132
2132
|
|
|
2133
2133
|
# Delegate BPC computation to study helper
|
|
2134
2134
|
try:
|
|
@@ -8,13 +8,13 @@ import pyopenms as oms
|
|
|
8
8
|
|
|
9
9
|
from tqdm import tqdm
|
|
10
10
|
|
|
11
|
-
from
|
|
11
|
+
from masster.spectrum import Spectrum
|
|
12
12
|
from .defaults.find_features_def import find_features_defaults
|
|
13
13
|
from .defaults.find_ms2_def import find_ms2_defaults
|
|
14
14
|
from .defaults.get_spectrum_def import get_spectrum_defaults
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
from
|
|
17
|
+
from masster.chromatogram import Chromatogram
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
def get_spectrum(self, scan, **kwargs):
|
|
@@ -23,7 +23,7 @@ Classes:
|
|
|
23
23
|
|
|
24
24
|
Example Usage:
|
|
25
25
|
```python
|
|
26
|
-
from
|
|
26
|
+
from masster.sample import Sample
|
|
27
27
|
|
|
28
28
|
sample = Sample(file="example.mzML")
|
|
29
29
|
sample.find_features()
|
|
@@ -38,87 +38,87 @@ import sys
|
|
|
38
38
|
|
|
39
39
|
import polars as pl
|
|
40
40
|
|
|
41
|
-
from
|
|
42
|
-
from
|
|
41
|
+
from masster._version import get_version
|
|
42
|
+
from masster.logger import MasterLogger
|
|
43
43
|
|
|
44
|
-
from
|
|
45
|
-
from
|
|
46
|
-
from
|
|
47
|
-
from
|
|
48
|
-
from
|
|
44
|
+
from masster.sample.defaults.sample_def import sample_defaults
|
|
45
|
+
from masster.sample.defaults.find_features_def import find_features_defaults
|
|
46
|
+
from masster.sample.defaults.find_adducts_def import find_adducts_defaults
|
|
47
|
+
from masster.sample.defaults.find_ms2_def import find_ms2_defaults
|
|
48
|
+
from masster.sample.defaults.get_spectrum_def import get_spectrum_defaults
|
|
49
49
|
|
|
50
50
|
# Sample-specific imports
|
|
51
|
-
from
|
|
52
|
-
from
|
|
53
|
-
from
|
|
54
|
-
from
|
|
55
|
-
from
|
|
56
|
-
from
|
|
57
|
-
from
|
|
58
|
-
from
|
|
59
|
-
|
|
60
|
-
# from
|
|
61
|
-
# from
|
|
62
|
-
# from
|
|
63
|
-
# from
|
|
64
|
-
# from
|
|
65
|
-
# from
|
|
66
|
-
# from
|
|
67
|
-
# from
|
|
68
|
-
from
|
|
69
|
-
from
|
|
70
|
-
from
|
|
71
|
-
from
|
|
72
|
-
from
|
|
73
|
-
from
|
|
74
|
-
from
|
|
75
|
-
from
|
|
76
|
-
from
|
|
77
|
-
from
|
|
78
|
-
from
|
|
79
|
-
from
|
|
80
|
-
from
|
|
81
|
-
from
|
|
82
|
-
from
|
|
83
|
-
from
|
|
84
|
-
from
|
|
85
|
-
from
|
|
86
|
-
from
|
|
87
|
-
from
|
|
88
|
-
from
|
|
89
|
-
from
|
|
90
|
-
from
|
|
91
|
-
from
|
|
92
|
-
from
|
|
93
|
-
from
|
|
94
|
-
from
|
|
95
|
-
from
|
|
96
|
-
from
|
|
97
|
-
from
|
|
98
|
-
from
|
|
99
|
-
from
|
|
100
|
-
from
|
|
101
|
-
from
|
|
102
|
-
from
|
|
103
|
-
from
|
|
104
|
-
from
|
|
105
|
-
from
|
|
106
|
-
from
|
|
107
|
-
from
|
|
108
|
-
from
|
|
109
|
-
from
|
|
110
|
-
from
|
|
111
|
-
from
|
|
112
|
-
from
|
|
113
|
-
from
|
|
114
|
-
from
|
|
115
|
-
from
|
|
116
|
-
from
|
|
117
|
-
from
|
|
118
|
-
from
|
|
119
|
-
from
|
|
120
|
-
from
|
|
121
|
-
from
|
|
51
|
+
from masster.sample.h5 import _load_sample5
|
|
52
|
+
from masster.sample.h5 import _load_sample5_study
|
|
53
|
+
from masster.sample.h5 import _save_sample5
|
|
54
|
+
from masster.sample.helpers import _delete_ms2
|
|
55
|
+
from masster.sample.helpers import _estimate_memory_usage
|
|
56
|
+
from masster.sample.helpers import _get_scan_uids
|
|
57
|
+
from masster.sample.helpers import _get_feature_uids
|
|
58
|
+
from masster.sample.helpers import _features_sync
|
|
59
|
+
|
|
60
|
+
# from masster.sample.helpers import _parse_adduct_specs
|
|
61
|
+
# from masster.sample.helpers import _calculate_adduct_mass_shift
|
|
62
|
+
# from masster.sample.helpers import _parse_formula_expression
|
|
63
|
+
# from masster.sample.helpers import _calculate_molecular_mass
|
|
64
|
+
# from masster.sample.helpers import _parse_legacy_adduct_format
|
|
65
|
+
# from masster.sample.helpers import _extract_adduct_probability
|
|
66
|
+
# from masster.sample.helpers import _detect_adduct_groups_direct
|
|
67
|
+
# from masster.sample.helpers import _check_adduct_relationship
|
|
68
|
+
from masster.sample.adducts import _get_adducts
|
|
69
|
+
from masster.sample.adducts import find_adducts
|
|
70
|
+
from masster.sample.helpers import features_delete
|
|
71
|
+
from masster.sample.helpers import features_filter
|
|
72
|
+
from masster.sample.helpers import select
|
|
73
|
+
from masster.sample.helpers import select_closest_scan
|
|
74
|
+
from masster.sample.helpers import get_dda_stats
|
|
75
|
+
from masster.sample.helpers import get_feature
|
|
76
|
+
from masster.sample.helpers import get_scan
|
|
77
|
+
from masster.sample.helpers import get_eic
|
|
78
|
+
from masster.sample.helpers import set_source
|
|
79
|
+
from masster.sample.helpers import _recreate_feature_map
|
|
80
|
+
from masster.sample.helpers import _get_feature_map
|
|
81
|
+
from masster.sample.load import _load_featureXML
|
|
82
|
+
from masster.sample.load import _load_ms2data
|
|
83
|
+
from masster.sample.load import _load_mzML
|
|
84
|
+
from masster.sample.load import _load_raw
|
|
85
|
+
from masster.sample.load import _load_wiff
|
|
86
|
+
from masster.sample.load import chrom_extract
|
|
87
|
+
from masster.sample.load import index_file
|
|
88
|
+
from masster.sample.load import load
|
|
89
|
+
from masster.sample.load import load_noms1
|
|
90
|
+
from masster.sample.load import load_study
|
|
91
|
+
from masster.sample.load import sanitize
|
|
92
|
+
from masster.sample.plot import plot_2d
|
|
93
|
+
from masster.sample.plot import plot_2d_oracle
|
|
94
|
+
from masster.sample.plot import plot_dda_stats
|
|
95
|
+
from masster.sample.plot import plot_chrom
|
|
96
|
+
from masster.sample.plot import plot_feature_stats
|
|
97
|
+
from masster.sample.plot import plot_ms2_cycle
|
|
98
|
+
from masster.sample.plot import plot_ms2_eic
|
|
99
|
+
from masster.sample.plot import plot_ms2_q1
|
|
100
|
+
from masster.sample.plot import plot_bpc
|
|
101
|
+
from masster.sample.plot import plot_tic
|
|
102
|
+
from masster.sample.plot import _handle_sample_plot_output
|
|
103
|
+
from masster.sample.processing import _clean_features_df
|
|
104
|
+
from masster.sample.processing import _features_deisotope
|
|
105
|
+
from masster.sample.processing import _get_ztscan_stats
|
|
106
|
+
from masster.sample.processing import _spec_to_mat
|
|
107
|
+
from masster.sample.processing import analyze_dda
|
|
108
|
+
from masster.sample.processing import find_features
|
|
109
|
+
from masster.sample.processing import find_ms2
|
|
110
|
+
from masster.sample.processing import get_spectrum
|
|
111
|
+
from masster.sample.parameters import store_history
|
|
112
|
+
from masster.sample.parameters import get_parameters
|
|
113
|
+
from masster.sample.parameters import update_parameters
|
|
114
|
+
from masster.sample.parameters import get_parameters_property
|
|
115
|
+
from masster.sample.parameters import set_parameters_property
|
|
116
|
+
from masster.sample.save import _save_featureXML
|
|
117
|
+
from masster.sample.save import export_chrom
|
|
118
|
+
from masster.sample.save import export_dda_stats
|
|
119
|
+
from masster.sample.save import export_features
|
|
120
|
+
from masster.sample.save import export_mgf
|
|
121
|
+
from masster.sample.save import save
|
|
122
122
|
|
|
123
123
|
|
|
124
124
|
class Sample:
|
|
@@ -329,20 +329,20 @@ class Sample:
|
|
|
329
329
|
|
|
330
330
|
def _reload(self):
|
|
331
331
|
"""
|
|
332
|
-
Reloads all
|
|
332
|
+
Reloads all masster modules to pick up any changes to their source code,
|
|
333
333
|
and updates the instance's class reference to the newly reloaded class version.
|
|
334
334
|
This ensures that the instance uses the latest implementation without restarting the interpreter.
|
|
335
335
|
"""
|
|
336
336
|
# Reset logger configuration flags to allow proper reconfiguration after reload
|
|
337
337
|
try:
|
|
338
|
-
import
|
|
338
|
+
import masster.logger as logger_module
|
|
339
339
|
|
|
340
340
|
if hasattr(logger_module, "_SAMPLE_LOGGER_CONFIGURED"):
|
|
341
341
|
logger_module._SAMPLE_LOGGER_CONFIGURED = False
|
|
342
342
|
except Exception:
|
|
343
343
|
pass
|
|
344
344
|
|
|
345
|
-
# Get the base module name (
|
|
345
|
+
# Get the base module name (masster)
|
|
346
346
|
base_modname = self.__class__.__module__.split(".")[0]
|
|
347
347
|
current_module = self.__class__.__module__
|
|
348
348
|
|
|
@@ -358,7 +358,7 @@ class Sample:
|
|
|
358
358
|
):
|
|
359
359
|
sample_modules.append(module_name)
|
|
360
360
|
|
|
361
|
-
# Add core
|
|
361
|
+
# Add core masster modules
|
|
362
362
|
core_modules = [
|
|
363
363
|
f"{base_modname}._version",
|
|
364
364
|
f"{base_modname}.chromatogram",
|
|
@@ -437,9 +437,9 @@ class Sample:
|
|
|
437
437
|
|
|
438
438
|
def __str__(self):
|
|
439
439
|
if self.features_df is None:
|
|
440
|
-
str = f"
|
|
440
|
+
str = f"masster Sample, source: {os.path.basename(self.file_path)}, features: 0"
|
|
441
441
|
else:
|
|
442
|
-
str = f"
|
|
442
|
+
str = f"masster Sample, source: {os.path.basename(self.file_path)}, features: {len(self.features_df)}"
|
|
443
443
|
return str
|
|
444
444
|
|
|
445
445
|
|
|
@@ -138,10 +138,10 @@ class Spectrum:
|
|
|
138
138
|
|
|
139
139
|
Example Usage:
|
|
140
140
|
>>> import numpy as np
|
|
141
|
-
>>> from
|
|
141
|
+
>>> from masster import Spectrum
|
|
142
142
|
>>> mz = np.array([100.0, 150.0, 200.0, 250.0])
|
|
143
143
|
>>> intensity = np.array([1000, 5000, 3000, 800])
|
|
144
|
-
>>> spectrum =
|
|
144
|
+
>>> spectrum = Spectrum(mz=mz, inty=intensity, ms_level=1)
|
|
145
145
|
>>> spectrum.find_peaks()
|
|
146
146
|
>>> spectrum.plot()
|
|
147
147
|
|
|
@@ -10,9 +10,9 @@ import polars as pl
|
|
|
10
10
|
|
|
11
11
|
from tqdm import tqdm
|
|
12
12
|
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
13
|
+
from masster.spectrum import combine_peaks
|
|
14
|
+
from masster.study.defaults import export_mgf_defaults
|
|
15
|
+
from masster._version import get_version
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
def _get_mgf_df(self, **kwargs):
|
|
@@ -444,7 +444,7 @@ def export_mztab(self, filename: str = None, include_mgf=True, **kwargs) -> None
|
|
|
444
444
|
full_id_data = None
|
|
445
445
|
try:
|
|
446
446
|
# Import here to avoid circular imports
|
|
447
|
-
from
|
|
447
|
+
from masster.study.id import get_id
|
|
448
448
|
|
|
449
449
|
# Get full enriched identification data for SOME section
|
|
450
450
|
full_id_data = get_id(self)
|
|
@@ -1157,7 +1157,7 @@ def export_xlsx(self, filename: str = None) -> None:
|
|
|
1157
1157
|
|
|
1158
1158
|
# 3. Identification results
|
|
1159
1159
|
try:
|
|
1160
|
-
from
|
|
1160
|
+
from masster.study.id import get_id
|
|
1161
1161
|
|
|
1162
1162
|
id_df = get_id(self)
|
|
1163
1163
|
if id_df is not None and not id_df.is_empty():
|
|
@@ -1272,7 +1272,7 @@ def export_parquet(self, basename: str = None) -> None:
|
|
|
1272
1272
|
|
|
1273
1273
|
# 3. Identification results
|
|
1274
1274
|
try:
|
|
1275
|
-
from
|
|
1275
|
+
from masster.study.id import get_id
|
|
1276
1276
|
|
|
1277
1277
|
id_df = get_id(self)
|
|
1278
1278
|
if id_df is not None and not id_df.is_empty():
|
|
@@ -35,8 +35,8 @@ import h5py
|
|
|
35
35
|
import polars as pl
|
|
36
36
|
from tqdm import tqdm
|
|
37
37
|
|
|
38
|
-
from
|
|
39
|
-
from
|
|
38
|
+
from masster.chromatogram import Chromatogram
|
|
39
|
+
from masster.spectrum import Spectrum
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
# Helper functions for HDF5 operations
|
|
@@ -1734,7 +1734,7 @@ def _load_study5(self, filename=None):
|
|
|
1734
1734
|
self.history = {}
|
|
1735
1735
|
|
|
1736
1736
|
# Reconstruct self.parameters from loaded history
|
|
1737
|
-
from
|
|
1737
|
+
from masster.study.defaults.study_def import study_defaults
|
|
1738
1738
|
|
|
1739
1739
|
# Always create a fresh study_defaults object to ensure we have all defaults
|
|
1740
1740
|
self.parameters = study_defaults()
|