masster 0.2.2__tar.gz → 0.2.3__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.

Files changed (72) hide show
  1. {masster-0.2.2 → masster-0.2.3}/PKG-INFO +1 -120
  2. masster-0.2.3/README.md +58 -0
  3. {masster-0.2.2 → masster-0.2.3}/pyproject.toml +1 -1
  4. {masster-0.2.2 → masster-0.2.3}/src/masster/_version.py +1 -1
  5. {masster-0.2.2 → masster-0.2.3}/src/masster/study/save.py +0 -6
  6. {masster-0.2.2 → masster-0.2.3}/src/masster/study/study.py +23 -0
  7. {masster-0.2.2 → masster-0.2.3}/uv.lock +1 -1
  8. masster-0.2.2/README.md +0 -177
  9. {masster-0.2.2 → masster-0.2.3}/.github/workflows/publish.yml +0 -0
  10. {masster-0.2.2 → masster-0.2.3}/.github/workflows/security.yml +0 -0
  11. {masster-0.2.2 → masster-0.2.3}/.github/workflows/test.yml +0 -0
  12. {masster-0.2.2 → masster-0.2.3}/.gitignore +0 -0
  13. {masster-0.2.2 → masster-0.2.3}/.pre-commit-config.yaml +0 -0
  14. {masster-0.2.2 → masster-0.2.3}/LICENSE +0 -0
  15. {masster-0.2.2 → masster-0.2.3}/Makefile +0 -0
  16. {masster-0.2.2 → masster-0.2.3}/TESTING.md +0 -0
  17. {masster-0.2.2 → masster-0.2.3}/demo/example_batch_process.py +0 -0
  18. {masster-0.2.2 → masster-0.2.3}/demo/example_sample_process.py +0 -0
  19. {masster-0.2.2 → masster-0.2.3}/src/masster/__init__.py +0 -0
  20. {masster-0.2.2 → masster-0.2.3}/src/masster/chromatogram.py +0 -0
  21. {masster-0.2.2 → masster-0.2.3}/src/masster/data/examples/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.mzML +0 -0
  22. {masster-0.2.2 → masster-0.2.3}/src/masster/data/examples/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.timeseries.data +0 -0
  23. {masster-0.2.2 → masster-0.2.3}/src/masster/data/examples/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.wiff +0 -0
  24. {masster-0.2.2 → masster-0.2.3}/src/masster/data/examples/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.wiff.scan +0 -0
  25. {masster-0.2.2 → masster-0.2.3}/src/masster/data/examples/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.wiff2 +0 -0
  26. {masster-0.2.2 → masster-0.2.3}/src/masster/logger.py +0 -0
  27. {masster-0.2.2 → masster-0.2.3}/src/masster/sample/__init__.py +0 -0
  28. {masster-0.2.2 → masster-0.2.3}/src/masster/sample/defaults/__init__.py +0 -0
  29. {masster-0.2.2 → masster-0.2.3}/src/masster/sample/defaults/find_adducts_def.py +0 -0
  30. {masster-0.2.2 → masster-0.2.3}/src/masster/sample/defaults/find_features_def.py +0 -0
  31. {masster-0.2.2 → masster-0.2.3}/src/masster/sample/defaults/find_ms2_def.py +0 -0
  32. {masster-0.2.2 → masster-0.2.3}/src/masster/sample/defaults/get_spectrum_def.py +0 -0
  33. {masster-0.2.2 → masster-0.2.3}/src/masster/sample/defaults/sample_def.py +0 -0
  34. {masster-0.2.2 → masster-0.2.3}/src/masster/sample/h5.py +0 -0
  35. {masster-0.2.2 → masster-0.2.3}/src/masster/sample/helpers.py +0 -0
  36. {masster-0.2.2 → masster-0.2.3}/src/masster/sample/load.py +0 -0
  37. {masster-0.2.2 → masster-0.2.3}/src/masster/sample/parameters.py +0 -0
  38. {masster-0.2.2 → masster-0.2.3}/src/masster/sample/plot.py +0 -0
  39. {masster-0.2.2 → masster-0.2.3}/src/masster/sample/processing.py +0 -0
  40. {masster-0.2.2 → masster-0.2.3}/src/masster/sample/sample.py +0 -0
  41. {masster-0.2.2 → masster-0.2.3}/src/masster/sample/sample5_schema.json +0 -0
  42. {masster-0.2.2 → masster-0.2.3}/src/masster/sample/save.py +0 -0
  43. {masster-0.2.2 → masster-0.2.3}/src/masster/spectrum.py +0 -0
  44. {masster-0.2.2 → masster-0.2.3}/src/masster/study/__init__.py +0 -0
  45. {masster-0.2.2 → masster-0.2.3}/src/masster/study/defaults/__init__.py +0 -0
  46. {masster-0.2.2 → masster-0.2.3}/src/masster/study/defaults/align_def.py +0 -0
  47. {masster-0.2.2 → masster-0.2.3}/src/masster/study/defaults/export_def.py +0 -0
  48. {masster-0.2.2 → masster-0.2.3}/src/masster/study/defaults/fill_chrom_def.py +0 -0
  49. {masster-0.2.2 → masster-0.2.3}/src/masster/study/defaults/find_consensus_def.py +0 -0
  50. {masster-0.2.2 → masster-0.2.3}/src/masster/study/defaults/find_ms2_def.py +0 -0
  51. {masster-0.2.2 → masster-0.2.3}/src/masster/study/defaults/integrate_chrom_def.py +0 -0
  52. {masster-0.2.2 → masster-0.2.3}/src/masster/study/defaults/study_def.py +0 -0
  53. {masster-0.2.2 → masster-0.2.3}/src/masster/study/export.py +0 -0
  54. {masster-0.2.2 → masster-0.2.3}/src/masster/study/h5.py +0 -0
  55. {masster-0.2.2 → masster-0.2.3}/src/masster/study/helpers.py +0 -0
  56. {masster-0.2.2 → masster-0.2.3}/src/masster/study/load.py +0 -0
  57. {masster-0.2.2 → masster-0.2.3}/src/masster/study/parameters.py +0 -0
  58. {masster-0.2.2 → masster-0.2.3}/src/masster/study/plot.py +0 -0
  59. {masster-0.2.2 → masster-0.2.3}/src/masster/study/processing.py +0 -0
  60. {masster-0.2.2 → masster-0.2.3}/src/masster/study/study5_schema.json +0 -0
  61. {masster-0.2.2 → masster-0.2.3}/tests/conftest.py +0 -0
  62. {masster-0.2.2 → masster-0.2.3}/tests/test_chromatogram.py +0 -0
  63. {masster-0.2.2 → masster-0.2.3}/tests/test_defaults.py +0 -0
  64. {masster-0.2.2 → masster-0.2.3}/tests/test_imports.py +0 -0
  65. {masster-0.2.2 → masster-0.2.3}/tests/test_integration.py +0 -0
  66. {masster-0.2.2 → masster-0.2.3}/tests/test_logger.py +0 -0
  67. {masster-0.2.2 → masster-0.2.3}/tests/test_parameters.py +0 -0
  68. {masster-0.2.2 → masster-0.2.3}/tests/test_sample.py +0 -0
  69. {masster-0.2.2 → masster-0.2.3}/tests/test_spectrum.py +0 -0
  70. {masster-0.2.2 → masster-0.2.3}/tests/test_study.py +0 -0
  71. {masster-0.2.2 → masster-0.2.3}/tests/test_version.py +0 -0
  72. {masster-0.2.2 → masster-0.2.3}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: masster
