masster 0.5.23__py3-none-any.whl → 0.5.24__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.5.23"
4
+ __version__ = "0.5.24"
5
5
 
6
6
 
7
7
  def get_version():
masster/study/h5.py CHANGED
@@ -717,11 +717,33 @@ def _reconstruct_object_column(data_col, col_name: str):
717
717
  # Handle isotope patterns (numpy arrays with [mz, intensity] data)
718
718
  try:
719
719
  import numpy as np
720
-
721
- iso_data = json.loads(item)
722
- # Convert back to numpy array
723
- reconstructed_data.append(np.array(iso_data) if iso_data else None)
724
- except (json.JSONDecodeError, ValueError, ImportError):
720
+
721
+ # Try JSON parsing first (new format)
722
+ try:
723
+ iso_data = json.loads(item)
724
+ # Convert back to numpy array
725
+ reconstructed_data.append(np.array(iso_data) if iso_data else None)
726
+ except json.JSONDecodeError:
727
+ # Handle numpy array string representation (old format)
728
+ # This handles strings like "[[ 875.7865 447675. ]\n [ 876.7902 168819. ]]"
729
+ try:
730
+ # Use numpy's string representation parser
731
+ iso_array = np.fromstring(item.replace('[', '').replace(']', '').replace('\n', ' '), sep=' ')
732
+ # Reshape to 2D array (pairs of mz, intensity)
733
+ if len(iso_array) % 2 == 0:
734
+ iso_array = iso_array.reshape(-1, 2)
735
+ reconstructed_data.append(iso_array)
736
+ else:
737
+ reconstructed_data.append(None)
738
+ except (ValueError, AttributeError):
739
+ # If all else fails, try to evaluate the string as a literal
740
+ try:
741
+ import ast
742
+ iso_data = ast.literal_eval(item)
743
+ reconstructed_data.append(np.array(iso_data) if iso_data else None)
744
+ except (ValueError, SyntaxError):
745
+ reconstructed_data.append(None)
746
+ except (ValueError, ImportError):
725
747
  reconstructed_data.append(None)
726
748
  elif col_name == "ms1_spec":
727
749
  # Handle MS1 spectra patterns (numpy arrays with [mz, intensity] data)
@@ -1952,10 +1974,15 @@ def _load_study5(self, filename=None):
1952
1974
  f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]} | INFO | {self.log_label}Loading consensus",
1953
1975
  )
1954
1976
  if "consensus" in f and len(f["consensus"].keys()) > 0:
1955
- # Only include adducts in object_columns if it actually exists in the file
1977
+ # Only include object columns if they actually exist in the file
1956
1978
  object_columns = []
1957
- if "adducts" in f["consensus"]:
1958
- object_columns.append("adducts")
1979
+ try:
1980
+ if "adducts" in f["consensus"]:
1981
+ object_columns.append("adducts")
1982
+ if "iso" in f["consensus"]:
1983
+ object_columns.append("iso")
1984
+ except (KeyError, TypeError):
1985
+ pass
1959
1986
 
1960
1987
  self.consensus_df = _load_dataframe_from_group(
1961
1988
  f["consensus"],
masster/wizard/wizard.py CHANGED
@@ -526,7 +526,7 @@ class Wizard:
526
526
  " # === Processing Parameters ===",
527
527
  f' "adducts": {self.params.adducts!r}, # Adduct specifications for feature detection and annotation',
528
528
  f' "noise": {noise}, # Noise threshold for feature detection',
529
- f' "chrom_fwhm": {self.params.chrom_fwhm}, # Chromatographic peak full width at half maximum (seconds)',
529
+ f' "chrom_fwhm": {chrom_fwhm}, # Chromatographic peak full width at half maximum (seconds)',
530
530
  f' "chrom_peak_snr": {self.params.chrom_peak_snr}, # Minimum signal-to-noise ratio for chromatographic peaks',
531
531
  "",
532
532
  " # === Alignment & Merging ===",
@@ -1267,7 +1267,7 @@ class Wizard:
1267
1267
  " )",
1268
1268
  " sample.find_adducts(adducts=PARAMS['adducts'])",
1269
1269
  " sample.find_ms2()",
1270
- " # sample.find_iso()",
1270
+ " sample.find_iso()",
1271
1271
  " # sample.export_mgf()",
1272
1272
  " # sample.export_mztab()",
1273
1273
  ' # sample.plot_2d(filename="{sample_name}.html")',
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: masster
3
- Version: 0.5.23
3
+ Version: 0.5.24
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
@@ -1,5 +1,5 @@
1
1
  masster/__init__.py,sha256=B7zftzdElF2Wb5B7KvkD6TONnMIY-Jxeen3s49dgmzs,1029
2
- masster/_version.py,sha256=AAUbq19nHieC5cNn0e7AMQbQcm3CFM5qt-dNA9Bc6e0,257
2
+ masster/_version.py,sha256=koihKimRza_kbnrpmX9DP_9ctG8yI80eHbJh5pY2xPs,257
3
3
  masster/chromatogram.py,sha256=iYpdv8C17zVnlWvOFgAn9ns2uFGiF-GgoYf5QVVAbHs,19319
4
4
  masster/logger.py,sha256=oHEFPH1LzBHbmeP9WFaRZCWyqd14GasJjZMLI8a4O3I,19439
5
5
  masster/spectrum.py,sha256=LlmxrI5MFS3aPrGSdqUSKVY0rJnKeBh3Frdh6a4dPvA,49722
@@ -36,7 +36,7 @@ masster/sample/defaults/sample_def.py,sha256=MWWeEexGG2Ahbs-id4uq2doIgH-Ja96GioX
36
36
  masster/study/__init__.py,sha256=55axdFuqRX4aXtJ8ocnhcLB32fNtmmJpCi58moO0r4g,237
37
37
  masster/study/analysis.py,sha256=bf2o_ywvwdPz1mZAHPETCPjWbvhoL9eEl1rLaz46Rp4,82032
38
38
  masster/study/export.py,sha256=63xP7pPBNsrAKWZP6XnqAyWO4lEfqtqKfO0SafNvzyg,58871
39
- masster/study/h5.py,sha256=XZDhMNGEt8D5ueyDEFfzhcpSduux8CfWGZK6AcDA5kk,97447
39
+ masster/study/h5.py,sha256=gJRWNQxBTyFKD3qRmEbM24YZ-HdyUk-veYgwQbK0eoE,99104
40
40
  masster/study/helpers.py,sha256=pRcVvGmm6NX-GEvWfYZXZjGc_C0WyklqSQx1PdpYn2E,189694
41
41
  masster/study/id.py,sha256=dTMNdBE7eOQZdFSU0KZwd7vFpqOmNlQnLI0VGW98y8w,89570
42
42
  masster/study/importers.py,sha256=iOe9w6uEn39ShosRms8n_zIrsSBczb51CAMoMrxSUw4,13587
@@ -60,9 +60,9 @@ masster/study/defaults/integrate_def.py,sha256=Vf4SAzdBfnsSZ3IRaF0qZvWu3gMDPHdgP
60
60
  masster/study/defaults/merge_def.py,sha256=99TJtIk7mSoq8NMJMJ4b-cy7gUUixQN69krxttBnkfA,12899
61
61
  masster/study/defaults/study_def.py,sha256=xXOAcb8hez0woWwA1_T3fcokjiLJkq3hwA3OS6elb6I,15965
62
62
  masster/wizard/__init__.py,sha256=L9G_datyGSFJjrBVklEVpZVLGXzUhDiWobtiygBH8vQ,669
63
- masster/wizard/wizard.py,sha256=9lGqslH5OTwktS_nnP-Nymh74kyRlYUpdnhmfhKBXBU,66497
64
- masster-0.5.23.dist-info/METADATA,sha256=4Ilme9EZdtcP_0UvMKczmzMgbyw-JRT9ACtGy5hcSlw,45970
65
- masster-0.5.23.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
66
- masster-0.5.23.dist-info/entry_points.txt,sha256=ZHguQ_vPmdbpqq2uGtmEOLJfgP-DQ1T0c07Lxh30wc8,58
67
- masster-0.5.23.dist-info/licenses/LICENSE,sha256=bx5iLIKjgAdYQ7sISn7DsfHRKkoCUm1154sJJKhgqnU,35184
68
- masster-0.5.23.dist-info/RECORD,,
63
+ masster/wizard/wizard.py,sha256=11utDrZSt7R8D16Sl-NbRKHcgzhQEu8gW_q2V02-Qi0,66483
64
+ masster-0.5.24.dist-info/METADATA,sha256=QH2sJUX_6eW2B9eTFg7T7G--9WTbTqzsrT_UQxxPSs0,45970
65
+ masster-0.5.24.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
66
+ masster-0.5.24.dist-info/entry_points.txt,sha256=ZHguQ_vPmdbpqq2uGtmEOLJfgP-DQ1T0c07Lxh30wc8,58
67
+ masster-0.5.24.dist-info/licenses/LICENSE,sha256=bx5iLIKjgAdYQ7sISn7DsfHRKkoCUm1154sJJKhgqnU,35184
68
+ masster-0.5.24.dist-info/RECORD,,