Skip to content

Commit 5820b5b

Browse files
committed
fixed peak_annotation_plots with different fdrs
1 parent 1e494b8 commit 5820b5b

File tree

1 file changed

+61
-19
lines changed

1 file changed

+61
-19
lines changed

workflow/rules/plotting.smk

+61-19
Original file line numberDiff line numberDiff line change
@@ -120,26 +120,68 @@ rule plot_profile:
120120
"{params.extra} "
121121
"> {log} 2>&1"
122122

123+
if config["peak_calling_perl"]["run"]:
124+
fdr = config["peak_calling_perl"]["fdr"]
125+
rule peak_annotation_plots:
126+
input:
127+
gtf=resources.gtf,
128+
bed=expand("results/peaks/fdr{fdr}/consensus_peaks/{bg_sample}.filtered.bed", fdr=fdr, bg_sample=BG_SAMPLES),
129+
output:
130+
fd=report("results/plots/peaks/fdr{fdr}/feature_distributions.pdf", caption="../report/feature_distributions.rst", category="Peak annotation"),
131+
dt=report("results/plots/peaks/fdr{fdr}/distance_to_tss.pdf", caption="../report/distance_to_tss.rst", category="Peak annotation"),
132+
params:
133+
extra="",
134+
threads: config["resources"]["plotting"]["cpu"]
135+
resources:
136+
runtime=config["resources"]["plotting"]["time"]
137+
log:
138+
"logs/plotting/peak_annotation_plots_fdr{fdr}.log"
139+
conda:
140+
"../envs/R.yaml"
141+
script:
142+
"../scripts/peak_annotation_plots.R"
123143

124-
rule peak_annotation_plots:
125-
input:
126-
gtf=resources.gtf,
127-
bed=expand("results/peaks/fdr{fdr}/consensus_peaks/{bg_sample}.filtered.bed", fdr=peak_fdr("perl"), bg_sample=BG_SAMPLES),
128-
output:
129-
fd=report("results/plots/peaks/fdr{fdr}/feature_distributions.pdf", caption="../report/feature_distributions.rst", category="Peak annotation"),
130-
dt=report("results/plots/peaks/fdr{fdr}/distance_to_tss.pdf", caption="../report/distance_to_tss.rst", category="Peak annotation"),
131-
params:
132-
extra="",
133-
threads: config["resources"]["plotting"]["cpu"]
134-
resources:
135-
runtime=config["resources"]["plotting"]["time"]
136-
log:
137-
"logs/plotting/peak_annotation_plots_fdr{fdr}.log"
138-
conda:
139-
"../envs/R.yaml"
140-
script:
141-
"../scripts/peak_annotation_plots.R"
142-
144+
elif config["peak_calling_macs2"]["run"]:
145+
if config["peak_calling_macs2"]["mode"] == "narrow":
146+
fdr = config["peak_calling_macs2"]["qvalue"]
147+
rule peak_annotation_plots:
148+
input:
149+
gtf=resources.gtf,
150+
bed=expand("results/macs2_narrow/fdr{fdr}/consensus_peaks/{bg_sample}.filtered.bed", fdr=fdr, bg_sample=BG_SAMPLES),
151+
output:
152+
fd=report("results/plots/macs2_narrow/fdr{fdr}/feature_distributions.pdf", caption="../report/feature_distributions.rst", category="Peak annotation"),
153+
dt=report("results/plots/macs2_narrow/fdr{fdr}/distance_to_tss.pdf", caption="../report/distance_to_tss.rst", category="Peak annotation"),
154+
params:
155+
extra="",
156+
threads: config["resources"]["plotting"]["cpu"]
157+
resources:
158+
runtime=config["resources"]["plotting"]["time"]
159+
log:
160+
"logs/plotting/peak_annotation_plots_fdr{fdr}.log"
161+
conda:
162+
"../envs/R.yaml"
163+
script:
164+
"../scripts/peak_annotation_plots.R"
165+
elif config["peak_calling_macs2"]["mode"] == "broad":
166+
fdr = config["peak_calling_macs2"]["broad_cutoff"]
167+
rule peak_annotation_plots:
168+
input:
169+
gtf=resources.gtf,
170+
bed=expand("results/macs2_broad/fdr{fdr}/consensus_peaks/{bg_sample}.filtered.bed", fdr=fdr, bg_sample=BG_SAMPLES),
171+
output:
172+
fd=report("results/plots/macs2_broad/fdr{fdr}/feature_distributions.pdf", caption="../report/feature_distributions.rst", category="Peak annotation"),
173+
dt=report("results/plots/macs2_broad/fdr{fdr}/distance_to_tss.pdf", caption="../report/distance_to_tss.rst", category="Peak annotation"),
174+
params:
175+
extra="",
176+
threads: config["resources"]["plotting"]["cpu"]
177+
resources:
178+
runtime=config["resources"]["plotting"]["time"]
179+
log:
180+
"logs/plotting/peak_annotation_plots_fdr{fdr}.log"
181+
conda:
182+
"../envs/R.yaml"
183+
script:
184+
"../scripts/peak_annotation_plots.R"
143185

144186
rule plot_mapping_rates:
145187
input:

0 commit comments

Comments
 (0)