@@ -230,32 +230,29 @@ if config["peak_calling_macs2"]["run"]:
230
230
231
231
rule peak_calling_MACS2_broad :
232
232
input :
233
- bam = f"results/bam/{{dir}}/{{bg_sample}}{ extension } .bam" ,
233
+ treatment = f"results/bam/{{dir}}/{{bg_sample}}{ extension } .bam" ,
234
+ control = f"results/bam/{{dir}}/Dam{ extension } .bam" ,
234
235
output :
235
236
multiext ("results/macs2_broad/fdr{fdr}/{dir}/{bg_sample}" ,
236
237
"_peaks.xls" ,
237
238
"_peaks.broadPeak" ,
238
239
"_peaks.gappedPeak"
239
240
)
240
241
params :
241
- outdir = lambda w , output : os .path .dirname (output [0 ]),
242
- paired_end = paired_end ,
243
- mode = "broad" ,
244
- fdr = fdr ,
245
- genome = resources .genome ,
246
- data_dir = lambda w , input : os .path .dirname (input [0 ]),
247
- extra = config ["peak_calling_macs2" ]["extra" ]
242
+ macs2_params ()
248
243
threads : config ["resources" ]["deeptools" ]["cpu" ]
249
244
resources :
250
245
runtime = config ["resources" ]["deeptools" ]["time" ]
251
246
log :
252
247
"logs/macs2_broad/fdr{fdr}/{dir}/{bg_sample}.log"
253
- conda :
254
- "../envs/peak_calling.yaml"
255
- script :
256
- "../scripts/macs2.py"
257
-
248
+ #conda:
249
+ # "../envs/peak_calling.yaml"
250
+ #script:
251
+ # "../scripts/macs2.py"
252
+ wrapper :
253
+ "v3.13.8/bio/macs2/callpeak"
258
254
255
+
259
256
rule consensus_peaks_macs2_broad :
260
257
input :
261
258
peaks = expand ("results/macs2_broad/fdr{fdr}/{dir}/{{bg_sample}}_peaks.broadPeak" , dir = DIRS , fdr = fdr ),
@@ -280,7 +277,7 @@ if config["peak_calling_macs2"]["run"]:
280
277
peaks = expand ("results/macs2_broad/fdr{fdr}/{dir}/{{bg_sample}}_peaks.broadPeak" , dir = DIRS , fdr = fdr ),
281
278
cs = f"resources/{ resources .genome } _chrom.sizes" ,
282
279
output :
283
- ext_bed = "results/macs2_broad/fdr{fdr}/consensus_peaks/{bg_sample}.overlap.filtered .bed" ,
280
+ ext_bed = temp ( "results/macs2_broad/fdr{fdr}/consensus_peaks/{bg_sample}.overlap.tmp .bed" ) ,
284
281
params :
285
282
k = config ["consensus_peaks" ]["keep" ],
286
283
max_size = config ["consensus_peaks" ]["max_size" ],
@@ -294,7 +291,24 @@ if config["peak_calling_macs2"]["run"]:
294
291
"../envs/peak_calling.yaml"
295
292
script :
296
293
"../scripts/filter_consensus_peaks.py"
294
+
297
295
296
+ rule remove_duplicate_peaks :
297
+ input :
298
+ "results/macs2_broad/fdr{fdr}/consensus_peaks/{bg_sample}.overlap.tmp.bed" ,
299
+ output :
300
+ "results/macs2_broad/fdr{fdr}/consensus_peaks/{bg_sample}.overlap.filtered.bed" ,
301
+ threads : 1
302
+ resources :
303
+ runtime = 5
304
+ log :
305
+ "logs/remove_duplicate_peaks/macs2_broad/fdr{fdr}/{bg_sample}.log"
306
+ conda :
307
+ "../envs/peak_calling.yaml"
308
+ shell :
309
+ # Remove duplicates based on the first 3 columns
310
+ "sort -k 1,1 -k2,2 -k3,3n -u {input} > {output}"
311
+
298
312
299
313
rule peak_annotation_plots_macs2_broad :
300
314
input :
0 commit comments