3
- Version: 0.2.2
3
+ Version: 0.2.3
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
@@ -736,23 +736,12 @@ Most core processing functions are derived from OpenMS. We use the same nomencla
736
736
 
737
737
  This is a poorly documented, stable branch of the development codebase in use in the Zamboni lab. Novel functionalities will be added based on need and requests.
738
738
 
739
- ## Features
740
-
741
- - **Mass spectrometry data processing**: Support for multiple file formats (.wiff, .mzML, .raw, .mzpkl)
742
- - **Feature detection and alignment**: Automated chromatographic peak detection and retention time alignment
743
- - **Consensus feature building**: Identification of features across multiple samples
744
- - **Interactive visualizations**: 2D plots, chromatograms, and statistical dashboards
745
- - **Batch processing**: Process entire studies with multiple samples
746
- - **Export capabilities**: MGF export for spectral library searches
747
-
748
739
  ## Installation
749
740
 
750
741
  ```bash
751
742
  pip install masster
752
743
  ```
753
744
 
754
- ## Quick Start
755
-
756
745
  ### Basic Workflow for analyzing LC-MS study with 2-... samples
757
746
 
758
747
  ```python
@@ -784,114 +773,6 @@ study.export_mgf()
784
773
  study.save()
785
774
  ```
786
775
 
