masster 0.5.6__tar.gz → 0.5.8__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 (95) hide show
  1. {masster-0.5.6 → masster-0.5.8}/PKG-INFO +1 -1
  2. {masster-0.5.6 → masster-0.5.8}/pyproject.toml +1 -1
  3. {masster-0.5.6 → masster-0.5.8}/src/masster/_version.py +1 -1
  4. {masster-0.5.6 → masster-0.5.8}/src/masster/sample/plot.py +4 -6
  5. {masster-0.5.6 → masster-0.5.8}/src/masster/study/defaults/merge_def.py +1 -1
  6. {masster-0.5.6 → masster-0.5.8}/src/masster/study/helpers.py +146 -1
  7. {masster-0.5.6 → masster-0.5.8}/src/masster/study/id.py +1 -1
  8. {masster-0.5.6 → masster-0.5.8}/src/masster/study/merge.py +561 -158
  9. {masster-0.5.6 → masster-0.5.8}/src/masster/study/study.py +2 -1
  10. {masster-0.5.6 → masster-0.5.8}/uv.lock +1 -1
  11. {masster-0.5.6 → masster-0.5.8}/.github/workflows/publish.yml +0 -0
  12. {masster-0.5.6 → masster-0.5.8}/.github/workflows/security.yml +0 -0
  13. {masster-0.5.6 → masster-0.5.8}/.github/workflows/test.yml +0 -0
  14. {masster-0.5.6 → masster-0.5.8}/.gitignore +0 -0
  15. {masster-0.5.6 → masster-0.5.8}/.pre-commit-config.yaml +0 -0
  16. {masster-0.5.6 → masster-0.5.8}/LICENSE +0 -0
  17. {masster-0.5.6 → masster-0.5.8}/Makefile +0 -0
  18. {masster-0.5.6 → masster-0.5.8}/README.md +0 -0
  19. {masster-0.5.6 → masster-0.5.8}/TESTING.md +0 -0
  20. {masster-0.5.6 → masster-0.5.8}/demo/example_batch_process.py +0 -0
  21. {masster-0.5.6 → masster-0.5.8}/demo/example_sample_process.py +0 -0
  22. {masster-0.5.6 → masster-0.5.8}/src/masster/__init__.py +0 -0
  23. {masster-0.5.6 → masster-0.5.8}/src/masster/chromatogram.py +0 -0
  24. {masster-0.5.6 → masster-0.5.8}/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
  25. {masster-0.5.6 → masster-0.5.8}/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
  26. {masster-0.5.6 → masster-0.5.8}/src/masster/data/dda/20250530_VH_IQX_KW_RP_HSST3_100mm_12min_pos_v4_MS1_C-MiLUT_C008_v6_r38_01.sample5 +0 -0
  27. {masster-0.5.6 → masster-0.5.8}/src/masster/data/dda/20250530_VH_IQX_KW_RP_HSST3_100mm_12min_pos_v4_MS1_C-MiLUT_C008_v7_r37_01.sample5 +0 -0
  28. {masster-0.5.6 → masster-0.5.8}/src/masster/data/dda/20250530_VH_IQX_KW_RP_HSST3_100mm_12min_pos_v4_MS1_C-MiLUT_C017_v5_r99_01.sample5 +0 -0
  29. {masster-0.5.6 → masster-0.5.8}/src/masster/data/libs/aa.csv +0 -0
  30. {masster-0.5.6 → masster-0.5.8}/src/masster/data/libs/ccm.csv +0 -0
  31. {masster-0.5.6 → masster-0.5.8}/src/masster/data/libs/hilic.csv +0 -0
  32. {masster-0.5.6 → masster-0.5.8}/src/masster/data/libs/urine.csv +0 -0
  33. {masster-0.5.6 → masster-0.5.8}/src/masster/data/wiff/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.timeseries.data +0 -0
  34. {masster-0.5.6 → masster-0.5.8}/src/masster/data/wiff/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.wiff +0 -0
  35. {masster-0.5.6 → masster-0.5.8}/src/masster/data/wiff/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.wiff.scan +0 -0
  36. {masster-0.5.6 → masster-0.5.8}/src/masster/data/wiff/2025_01_14_VW_7600_LpMx_DBS_CID_2min_TOP15_030msecMS1_005msecReac_CE35_DBS-ON_3.wiff2 +0 -0
  37. {masster-0.5.6 → masster-0.5.8}/src/masster/lib/__init__.py +0 -0
  38. {masster-0.5.6 → masster-0.5.8}/src/masster/lib/lib.py +0 -0
  39. {masster-0.5.6 → masster-0.5.8}/src/masster/logger.py +0 -0
  40. {masster-0.5.6 → masster-0.5.8}/src/masster/sample/__init__.py +0 -0
  41. {masster-0.5.6 → masster-0.5.8}/src/masster/sample/adducts.py +0 -0
  42. {masster-0.5.6 → masster-0.5.8}/src/masster/sample/defaults/__init__.py +0 -0
  43. {masster-0.5.6 → masster-0.5.8}/src/masster/sample/defaults/find_adducts_def.py +0 -0
  44. {masster-0.5.6 → masster-0.5.8}/src/masster/sample/defaults/find_features_def.py +0 -0
  45. {masster-0.5.6 → masster-0.5.8}/src/masster/sample/defaults/find_ms2_def.py +0 -0
  46. {masster-0.5.6 → masster-0.5.8}/src/masster/sample/defaults/get_spectrum_def.py +0 -0
  47. {masster-0.5.6 → masster-0.5.8}/src/masster/sample/defaults/sample_def.py +0 -0
  48. {masster-0.5.6 → masster-0.5.8}/src/masster/sample/h5.py +0 -0
  49. {masster-0.5.6 → masster-0.5.8}/src/masster/sample/helpers.py +0 -0
  50. {masster-0.5.6 → masster-0.5.8}/src/masster/sample/lib.py +0 -0
  51. {masster-0.5.6 → masster-0.5.8}/src/masster/sample/load.py +0 -0
  52. {masster-0.5.6 → masster-0.5.8}/src/masster/sample/parameters.py +0 -0
  53. {masster-0.5.6 → masster-0.5.8}/src/masster/sample/processing.py +0 -0
  54. {masster-0.5.6 → masster-0.5.8}/src/masster/sample/quant.py +0 -0
  55. {masster-0.5.6 → masster-0.5.8}/src/masster/sample/sample.py +0 -0
  56. {masster-0.5.6 → masster-0.5.8}/src/masster/sample/sample5_schema.json +0 -0
  57. {masster-0.5.6 → masster-0.5.8}/src/masster/sample/save.py +0 -0
  58. {masster-0.5.6 → masster-0.5.8}/src/masster/sample/sciex.py +0 -0
  59. {masster-0.5.6 → masster-0.5.8}/src/masster/spectrum.py +0 -0
  60. {masster-0.5.6 → masster-0.5.8}/src/masster/study/__init__.py +0 -0
  61. {masster-0.5.6 → masster-0.5.8}/src/masster/study/analysis.py +0 -0
  62. {masster-0.5.6 → masster-0.5.8}/src/masster/study/defaults/__init__.py +0 -0
  63. {masster-0.5.6 → masster-0.5.8}/src/masster/study/defaults/align_def.py +0 -0
  64. {masster-0.5.6 → masster-0.5.8}/src/masster/study/defaults/export_def.py +0 -0
  65. {masster-0.5.6 → masster-0.5.8}/src/masster/study/defaults/fill_def.py +0 -0
  66. {masster-0.5.6 → masster-0.5.8}/src/masster/study/defaults/find_consensus_def.py +0 -0
  67. {masster-0.5.6 → masster-0.5.8}/src/masster/study/defaults/find_ms2_def.py +0 -0
  68. {masster-0.5.6 → masster-0.5.8}/src/masster/study/defaults/identify_def.py +0 -0
  69. {masster-0.5.6 → masster-0.5.8}/src/masster/study/defaults/integrate_chrom_def.py +0 -0
  70. {masster-0.5.6 → masster-0.5.8}/src/masster/study/defaults/integrate_def.py +0 -0
  71. {masster-0.5.6 → masster-0.5.8}/src/masster/study/defaults/study_def.py +0 -0
  72. {masster-0.5.6 → masster-0.5.8}/src/masster/study/export.py +0 -0
  73. {masster-0.5.6 → masster-0.5.8}/src/masster/study/h5.py +0 -0
  74. {masster-0.5.6 → masster-0.5.8}/src/masster/study/load.py +0 -0
  75. {masster-0.5.6 → masster-0.5.8}/src/masster/study/parameters.py +0 -0
  76. {masster-0.5.6 → masster-0.5.8}/src/masster/study/plot.py +0 -0
  77. {masster-0.5.6 → masster-0.5.8}/src/masster/study/processing.py +0 -0
  78. {masster-0.5.6 → masster-0.5.8}/src/masster/study/save.py +0 -0
  79. {masster-0.5.6 → masster-0.5.8}/src/masster/study/study5_schema.json +0 -0
  80. {masster-0.5.6 → masster-0.5.8}/src/masster/wizard/README.md +0 -0
  81. {masster-0.5.6 → masster-0.5.8}/src/masster/wizard/__init__.py +0 -0
  82. {masster-0.5.6 → masster-0.5.8}/src/masster/wizard/example.py +0 -0
  83. {masster-0.5.6 → masster-0.5.8}/src/masster/wizard/wizard.py +0 -0
  84. {masster-0.5.6 → masster-0.5.8}/tests/conftest.py +0 -0
  85. {masster-0.5.6 → masster-0.5.8}/tests/test_chromatogram.py +0 -0
  86. {masster-0.5.6 → masster-0.5.8}/tests/test_defaults.py +0 -0
  87. {masster-0.5.6 → masster-0.5.8}/tests/test_imports.py +0 -0
  88. {masster-0.5.6 → masster-0.5.8}/tests/test_integration.py +0 -0
  89. {masster-0.5.6 → masster-0.5.8}/tests/test_logger.py +0 -0
  90. {masster-0.5.6 → masster-0.5.8}/tests/test_parameters.py +0 -0
  91. {masster-0.5.6 → masster-0.5.8}/tests/test_sample.py +0 -0
  92. {masster-0.5.6 → masster-0.5.8}/tests/test_spectrum.py +0 -0
  93. {masster-0.5.6 → masster-0.5.8}/tests/test_study.py +0 -0
  94. {masster-0.5.6 → masster-0.5.8}/tests/test_version.py +0 -0
  95. {masster-0.5.6 → masster-0.5.8}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: masster
