|
1 | 1 | if config["peak_calling_macs2"]["run"]:
|
| 2 | + if paired_end: |
| 3 | + extension = ".sorted" |
| 4 | + else: |
| 5 | + extension = ".extended" |
2 | 6 | if config["peak_calling_macs2"]["mode"] == "narrow":
|
3 | 7 | fdr = config["peak_calling_macs2"]["qvalue"]
|
4 | 8 |
|
5 | 9 | rule peak_calling_MACS2_narrow:
|
6 | 10 | input:
|
7 |
| - bam="results/bam/{dir}/{bg_sample}.bam", |
| 11 | + bam=f"results/bam/{{dir}}/{{bg_sample}}{extension}.bam", |
8 | 12 | output:
|
9 | 13 | multiext("results/macs2_broad/fdr{fdr}/{dir}/{bg_sample}",
|
10 | 14 | "_peaks.xls",
|
@@ -171,7 +175,7 @@ if config["peak_calling_macs2"]["run"]:
|
171 | 175 | rule count_reads_in_peaks:
|
172 | 176 | # Adapted from https://www.biostars.org/p/337872/#337890
|
173 | 177 | input:
|
174 |
| - bam="results/bam/{dir}/{bg_sample}.sorted.bam", |
| 178 | + bam=f"results/bam/{{dir}}/{{bg_sample}}{extension}.bam", |
175 | 179 | b="results/macs2_narrow/fdr{fdr}/{dir}/{bg_sample}_peaks.narrowPeak",
|
176 | 180 | output:
|
177 | 181 | 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"]:
|
226 | 230 |
|
227 | 231 | rule peak_calling_MACS2_broad:
|
228 | 232 | input:
|
229 |
| - bam="results/bam/{dir}/{bg_sample}.bam", |
| 233 | + bam=f"results/bam/{{dir}}/{{bg_sample}}{extension}.bam", |
230 | 234 | output:
|
231 | 235 | multiext("results/macs2_broad/fdr{fdr}/{dir}/{bg_sample}",
|
232 | 236 | "_peaks.xls",
|
@@ -394,7 +398,7 @@ if config["peak_calling_macs2"]["run"]:
|
394 | 398 | rule count_reads_in_peaks:
|
395 | 399 | # Adapted from https://www.biostars.org/p/337872/#337890
|
396 | 400 | input:
|
397 |
| - bam="results/bam/{dir}/{bg_sample}.sorted.bam", |
| 401 | + bam=f"results/bam/{{dir}}/{{bg_sample}}{extension}.bam", |
398 | 402 | b="results/macs2_broad/fdr{fdr}/{dir}/{bg_sample}_peaks.broadPeak",
|
399 | 403 | output:
|
400 | 404 | total_read_count="results/macs2_broad/fdr{fdr}/read_counts/{dir}/{bg_sample}.total.count",
|
|
0 commit comments