Skip to content

Commit

Permalink
use the new panel processing in the workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
leoschwarz committed Nov 12, 2024
1 parent c24cece commit fb9e1b6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
25 changes: 1 addition & 24 deletions src/depiction_targeted_preproc/workflow/rules/rules_proc.smk
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


rule process_spectra_config:
input:
config="{sample}/pipeline_params.yml",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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}
"""
8 changes: 4 additions & 4 deletions src/depiction_targeted_preproc/workflow/rules/rules_qc.smk
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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}"
Expand All @@ -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"),
Expand Down
4 changes: 2 additions & 2 deletions src/depiction_targeted_preproc/workflow/rules/rules_vis.smk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit fb9e1b6

Please sign in to comment.