787
- ### Study-Level Plots
788
-
789
- ```python
790
- # Plot features from multiple samples
791
- study.plot_samples_2d()
792
-
793
- # Plot consensus features
794
- study.plot_consensus_2d()
795
-
796
- # Plot overlaid chromatograms for specific consensus features (use their uid)
797
- study.plot_chrom(uids=[1, 2, 3])
798
- ```
799
-
800
-
801
- ### Single Sample Processing
802
-
803
- ```python
804
- from masster.sample import Sample
805
-
806
- # Load a single sample (mzML, RAW, WIFF)
807
- sample = Sample("path/to/your/file.mzML")
808
-
809
- # Detect features
810
- sample.find_features(chrom_peak_snr=10, noise=500, chrom_fwhm=1.0)
811
-
812
- # Detect adducts
813
- sample.find_adducts()
814
-
815
- # Find MS2 spectra
816
- sample.find_ms2()
817
-
818
- # Save results to .sample5
819
- sample.save()
820
- ```
821
-
822
- Masster provides extensive plotting capabilities for data exploration and quality control:
823
-
824
- ### Single sample visualization
825
-
826
- ```python
827
- # Plot 2D overview of MS data with detected features
828
- sample.plot_2d(
829
- filename="overview_2d.html",
830
- show_features=True,
831
- show_ms2=True,
832
- title="MS Data Overview"
833
- )
834
-
835
- # Plot with feature filtering
836
- sample.plot_2d(
837
- filename="features_ms2_only.html"
838
- )
839
-
840
- # Plot extracted ion chromatogram
841
- sample.plot_eic(
842
- feature_uid=123,
843
- rt_tol=10,
844
- mz_tol=0.005
845
- )
846
- ```
847
-
848
- ### Quality Control Plots
849
-
850
- ```python
851
- # Plot DDA acquisition statistics
852
- sample.plot_dda_stats(filename="dda_stats.html")
853
-
854
- # Plot feature statistics
855
- sample.plot_feature_stats(filename="feature_stats.html")
856
-
857
- # Plot total ion chromatogram
858
- sample.plot_tic(filename="tic.html")
859
- ```
860
-
861
- ### Advanced Plotting Options
862
-
863
- ```python
864
- # Plot with Oracle annotation data
865
- sample.plot_2d_oracle(
866
- oracle_folder="path/to/oracle/results",
867
- colorby="hg", # Color by chemical class
868
- filename="annotated_features.html"
869
- )
870
-
871
- # Plot MS2 cycle view
872
- sample.plot_ms2_cycle(
873
- cycle=100,
874
- filename="ms2_cycle.html",
875
- centroid=True
876
- )
877
- ```
878
-
879
- ## File Format Support
880
-
881
- - **Input formats**: .wiff, .mzML, .raw files
882
- - **Intermediate formats**: .sample5 and .study5 (HDF5) for fast loading
883
- - **Export formats**: .mgf, .csv
884
- - **Visualization**: .html (interactive), .png, .svg
885
-
886
- ## Advanced Features
887
-
888
- ### Batch Processing
889
- Use the command-line interface for processing multiple files:
890
-
891
- ```bash
892
- python -m masster.demo.example_batch_process input_directory --recursive --dest output_directory
893
- ```
894
-
895
776
  ## Requirements
