Skip to content

Commit b84dac2

Browse files
committed
simplified
1 parent 18e5d6b commit b84dac2

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

workflow/rules/macs2.smk

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
if config["peak_calling_macs2"]["run"]:
2+
if paired_end:
3+
extension = ".sorted"
4+
else:
5+
extension = ".extended"
26
if config["peak_calling_macs2"]["mode"] == "narrow":
37
fdr = config["peak_calling_macs2"]["qvalue"]
48

59
rule peak_calling_MACS2_narrow:
610
input:
7-
bam="results/bam/{dir}/{bg_sample}.bam",
11+
bam=f"results/bam/{{dir}}/{{bg_sample}}{extension}.bam",
812
output:
913
multiext("results/macs2_broad/fdr{fdr}/{dir}/{bg_sample}",
1014
"_peaks.xls",
@@ -171,7 +175,7 @@ if config["peak_calling_macs2"]["run"]:
171175
rule count_reads_in_peaks:
172176
# Adapted from https://www.biostars.org/p/337872/#337890
173177
input:
174-
bam="results/bam/{dir}/{bg_sample}.sorted.bam",
178+
bam=f"results/bam/{{dir}}/{{bg_sample}}{extension}.bam",
175179
b="results/macs2_narrow/fdr{fdr}/{dir}/{bg_sample}_peaks.narrowPeak",
176180
output:
177181
total_read_count="results/macs2_narrow/fdr{fdr}/read_counts/{dir}/{bg_sample}.total.count",
@@ -226,7 +230,7 @@ if config["peak_calling_macs2"]["run"]:
226230

227231
rule peak_calling_MACS2_broad:
228232
input:
229-
bam="results/bam/{dir}/{bg_sample}.bam",
233+
bam=f"results/bam/{{dir}}/{{bg_sample}}{extension}.bam",
230234
output:
231235
multiext("results/macs2_broad/fdr{fdr}/{dir}/{bg_sample}",
232236
"_peaks.xls",
@@ -394,7 +398,7 @@ if config["peak_calling_macs2"]["run"]:
394398
rule count_reads_in_peaks:
395399
# Adapted from https://www.biostars.org/p/337872/#337890
396400
input:
397-
bam="results/bam/{dir}/{bg_sample}.sorted.bam",
401+
bam=f"results/bam/{{dir}}/{{bg_sample}}{extension}.bam",
398402
b="results/macs2_broad/fdr{fdr}/{dir}/{bg_sample}_peaks.broadPeak",
399403
output:
400404
total_read_count="results/macs2_broad/fdr{fdr}/read_counts/{dir}/{bg_sample}.total.count",

0 commit comments

Comments
 (0)