masster 0.2.2__py3-none-any.whl → 0.2.3__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 CHANGED
@@ -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():
masster/study/save.py CHANGED
@@ -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
 
masster/study/study.py CHANGED
@@ -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
@@ -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
@@ -1,5 +1,5 @@
1
1
  masster/__init__.py,sha256=xeh-hwR_2umE0CpRXn8t22wbkt4IT-FBEzeJknL8J6c,670
2
- masster/_version.py,sha256=CE1l1ajIZe8NnlO_z6wnQkbMvTvA7ky9zk-mlENBeo4,239
2
+ masster/_version.py,sha256=-QmvlpTZa_4FtjijQydS9z8bCyNLc0Gv3QiTHg5Ncro,239
3
3
  masster/chromatogram.py,sha256=f25rMrNvCQN0A93wp9QPdG3H4FiOlYPbRY3H4yd7Q5Y,18910
4
4
  masster/logger.py,sha256=9uzuVEPwQkVlnsqT_eVvh33FZY_FIm3Wn2TaJcGhZP8,10674
5
5
  masster/spectrum.py,sha256=XiClDcN1uiG-_2TIr7Bqp7x8gWvHPbC5oh3zUu3fr6Y,46789
@@ -32,8 +32,8 @@ masster/study/load.py,sha256=rTmm5E-UsTg0SJqwa4i4II5ca82m8OEn05yWW2G_YPc,38718
32
32
  masster/study/parameters.py,sha256=iKCIf7_bivi0Jkz4hreKmCyusXpQX5IIuuhnmS52-Q4,3177
33
33
  masster/study/plot.py,sha256=nY6zWKUOhlyDHra4BI0c8dx7PX5fHFW8v2Ma9YpscvU,21437
34
34
  masster/study/processing.py,sha256=PjfpsVASaR0uSE4vqKzBppq4jM3HexzbGw_bn5kDwdA,42552
35
- masster/study/save.py,sha256=hfbYoGMaBwKPvoTm5eV3OJoSw7o3Rbed68S4RaEz1I8,5053
36
- masster/study/study.py,sha256=jScjivP6UyBvF_BoNpPeJq2Q_ON0wtPxCVldqAEwCOU,20376
35
+ masster/study/save.py,sha256=_DmnAwhlZQRNeVDLNER63pXVhinV-poKMvJlIz6Bt-Y,4791
36
+ masster/study/study.py,sha256=gXc1j4wljbw-Zx-JPsyYO86EoXPaR0N7D2GepJZOPhA,21530
37
37
  masster/study/study5_schema.json,sha256=7LfsgI-dZGpoaPiAy0kh6gDJL4yKuA7-7PHbo9j4A6E,4630
38
38
  masster/study/defaults/__init__.py,sha256=wkul1Qq83nPHI5XebWvu3yKjp5tF8OdZDJJho8r2_qA,569
39
39
  masster/study/defaults/align_def.py,sha256=8Itwit6gaqVhF9A3w9V-uqgKlcQE6uCXyC3ul_gPWFo,8872
@@ -43,8 +43,8 @@ masster/study/defaults/find_consensus_def.py,sha256=artvErq4w07SfHB0WHi68ZjxGg0X
43
43
  masster/study/defaults/find_ms2_def.py,sha256=k-GmnCKgQuVO6M-EAjzGOqgdFrqZviRaNAdiFmwVujY,4907
44
44
  masster/study/defaults/integrate_chrom_def.py,sha256=FY9QdJpdWe18sYucrwNKoZYY0eoOo0a_hcdkZHm_W00,7107
45
45
  masster/study/defaults/study_def.py,sha256=SzUzd2YTGDGCHNMR-Dw57j5PprEnPhpITonv7wx6HQA,9035
46
- masster-0.2.2.dist-info/METADATA,sha256=YDUoFk7NrZYKgoPNkStSPn7G9jCbtKrLxxa9Q-fBKF8,47089
47
- masster-0.2.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
48
- masster-0.2.2.dist-info/entry_points.txt,sha256=ZHguQ_vPmdbpqq2uGtmEOLJfgP-DQ1T0c07Lxh30wc8,58
49
- masster-0.2.2.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
50
- masster-0.2.2.dist-info/RECORD,,
46
+ masster-0.2.3.dist-info/METADATA,sha256=hYc0JozT_r5KPMj4znX9ee0omRbd1p8sK9SU9OaIEm8,44324
47
+ masster-0.2.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
48
+ masster-0.2.3.dist-info/entry_points.txt,sha256=ZHguQ_vPmdbpqq2uGtmEOLJfgP-DQ1T0c07Lxh30wc8,58
49
+ masster-0.2.3.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
50
+ masster-0.2.3.dist-info/RECORD,,