3
- Version: 0.5.6
3
+ Version: 0.5.8
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,7 +1,7 @@
1
1
 
2
2
  [project]
3
3
  name = "masster"
4
- version = "0.5.6"
4
+ version = "0.5.8"
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.5.6"
4
+ __version__ = "0.5.8"
5
5
 
6
6
 
7
7
  def get_version():
@@ -86,8 +86,6 @@ def _process_cmap(cmap, fallback="viridis", logger=None):
86
86
  cmap = "viridis"
87
87
  elif cmap == "grey":
88
88
  cmap = "Greys256"
89
- elif cmap == "iridescent":
90
- cmap = "iridescent_r"
91
89
 
92
90
  # If cmap package is not available, fall back to process_cmap
93
91
  if Colormap is None:
@@ -455,15 +453,15 @@ def plot_2d(
455
453
  show_ms2=False,
456
454
  show_in_browser=False,
457
455
  title=None,
458
- cmap=None,
456
+ cmap='iridescent',
459
457
  marker="circle",
460
- markersize=10,
458
+ markersize=5,
461
459
  size="static",
462
460
  raster_dynamic=True,
463
461
  raster_max_px=8,
464
462
  raster_threshold=0.8,
465
463
  height=600,
466
- width=800,
464
+ width=750,
467
465
  mz_range=None,
468
466
  rt_range=None
469
467
  ):
@@ -529,7 +527,7 @@ def plot_2d(
529
527
  return
530
528
 
531
529
  # Process colormap using the cmap package
532
- cmap_palette = _process_cmap(cmap, fallback="iridescent_r", logger=self.logger)
530
+ cmap_palette = _process_cmap(cmap, fallback="iridescent", logger=self.logger)
533
531
 
534
532
  # get columns rt, mz, inty from self.ms1_df, It's polars DataFrame
535
533
  spectradf = self.ms1_df.select(["rt", "mz", "inty"])
@@ -25,7 +25,7 @@ class merge_defaults:
25
25
  link_ms2 (bool): Whether to link MS2 spectra to consensus features. Default is True.
26
26
  """
27
27
 
28
- method: str = "kd"
28
+ method: str = "qt"
29
29
  min_samples: int = 2
30
30
  rt_tol: float = 5.0
31
31
  mz_tol: float = 0.05
@@ -2956,6 +2956,17 @@ def consensus_select(
2956
2956
  rt_delta_mean=None,
2957
2957
  id_top_score=None,
2958
2958
  identified=None,
2959
+ # New adduct filter parameters
2960
+ adduct_top=None,
2961
+ adduct_charge_top=None,
2962
+ adduct_mass_neutral_top=None,
2963
+ adduct_mass_shift_top=None,
2964
+ adduct_group=None,
2965
+ adduct_of=None,
2966
+ # New identification filter parameters
2967
+ id_top_name=None,
2968
+ id_top_class=None,
2969
+ id_top_adduct=None,
2959
2970
  sortby=None,
2960
2971
  descending=True,
2961
2972
  ):
@@ -2990,6 +3001,17 @@ def consensus_select(
2990
3001
  - True: select only rows with id_top_name not null
2991
3002
  - False: select only rows with id_top_name null
2992
3003
  - None: no filtering (default)
3004
+ # New adduct filter parameters
3005
+ adduct_top: adduct type filter (list or single string value, e.g. "[M+H]+", "[M+Na]+")
3006
+ adduct_charge_top: adduct charge filter (tuple for range, single value for exact match)
3007
+ adduct_mass_neutral_top: neutral mass filter (tuple for range, single value for minimum)
3008
+ adduct_mass_shift_top: adduct mass shift filter (tuple for range, single value for minimum)
3009
+ adduct_group: adduct group ID filter (list, single value, or tuple for range)
3010
+ adduct_of: adduct representative UID filter (list, single value, or tuple for range)
3011
+ # New identification filter parameters
3012
+ id_top_name: identification name filter (list or single string value for compound names)
3013
+ id_top_class: identification class filter (list or single string value for compound classes)
3014
+ id_top_adduct: identification adduct filter (list or single string value for identified adducts)
2993
3015
  sortby: column name(s) to sort by (string, list of strings, or None for no sorting)
2994
3016
  descending: sort direction (True for descending, False for ascending, default is True)
2995
3017
 
@@ -3004,7 +3026,10 @@ def consensus_select(
3004
3026
  filter_params = [mz, rt, inty_mean, consensus_uid, consensus_id, number_samples,
3005
3027
  number_ms2, quality, bl, chrom_coherence_mean, chrom_prominence_mean,
3006
3028
  chrom_prominence_scaled_mean, chrom_height_scaled_mean,
3007
- rt_delta_mean, id_top_score, identified]
3029
+ rt_delta_mean, id_top_score, identified,
3030
+ # New adduct and identification parameters
3031
+ adduct_top, adduct_charge_top, adduct_mass_neutral_top, adduct_mass_shift_top,
3032
+ adduct_group, adduct_of, id_top_name, id_top_class, id_top_adduct]
3008
3033
 
3009
3034
  if all(param is None for param in filter_params) and sortby is None:
3010
3035
  return self.consensus_df.clone()
@@ -3132,6 +3157,126 @@ def consensus_select(
3132
3157
  else:
3133
3158
  warnings.append("'id_top_name' column not found in consensus_df")
3134
3159
 
3160
+ # Handle adduct_top filter (string or list)
3161
+ if adduct_top is not None:
3162
+ if "adduct_top" in available_columns:
3163
+ if isinstance(adduct_top, list):
3164
+ filter_conditions.append(pl.col("adduct_top").is_in(adduct_top))
3165
+ else:
3166
+ filter_conditions.append(pl.col("adduct_top") == adduct_top)
3167
+ else:
3168
+ warnings.append("'adduct_top' column not found in consensus_df")
3169
+
3170
+ # Handle adduct_charge_top filter (single value, range tuple, or list)
3171
+ if adduct_charge_top is not None:
3172
+ if "adduct_charge_top" in available_columns:
3173
+ if isinstance(adduct_charge_top, tuple) and len(adduct_charge_top) == 2:
3174
+ filter_conditions.append(
3175
+ (pl.col("adduct_charge_top") >= adduct_charge_top[0]) &
3176
+ (pl.col("adduct_charge_top") <= adduct_charge_top[1])
3177
+ )
3178
+ elif isinstance(adduct_charge_top, list):
3179
+ filter_conditions.append(pl.col("adduct_charge_top").is_in(adduct_charge_top))
3180
+ else:
3181
+ filter_conditions.append(pl.col("adduct_charge_top") == adduct_charge_top)
3182
+ else:
3183
+ warnings.append("'adduct_charge_top' column not found in consensus_df")
3184
+
3185
+ # Handle adduct_mass_neutral_top filter (single value, range tuple, or list)
3186
+ if adduct_mass_neutral_top is not None:
3187
+ if "adduct_mass_neutral_top" in available_columns:
3188
+ if isinstance(adduct_mass_neutral_top, tuple) and len(adduct_mass_neutral_top) == 2:
3189
+ filter_conditions.append(
3190
+ (pl.col("adduct_mass_neutral_top") >= adduct_mass_neutral_top[0]) &
3191
+ (pl.col("adduct_mass_neutral_top") <= adduct_mass_neutral_top[1])
3192
+ )
3193
+ elif isinstance(adduct_mass_neutral_top, list):
3194
+ filter_conditions.append(pl.col("adduct_mass_neutral_top").is_in(adduct_mass_neutral_top))
3195
+ else:
3196
+ filter_conditions.append(pl.col("adduct_mass_neutral_top") == adduct_mass_neutral_top)
3197
+ else:
3198
+ warnings.append("'adduct_mass_neutral_top' column not found in consensus_df")
3199
+
3200
+ # Handle adduct_mass_shift_top filter (single value, range tuple, or list)
3201
+ if adduct_mass_shift_top is not None:
3202
+ if "adduct_mass_shift_top" in available_columns:
3203
+ if isinstance(adduct_mass_shift_top, tuple) and len(adduct_mass_shift_top) == 2:
3204
+ filter_conditions.append(
3205
+ (pl.col("adduct_mass_shift_top") >= adduct_mass_shift_top[0]) &
3206
+ (pl.col("adduct_mass_shift_top") <= adduct_mass_shift_top[1])
3207
+ )
3208
+ elif isinstance(adduct_mass_shift_top, list):
3209
+ filter_conditions.append(pl.col("adduct_mass_shift_top").is_in(adduct_mass_shift_top))
3210
+ else:
3211
+ filter_conditions.append(pl.col("adduct_mass_shift_top") == adduct_mass_shift_top)
3212
+ else:
3213
+ warnings.append("'adduct_mass_shift_top' column not found in consensus_df")
3214
+
3215
+ # Handle adduct_group filter (single value or list)
3216
+ if adduct_group is not None:
3217
+ if "adduct_group" in available_columns:
3218
+ if isinstance(adduct_group, list):
3219
+ filter_conditions.append(pl.col("adduct_group").is_in(adduct_group))
3220
+ else:
3221
+ filter_conditions.append(pl.col("adduct_group") == adduct_group)
3222
+ else:
3223
+ warnings.append("'adduct_group' column not found in consensus_df")
3224
+
3225
+ # Handle adduct_of filter (single value or list)
3226
+ if adduct_of is not None:
3227
+ if "adduct_of" in available_columns:
3228
+ if isinstance(adduct_of, list):
3229
+ filter_conditions.append(pl.col("adduct_of").is_in(adduct_of))
3230
+ else:
3231
+ filter_conditions.append(pl.col("adduct_of") == adduct_of)
3232
+ else:
3233
+ warnings.append("'adduct_of' column not found in consensus_df")
3234
+
3235
+ # Handle id_top_name filter (string or list)
3236
+ if id_top_name is not None:
3237
+ if "id_top_name" in available_columns:
3238
+ if isinstance(id_top_name, list):
3239
+ filter_conditions.append(pl.col("id_top_name").is_in(id_top_name))
3240
+ else:
3241
+ filter_conditions.append(pl.col("id_top_name") == id_top_name)
3242
+ else:
3243
+ warnings.append("'id_top_name' column not found in consensus_df")
3244
+
3245
+ # Handle id_top_class filter (string or list)
3246
+ if id_top_class is not None:
3247
+ if "id_top_class" in available_columns:
3248
+ if isinstance(id_top_class, list):
3249
+ filter_conditions.append(pl.col("id_top_class").is_in(id_top_class))
3250
+ else:
3251
+ filter_conditions.append(pl.col("id_top_class") == id_top_class)
3252
+ else:
3253
+ warnings.append("'id_top_class' column not found in consensus_df")
3254
+
3255
+ # Handle id_top_adduct filter (string or list)
3256
+ if id_top_adduct is not None:
3257
+ if "id_top_adduct" in available_columns:
3258
+ if isinstance(id_top_adduct, list):
3259
+ filter_conditions.append(pl.col("id_top_adduct").is_in(id_top_adduct))
3260
+ else:
3261
+ filter_conditions.append(pl.col("id_top_adduct") == id_top_adduct)
3262
+ else:
3263
+ warnings.append("'id_top_adduct' column not found in consensus_df")
3264
+
3265
+ # Handle id_top_score filter (single value, range tuple, or list)
3266
+ if id_top_score is not None:
3267
+ if "id_top_score" in available_columns:
3268
+ if isinstance(id_top_score, tuple) and len(id_top_score) == 2:
3269
+ filter_conditions.append(
3270
+ (pl.col("id_top_score") >= id_top_score[0]) &
3271
+ (pl.col("id_top_score") <= id_top_score[1])
3272
+ )
3273
+ elif isinstance(id_top_score, list):
3274
+ filter_conditions.append(pl.col("id_top_score").is_in(id_top_score))
3275
+ else:
3276
+ filter_conditions.append(pl.col("id_top_score") == id_top_score)
3277
+ else:
3278
+ warnings.append("'id_top_score' column not found in consensus_df")
3279
+
3135
3280
  # Log warnings once
3136
3281
  for warning in warnings:
3137
3282
  self.logger.warning(warning)
@@ -1201,7 +1201,7 @@ def lib_reset(study):
1201
1201
  logger.info("Library and identification data reset completed")
1202
1202
 
1203
1203
 
1204
- def _get_adducts(study, adducts_list: list = None, **kwargs):
1204
+ def _get_adducts(study, adducts_list: list | None = None, **kwargs):
1205
1205
  """
1206
1206
  Generate comprehensive adduct specifications for study-level adduct filtering.
1207
1207