896
777
 
897
778
  - Python ≥ 3.11
@@ -0,0 +1,58 @@
1
+ # MASSter
2
+
3
+ **MASSter** is a comprehensive Python package for mass spectrometry data analysis, designed for metabolomics and LC-MS data processing. It provides tools for feature detection, alignment, consensus building, and interactive visualization of mass spectrometry datasets. It is designed to deal with DDA, and hides functionalities for DIA and ZTScan DIA data.
4
+
5
+ Most core processing functions are derived from OpenMS. We use the same nomenclature and refer to their documentation for an explanation of the parameters. To a large extent, however, you should be able to use the defaults (=no parameters) when calling processing steps.
6
+
7
+ This is a poorly documented, stable branch of the development codebase in use in the Zamboni lab. Novel functionalities will be added based on need and requests.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ pip install masster
13
+ ```
14
+
15
+ ### Basic Workflow for analyzing LC-MS study with 2-... samples
16
+
17
+ ```python
18
+ import masster
19
+
20
+ # Initialize the Study object with the default folder
21
+ study = masster.Study(default_folder=r'D:\...\mylcms')
22
+
23
+ # Load data from folder with raw data, here: WIFF
24
+ study.add_folder(r'D:\...\...\...\*.wiff')
25
+
26
+ # Align maps
27
+ study.align(rt_max_diff=2.0)
28
+
29
+ # Find consensus features
30
+ study.find_consensus(min_samples=3)
31
+
32
+ # Retrieve missing data for quantification
33
+ study.fill_chrom(abs_)
34
+
35
+ # Integrate according to consensus metadata
36
+ study.integrate_chrom()
37
+
38
+ # link MS2 across the whole study and export them
39
+ study.find_ms2()
40
+ study.export_mgf()
41
+
42
+ # Save the study to .study5
43
+ study.save()
44
+ ```
45
+
46
+ ## Requirements
47
+
48
+ - Python ≥ 3.11
49
+ - Key dependencies: pandas, polars, numpy, scipy, matplotlib, bokeh, holoviews, panel
50
+ - See `pyproject.toml` for complete dependency list
51
+
52
+ ## License
53
+
54
+ GNU Affero General Public License v3
55
+
56
+ ## Citation
57
+
58
+ If you use Masster in your research, please cite this repository.
@@ -1,7 +1,7 @@
1
1
 
2
2
  [project]
3
3
  name = "masster"
4
- version = "0.2.2"
4
+ version = "0.2.3"
5
5
  description = "Mass spectrometry data analysis package"
6
6
  authors = [
7
7
  { name = "Zamboni Lab" }
@@ -1,7 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
 
4
- __version__ = "0.2.2"
4
+ __version__ = "0.2.3"
5
5
 
6
6
 
7
7
  def get_version():
@@ -122,12 +122,6 @@ def _save_consensusXML(self, filename:str):
122
122
  return
123
123
 
124
124
  fh = oms.ConsensusXMLFile()
125
- # check if filename includes any path
126
- if not os.path.isabs(filename):
127
- if self.default_folder is not None:
128
- filename = os.path.join(self.default_folder, filename)
129
- else:
130
- filename = os.path.join(os.getcwd(), filename)
131
125
  fh.store(filename, self.consensus_map)
132
126
  self.logger.info(f"Saved consensus map to {filename}")
133
127
 
@@ -147,6 +147,7 @@ class Study:
147
147
 
148
148
  def __init__(
149
149
  self,
150
+ filename=None,
150
151
  **kwargs,
151
152
  ):
152
153
  """
@@ -156,6 +157,10 @@ class Study:
156
157
  data storage, and processing parameters used for study-level analysis.
157
158
 
158
159
  Parameters:
160
+ filename (str, optional): Path to a .study5 file to load automatically.
161
+ If provided, the default_folder will be set to the
162
+ directory containing this file, and the study will
163
+ be loaded automatically.
159
164
  **kwargs: Keyword arguments for setting study parameters. Can include:
160
165
  - A study_defaults instance to set all parameters at once (pass as params=study_defaults(...))
161
166
  - Individual parameter names and values (see study_defaults for available parameters)
@@ -172,6 +177,20 @@ class Study:
172
177
  """
173
178
  # Initialize default parameters
174
179
 
180
+ # Handle filename parameter for automatic loading
181
+ auto_load_filename = None
182
+ if filename is not None:
183
+ if not filename.endswith('.study5'):
184
+ raise ValueError("filename must be a .study5 file")
185
+ if not os.path.exists(filename):
186
+ raise FileNotFoundError(f"Study file not found: {filename}")
187
+
188
+ # Set default_folder to the directory containing the file if not already specified
189
+ if 'default_folder' not in kwargs:
190
+ kwargs['default_folder'] = os.path.dirname(os.path.abspath(filename))
191
+
192
+ auto_load_filename = filename
193
+
175
194
  # Check if a study_defaults instance was passed
176
195
  if "params" in kwargs and isinstance(kwargs["params"], study_defaults):
177
196
  params = kwargs.pop("params")
@@ -234,6 +253,10 @@ class Study:
234
253
  sink=self.log_sink
235
254
  )
236
255
 
256
+ # Auto-load study file if filename was provided
257
+ if auto_load_filename is not None:
258
+ self.load(filename=auto_load_filename)
259
+
237
260
 
238
261
 
239
262
  # Attach module functions as class methods
@@ -1585,7 +1585,7 @@ wheels = [
1585
1585
 
1586
1586
  [[package]]
1587
1587
  name = "masster"
1588
- version = "0.2.2"
1588
+ version = "0.2.3"
1589
1589
  source = { editable = "." }
1590
1590
  dependencies = [
1591
1591
  { name = "alphabase" },
masster-0.2.2/README.md DELETED
@@ -1,177 +0,0 @@
1
- # MASSter
2
-
3
- **MASSter** is a comprehensive Python package for mass spectrometry data analysis, designed for metabolomics and LC-MS data processing. It provides tools for feature detection, alignment, consensus building, and interactive visualization of mass spectrometry datasets. It is designed to deal with DDA, and hides functionalities for DIA and ZTScan DIA data.
4
-
5
- Most core processing functions are derived from OpenMS. We use the same nomenclature and refer to their documentation for an explanation of the parameters. To a large extent, however, you should be able to use the defaults (=no parameters) when calling processing steps.
6
-
7
- This is a poorly documented, stable branch of the development codebase in use in the Zamboni lab. Novel functionalities will be added based on need and requests.
8
-
9
- ## Features
10
-
11
- - **Mass spectrometry data processing**: Support for multiple file formats (.wiff, .mzML, .raw, .mzpkl)
12
- - **Feature detection and alignment**: Automated chromatographic peak detection and retention time alignment
13
- - **Consensus feature building**: Identification of features across multiple samples
14
- - **Interactive visualizations**: 2D plots, chromatograms, and statistical dashboards
15
- - **Batch processing**: Process entire studies with multiple samples
16
- - **Export capabilities**: MGF export for spectral library searches
17
-
18
- ## Installation
19
-
20
- ```bash
21
- pip install masster
22
- ```
23
-
24
- ## Quick Start
25
-
26
- ### Basic Workflow for analyzing LC-MS study with 2-... samples
27
-
28
- ```python
29
- import masster
30
-
31
- # Initialize the Study object with the default folder
32
- study = masster.Study(default_folder=r'D:\...\mylcms')
33
-
34
- # Load data from folder with raw data, here: WIFF
35
- study.add_folder(r'D:\...\...\...\*.wiff')
36
-
37
- # Align maps
38
- study.align(rt_max_diff=2.0)
39
-
40
- # Find consensus features
41
- study.find_consensus(min_samples=3)
42
-
43
- # Retrieve missing data for quantification
44
- study.fill_chrom(abs_)
45
-
46
- # Integrate according to consensus metadata
47
- study.integrate_chrom()
48
-
49
- # link MS2 across the whole study and export them
50
- study.find_ms2()
51
- study.export_mgf()
52
-
53
- # Save the study to .study5
54
- study.save()
55
- ```
56
-
57
- ### Study-Level Plots
58
-
59
- ```python
60
- # Plot features from multiple samples
61
- study.plot_samples_2d()
62
-
63
- # Plot consensus features
64
- study.plot_consensus_2d()
65
-
66
- # Plot overlaid chromatograms for specific consensus features (use their uid)
67
- study.plot_chrom(uids=[1, 2, 3])
68
- ```
69
-
70
-
71
- ### Single Sample Processing
72
-
73
- ```python
74
- from masster.sample import Sample
75
-
76
- # Load a single sample (mzML, RAW, WIFF)
77
- sample = Sample("path/to/your/file.mzML")
78
-
79
- # Detect features
80
- sample.find_features(chrom_peak_snr=10, noise=500, chrom_fwhm=1.0)
81
-
82
- # Detect adducts
83
- sample.find_adducts()
84
-
85
- # Find MS2 spectra
86
- sample.find_ms2()
87
-
88
- # Save results to .sample5
89
- sample.save()
90
- ```
91
-
92
- Masster provides extensive plotting capabilities for data exploration and quality control:
93
-
94
- ### Single sample visualization
95
-
96
- ```python
97
- # Plot 2D overview of MS data with detected features
98
- sample.plot_2d(
99
- filename="overview_2d.html",
100
- show_features=True,
101
- show_ms2=True,
102
- title="MS Data Overview"
103
- )
104
-
105
- # Plot with feature filtering
106
- sample.plot_2d(
107
- filename="features_ms2_only.html"
108
- )
109
-
110
- # Plot extracted ion chromatogram
111
- sample.plot_eic(
112
- feature_uid=123,
113
- rt_tol=10,
114
- mz_tol=0.005
115
- )
116
- ```
117
-
118
- ### Quality Control Plots
119
-
120
- ```python
121
- # Plot DDA acquisition statistics
122
- sample.plot_dda_stats(filename="dda_stats.html")
123
-
124
- # Plot feature statistics
125
- sample.plot_feature_stats(filename="feature_stats.html")
126
-
127
- # Plot total ion chromatogram
128
- sample.plot_tic(filename="tic.html")
129
- ```
130
-
131
- ### Advanced Plotting Options
132
-
133
- ```python
134
- # Plot with Oracle annotation data
135
- sample.plot_2d_oracle(
136
- oracle_folder="path/to/oracle/results",
137
- colorby="hg", # Color by chemical class
138
- filename="annotated_features.html"
139
- )
140
-
141
- # Plot MS2 cycle view
142
- sample.plot_ms2_cycle(
143
- cycle=100,
144
- filename="ms2_cycle.html",
145
- centroid=True
146
- )
147
- ```
148
-
149
- ## File Format Support
150
-
151
- - **Input formats**: .wiff, .mzML, .raw files
152
- - **Intermediate formats**: .sample5 and .study5 (HDF5) for fast loading
153
- - **Export formats**: .mgf, .csv
154
- - **Visualization**: .html (interactive), .png, .svg
155
-
156
- ## Advanced Features
157
-
158
- ### Batch Processing
159
- Use the command-line interface for processing multiple files:
160
-
161
- ```bash
162
- python -m masster.demo.example_batch_process input_directory --recursive --dest output_directory
163
- ```
164
-
165
- ## Requirements
166
-
167
- - Python ≥ 3.11
168
- - Key dependencies: pandas, polars, numpy, scipy, matplotlib, bokeh, holoviews, panel
169
- - See `pyproject.toml` for complete dependency list
170
-
171
- ## License
172
-
173
- GNU Affero General Public License v3
174
-
175
- ## Citation
176
-
177
- If you use Masster in your research, please cite this repository.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes