masster 0.5.11__tar.gz → 0.5.12__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.11 → masster-0.5.12}/PKG-INFO +1 -1
- {masster-0.5.11 → masster-0.5.12}/pyproject.toml +1 -1
- {masster-0.5.11 → masster-0.5.12}/src/masster/_version.py +1 -1
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/h5.py +41 -2
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/merge.py +4 -9
- {masster-0.5.11 → masster-0.5.12}/uv.lock +1 -1
- {masster-0.5.11 → masster-0.5.12}/.github/workflows/publish.yml +0 -0
- {masster-0.5.11 → masster-0.5.12}/.github/workflows/security.yml +0 -0
- {masster-0.5.11 → masster-0.5.12}/.github/workflows/test.yml +0 -0
- {masster-0.5.11 → masster-0.5.12}/.gitignore +0 -0
- {masster-0.5.11 → masster-0.5.12}/.pre-commit-config.yaml +0 -0
- {masster-0.5.11 → masster-0.5.12}/LICENSE +0 -0
- {masster-0.5.11 → masster-0.5.12}/Makefile +0 -0
- {masster-0.5.11 → masster-0.5.12}/README.md +0 -0
- {masster-0.5.11 → masster-0.5.12}/TESTING.md +0 -0
- {masster-0.5.11 → masster-0.5.12}/demo/example_batch_process.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/demo/example_sample_process.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/__init__.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/chromatogram.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/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.11 → masster-0.5.12}/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.11 → masster-0.5.12}/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.11 → masster-0.5.12}/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.11 → masster-0.5.12}/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.11 → masster-0.5.12}/src/masster/data/libs/aa.csv +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/data/libs/ccm.csv +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/data/libs/hilic.csv +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/data/libs/urine.csv +0 -0
- {masster-0.5.11 → masster-0.5.12}/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.11 → masster-0.5.12}/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.11 → masster-0.5.12}/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.11 → masster-0.5.12}/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.11 → masster-0.5.12}/src/masster/lib/__init__.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/lib/lib.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/logger.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/sample/__init__.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/sample/adducts.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/sample/defaults/__init__.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/sample/defaults/find_adducts_def.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/sample/defaults/find_features_def.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/sample/defaults/find_ms2_def.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/sample/defaults/get_spectrum_def.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/sample/defaults/sample_def.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/sample/h5.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/sample/helpers.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/sample/lib.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/sample/load.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/sample/parameters.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/sample/plot.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/sample/processing.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/sample/quant.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/sample/sample.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/sample/sample5_schema.json +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/sample/save.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/sample/sciex.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/spectrum.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/__init__.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/analysis.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/defaults/__init__.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/defaults/align_def.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/defaults/export_def.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/defaults/fill_def.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/defaults/find_consensus_def.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/defaults/find_ms2_def.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/defaults/identify_def.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/defaults/integrate_chrom_def.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/defaults/integrate_def.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/defaults/merge_def.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/defaults/study_def.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/export.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/helpers.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/id.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/load.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/parameters.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/plot.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/processing.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/save.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/study.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/study/study5_schema.json +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/wizard/README.md +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/wizard/__init__.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/wizard/example.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/src/masster/wizard/wizard.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/tests/conftest.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/tests/test_chromatogram.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/tests/test_defaults.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/tests/test_imports.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/tests/test_integration.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/tests/test_logger.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/tests/test_parameters.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/tests/test_sample.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/tests/test_spectrum.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/tests/test_study.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/tests/test_version.py +0 -0
- {masster-0.5.11 → masster-0.5.12}/tox.ini +0 -0
|
@@ -874,8 +874,47 @@ def _create_dataframe_with_objects(data: dict, object_columns: list) -> pl.DataF
|
|
|
874
874
|
|
|
875
875
|
# Create DataFrame with regular columns first
|
|
876
876
|
if regular_data:
|
|
877
|
-
|
|
878
|
-
#
|
|
877
|
+
# Final safety check: convert any remaining numpy object arrays to Python lists
|
|
878
|
+
# and handle numpy scalars within lists
|
|
879
|
+
safe_regular_data = {}
|
|
880
|
+
import numpy as np
|
|
881
|
+
|
|
882
|
+
def convert_numpy_scalars(value):
|
|
883
|
+
"""Convert numpy scalars to Python native types recursively."""
|
|
884
|
+
if isinstance(value, np.generic):
|
|
885
|
+
return value.item() # Convert numpy scalar to Python scalar
|
|
886
|
+
elif isinstance(value, list):
|
|
887
|
+
return [convert_numpy_scalars(item) for item in value]
|
|
888
|
+
else:
|
|
889
|
+
return value
|
|
890
|
+
|
|
891
|
+
for k, v in regular_data.items():
|
|
892
|
+
if hasattr(v, 'dtype') and str(v.dtype) == 'object':
|
|
893
|
+
# Convert numpy object array to Python list
|
|
894
|
+
safe_regular_data[k] = [convert_numpy_scalars(item) for item in (v.tolist() if hasattr(v, 'tolist') else list(v))]
|
|
895
|
+
elif isinstance(v, list):
|
|
896
|
+
# Handle lists that might contain numpy scalars
|
|
897
|
+
safe_regular_data[k] = [convert_numpy_scalars(item) for item in v]
|
|
898
|
+
else:
|
|
899
|
+
safe_regular_data[k] = convert_numpy_scalars(v)
|
|
900
|
+
|
|
901
|
+
# Create DataFrame with proper error handling
|
|
902
|
+
try:
|
|
903
|
+
df = pl.DataFrame(safe_regular_data)
|
|
904
|
+
except Exception as e:
|
|
905
|
+
# If direct creation fails, try creating column by column to identify and handle problematic columns
|
|
906
|
+
df = pl.DataFrame()
|
|
907
|
+
for k, v in safe_regular_data.items():
|
|
908
|
+
try:
|
|
909
|
+
df = df.with_columns([pl.Series(k, v)])
|
|
910
|
+
except Exception:
|
|
911
|
+
# Skip problematic columns or convert them to string as a fallback
|
|
912
|
+
try:
|
|
913
|
+
df = df.with_columns([pl.Series(k, [str(item) for item in v])])
|
|
914
|
+
except Exception:
|
|
915
|
+
# Last resort: skip the column entirely
|
|
916
|
+
continue
|
|
917
|
+
|
|
879
918
|
# Add Object columns one by one
|
|
880
919
|
for col, values in object_data.items():
|
|
881
920
|
# print(f"DEBUG: Adding object column '{col}', type: {type(values)}, length: {len(values) if values is not None else 'None'}")
|
|
@@ -2255,15 +2255,13 @@ def _perform_adduct_grouping(study, rt_tol, mz_tol):
|
|
|
2255
2255
|
{
|
|
2256
2256
|
"consensus_uid": row["consensus_uid"],
|
|
2257
2257
|
"rt": row["rt"],
|
|
2258
|
-
"mz": row["mz"],
|
|
2258
|
+
"mz": row["mz"],
|
|
2259
2259
|
"adduct_mass_neutral_top": row.get("adduct_mass_neutral_top"),
|
|
2260
2260
|
"adduct_top": row.get("adduct_top"),
|
|
2261
2261
|
"inty_mean": row.get("inty_mean", 0),
|
|
2262
2262
|
},
|
|
2263
2263
|
)
|
|
2264
2264
|
|
|
2265
|
-
# Use optimized adduct grouping
|
|
2266
|
-
#study.logger.info(f"About to call adduct grouping for {len(consensus_data)} consensus features")
|
|
2267
2265
|
adduct_group_list, adduct_of_list = __merge_adduct_grouping(
|
|
2268
2266
|
study, consensus_data, rt_tol/3, mz_tol
|
|
2269
2267
|
)
|
|
@@ -2718,8 +2716,6 @@ def __identify_adduct_by_mass_shift(study, rt_tol, cached_adducts_df=None):
|
|
|
2718
2716
|
study.logger.debug("No consensus features for adduct identification by mass shift")
|
|
2719
2717
|
return
|
|
2720
2718
|
|
|
2721
|
-
study.logger.info(f"Identifying coeluting adducts by mass shifts in {len(study.consensus_df)} consensus features...")
|
|
2722
|
-
|
|
2723
2719
|
# Get adducts DataFrame if not provided
|
|
2724
2720
|
if cached_adducts_df is None or cached_adducts_df.is_empty():
|
|
2725
2721
|
try:
|
|
@@ -3025,8 +3021,7 @@ def __identify_adduct_by_mass_shift(study, rt_tol, cached_adducts_df=None):
|
|
|
3025
3021
|
pl.Series("adduct_mass_neutral_top", new_adduct_mass_neutral_top),
|
|
3026
3022
|
pl.Series("adduct_mass_shift_top", new_adduct_mass_shift_top)
|
|
3027
3023
|
])
|
|
3028
|
-
|
|
3029
|
-
study.logger.info(f"Updated adduct assignments for {updated_count} consensus features based on mass shifts")
|
|
3024
|
+
study.logger.success(f"Adduct information updated for {updated_count} consensus features.")
|
|
3030
3025
|
else:
|
|
3031
3026
|
study.logger.debug("No consensus features updated based on mass shift analysis")
|
|
3032
3027
|
|
|
@@ -3395,7 +3390,7 @@ def __merge_adduct_grouping(study, consensus_data, rt_tol, mz_tol):
|
|
|
3395
3390
|
adduct_of_list = [0] * len(consensus_data)
|
|
3396
3391
|
return adduct_group_list, adduct_of_list
|
|
3397
3392
|
|
|
3398
|
-
study.logger.
|
|
3393
|
+
study.logger.debug(f"Built local intensity matrix: {len(intensity_matrix_pd)} features x {len(intensity_matrix_pd.columns)} samples")
|
|
3399
3394
|
|
|
3400
3395
|
except Exception as e:
|
|
3401
3396
|
study.logger.warning(f"Could not build local intensity matrix: {e}. Creating single-feature groups.")
|
|
@@ -3405,7 +3400,7 @@ def __merge_adduct_grouping(study, consensus_data, rt_tol, mz_tol):
|
|
|
3405
3400
|
|
|
3406
3401
|
# Step 2: Get adduct pairs with likelihood information and build hash map for fast lookup
|
|
3407
3402
|
adduct_pairs_with_likelihood = _get_adduct_deltas_with_likelihood(study)
|
|
3408
|
-
study.logger.
|
|
3403
|
+
study.logger.debug(f"Using {len(adduct_pairs_with_likelihood)} adduct pairs with likelihood scoring")
|
|
3409
3404
|
|
|
3410
3405
|
# Build hash map for O(1) mass shift lookup
|
|
3411
3406
|
mass_shift_map = {} # rounded_delta -> [(likelihood, adduct1, adduct2), ...]
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|