From fb9e1b669efef8289b33488e2489964c9954a2c9 Mon Sep 17 00:00:00 2001 From: Leonardo Schwarz Date: Tue, 12 Nov 2024 15:36:54 +0100 Subject: [PATCH] use the new panel processing in the workflow --- .../workflow/rules/rules_prepare_pipeline.smk | 12 --------- .../workflow/rules/rules_proc.smk | 25 +------------------ .../workflow/rules/rules_qc.smk | 8 +++--- .../workflow/rules/rules_simulate.smk | 5 ++-- .../workflow/rules/rules_vis.smk | 4 +-- 5 files changed, 10 insertions(+), 44 deletions(-) diff --git a/src/depiction_targeted_preproc/workflow/rules/rules_prepare_pipeline.smk b/src/depiction_targeted_preproc/workflow/rules/rules_prepare_pipeline.smk index b8fb566..5da72be 100644 --- a/src/depiction_targeted_preproc/workflow/rules/rules_prepare_pipeline.smk +++ b/src/depiction_targeted_preproc/workflow/rules/rules_prepare_pipeline.smk @@ -1,15 +1,3 @@ -rule prepare_pipeline_standardize_panel: - input: - csv="{sample}/mass_list.unstandardized.raw.csv", - output: - csv="{sample}/mass_list.raw.csv", - run: - from depiction_targeted_preproc.workflow.prepare_pipeline.standardize_table import copy_standardized_table - from pathlib import Path - - copy_standardized_table(input_csv=Path(input.csv), output_csv=Path(output.csv)) - - rule prepare_pipeline_write_pipeline_params: input: params_yml="{sample}/params.yml", diff --git a/src/depiction_targeted_preproc/workflow/rules/rules_proc.smk b/src/depiction_targeted_preproc/workflow/rules/rules_proc.smk index 571919d..8f592d8 100644 --- a/src/depiction_targeted_preproc/workflow/rules/rules_proc.smk +++ b/src/depiction_targeted_preproc/workflow/rules/rules_proc.smk @@ -1,5 +1,3 @@ - - rule process_spectra_config: input: config="{sample}/pipeline_params.yml", @@ -35,7 +33,7 @@ rule proc_calibrate: input: imzml=multiext("{sample}/processed", ".imzML", ".ibd"), config="{sample}/config/proc_calibrate.yml", - mass_list="{sample}/mass_list.calibration.csv", + mass_list="{sample}/panels/calibration.csv", output: imzml=multiext("{sample}/calibrated", ".imzML", ".ibd"), calib_data="{sample}/calib_data.hdf5", @@ -84,24 +82,3 @@ rule proc_cluster_stats: shell: "python -m depiction_targeted_preproc.workflow.proc.cluster_stats" " --input-netcdf-path {input.netcdf} --output-csv-path {output.csv}" - - -rule proc_mass_list_preparation: - input: - csv="{sample}/mass_list.raw.csv", - output: - calibration_csv="{sample}/mass_list.calibration.csv", - # TODO remove - standards_csv="{sample}/mass_list.standards.csv", - # TODO remove - visualization_csv="{sample}/mass_list.visualization.csv", - # TODO remove - visualization_mini_csv="{sample}/mass_list.visualization_mini.csv", - shell: - """ - python -m depiction_targeted_preproc.workflow.proc.mass_list_preparation \ - --raw-csv {input.csv} --out-csv {output.calibration_csv} - cp {output.calibration_csv} {output.standards_csv} - cp {output.calibration_csv} {output.visualization_csv} - cp {output.calibration_csv} {output.visualization_mini_csv} - """ diff --git a/src/depiction_targeted_preproc/workflow/rules/rules_qc.smk b/src/depiction_targeted_preproc/workflow/rules/rules_qc.smk index 8ff6c11..2065d70 100644 --- a/src/depiction_targeted_preproc/workflow/rules/rules_qc.smk +++ b/src/depiction_targeted_preproc/workflow/rules/rules_qc.smk @@ -1,7 +1,7 @@ rule qc_table_marker_surroundings_baseline: input: imzml=multiext("{sample}/processed", ".imzML", ".ibd"), - mass_list="{sample}/mass_list.visualization.csv", + mass_list="{sample}/panels/full.csv", config="{sample}/pipeline_params.yml", output: table="{sample}/qc/table_marker_surroundings_baseline.parquet", @@ -14,7 +14,7 @@ rule qc_table_marker_surroundings_baseline: rule qc_table_marker_surroundings_calib: input: imzml_peaks="{sample}/calibrated.imzML", - mass_list="{sample}/mass_list.visualization.csv", + mass_list="{sample}/panels/full.csv", config="{sample}/pipeline_params.yml", output: table="{sample}/qc/table_marker_surroundings_calib.parquet", @@ -81,7 +81,7 @@ rule qc_plot_peak_density_grouped: rule qc_plot_calibration_map: input: calib_data="{sample}/calib_data.hdf5", - mass_list="{sample}/mass_list.visualization.csv", + mass_list="{sample}/panels/full.csv", output: pdf="{sample}/qc/plot_calibration_map.pdf", shell: @@ -115,7 +115,7 @@ rule qc_plot_sample_spectra_before_after: input: imzml_baseline="{sample}/peaks.imzML", imzml_calib="{sample}/calibrated.imzML", - mass_list="{sample}/mass_list.visualization.csv", + mass_list="{sample}/panels/full.csv", output: pdf="{sample}/qc/plot_sample_spectra_before_after.pdf", shell: diff --git a/src/depiction_targeted_preproc/workflow/rules/rules_simulate.smk b/src/depiction_targeted_preproc/workflow/rules/rules_simulate.smk index e99569c..e7a0cca 100644 --- a/src/depiction_targeted_preproc/workflow/rules/rules_simulate.smk +++ b/src/depiction_targeted_preproc/workflow/rules/rules_simulate.smk @@ -1,6 +1,7 @@ # TODO this should be handled differently, i.e. the simulation code should essentially create a new # virtual "sample" maybe not in the raw directory just to be clear about the intentions # -> but then it will require some adjustment in the code that calls it +# TODO in addition to this above, this might cause conflicts with some of the panel processing rules maybe rule simulate_create_labels: @@ -19,7 +20,7 @@ rule simulate_create_mass_list: input: config="{sample}_sim/config/simulate.yml", output: - mass_list="{sample}_sim/mass_list.raw.csv", + mass_list="{sample}_sim/unstandardize_full.csv", shell: "python -m depiction_targeted_preproc.workflow.simulate.create_mass_list" " --config-path {input.config}" @@ -29,7 +30,7 @@ rule simulate_create_mass_list: rule simulate_generate_imzml: input: image="{sample}_sim/true_labels.hdf5", - mass_list="{sample}_sim/mass_list.raw.csv", + mass_list="{sample}_sim/full.csv", config="{sample}_sim/config/simulate.yml", output: imzml=multiext("{sample}_sim/raw", ".imzML", ".ibd"), diff --git a/src/depiction_targeted_preproc/workflow/rules/rules_vis.smk b/src/depiction_targeted_preproc/workflow/rules/rules_vis.smk index ebde279..5c24d35 100644 --- a/src/depiction_targeted_preproc/workflow/rules/rules_vis.smk +++ b/src/depiction_targeted_preproc/workflow/rules/rules_vis.smk @@ -2,7 +2,7 @@ rule vis_images: input: imzml=multiext("{sample}/calibrated", ".imzML", ".ibd"), config="{sample}/pipeline_params.yml", - mass_list="{sample}/mass_list.visualization.csv", + mass_list="{sample}/panels/full.csv", output: hdf5="{sample}/images_default.hdf5", # TODO how can i pass n-jobs nicely here @@ -60,7 +60,7 @@ rule vis_test_mass_shifts: input: calib_hdf5="{sample}/calib_data.hdf5", config="{sample}/config/proc_calibrate.yml", - mass_list="{sample}/mass_list.calibration.csv", + mass_list="{sample}/panels/full.csv", output: hdf5="{sample}/test_mass_shifts.hdf5", shell: