From 5ebfd2fe9f9fdf24271062abb0feeb49a8c50394 Mon Sep 17 00:00:00 2001 From: alsmith Date: Mon, 5 Feb 2024 10:15:14 +0000 Subject: [PATCH] Add get_peak_files function to retrieve peak files based on assay type --- seqnado/workflow/rules/hub.smk | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/seqnado/workflow/rules/hub.smk b/seqnado/workflow/rules/hub.smk index d3f07813..2fceed56 100644 --- a/seqnado/workflow/rules/hub.smk +++ b/seqnado/workflow/rules/hub.smk @@ -93,6 +93,30 @@ def get_hub_input(wildcards): return input_files +def get_peak_files(wildcards): + peak_files = [] + + if config["call_peaks"]: + if ASSAY == "ChIP": + peak_files.extend( + expand( + "seqnado_output/peaks/{method}/{sample}.bed", + method=config["peak_calling_method"], + sample=SAMPLE_NAMES_IP, + ) + ) + elif ASSAY == "ATAC": + peak_files.extend( + expand( + "seqnado_output/peaks/{method}/{sample}.bed", + method=config["peak_calling_method"], + sample=SAMPLE_NAMES, + ) + ) + + return peak_files + + rule save_design: output: "seqnado_output/design.csv", @@ -104,11 +128,7 @@ rule save_design: rule validate_peaks: input: - peaks=expand( - "seqnado_output/peaks/{method}/{sample}.bed", - method=config["peak_calling_method"], - sample=SAMPLE_NAMES, - ), + get_peak_files, output: sentinel="seqnado_output/peaks/.validated", container: