masster 0.5.7__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.
- {masster-0.5.7 → masster-0.5.8}/PKG-INFO +1 -1
- {masster-0.5.7 → masster-0.5.8}/pyproject.toml +1 -1
- {masster-0.5.7 → masster-0.5.8}/src/masster/_version.py +1 -1
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/helpers.py +146 -1
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/id.py +1 -1
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/merge.py +561 -158
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/study.py +2 -1
- {masster-0.5.7 → masster-0.5.8}/uv.lock +1 -1
- {masster-0.5.7 → masster-0.5.8}/.github/workflows/publish.yml +0 -0
- {masster-0.5.7 → masster-0.5.8}/.github/workflows/security.yml +0 -0
- {masster-0.5.7 → masster-0.5.8}/.github/workflows/test.yml +0 -0
- {masster-0.5.7 → masster-0.5.8}/.gitignore +0 -0
- {masster-0.5.7 → masster-0.5.8}/.pre-commit-config.yaml +0 -0
- {masster-0.5.7 → masster-0.5.8}/LICENSE +0 -0
- {masster-0.5.7 → masster-0.5.8}/Makefile +0 -0
- {masster-0.5.7 → masster-0.5.8}/README.md +0 -0
- {masster-0.5.7 → masster-0.5.8}/TESTING.md +0 -0
- {masster-0.5.7 → masster-0.5.8}/demo/example_batch_process.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/demo/example_sample_process.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/__init__.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/chromatogram.py +0 -0
- {masster-0.5.7 → 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
- {masster-0.5.7 → 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
- {masster-0.5.7 → 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
- {masster-0.5.7 → 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
- {masster-0.5.7 → 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
- {masster-0.5.7 → masster-0.5.8}/src/masster/data/libs/aa.csv +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/data/libs/ccm.csv +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/data/libs/hilic.csv +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/data/libs/urine.csv +0 -0
- {masster-0.5.7 → 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
- {masster-0.5.7 → 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
- {masster-0.5.7 → 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
- {masster-0.5.7 → 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
- {masster-0.5.7 → masster-0.5.8}/src/masster/lib/__init__.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/lib/lib.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/logger.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/sample/__init__.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/sample/adducts.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/sample/defaults/__init__.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/sample/defaults/find_adducts_def.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/sample/defaults/find_features_def.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/sample/defaults/find_ms2_def.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/sample/defaults/get_spectrum_def.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/sample/defaults/sample_def.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/sample/h5.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/sample/helpers.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/sample/lib.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/sample/load.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/sample/parameters.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/sample/plot.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/sample/processing.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/sample/quant.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/sample/sample.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/sample/sample5_schema.json +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/sample/save.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/sample/sciex.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/spectrum.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/__init__.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/analysis.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/defaults/__init__.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/defaults/align_def.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/defaults/export_def.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/defaults/fill_def.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/defaults/find_consensus_def.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/defaults/find_ms2_def.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/defaults/identify_def.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/defaults/integrate_chrom_def.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/defaults/integrate_def.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/defaults/merge_def.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/defaults/study_def.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/export.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/h5.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/load.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/parameters.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/plot.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/processing.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/save.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/study/study5_schema.json +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/wizard/README.md +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/wizard/__init__.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/wizard/example.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/src/masster/wizard/wizard.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/tests/conftest.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/tests/test_chromatogram.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/tests/test_defaults.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/tests/test_imports.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/tests/test_integration.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/tests/test_logger.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/tests/test_parameters.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/tests/test_sample.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/tests/test_spectrum.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/tests/test_study.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/tests/test_version.py +0 -0
- {masster-0.5.7 → masster-0.5.8}/tox.ini +0 -0
|
@@ -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
|
|