diff --git a/src/nf_modules/deeptools/main.nf b/src/nf_modules/deeptools/main.nf new file mode 100644 index 0000000000000000000000000000000000000000..ba2be7c5dc08bfc4b6d2b9342e21e116cc1c2eed --- /dev/null +++ b/src/nf_modules/deeptools/main.nf @@ -0,0 +1,89 @@ +version = "3.0.2" +container_url = "lbmc/deeptools:${version}" + +process index_bam { + container = "${container_url}" + label "big_mem__cpus" + tag "$file_id" + + input: + tuple val(file_id), path(bam) + + output: + tuple val(file_id), path("*.bam*"), emit: bam + + script: +""" +sambamba index -t ${task.cpus} ${bam} +""" +} + +process bam_to_bigwig { + container = "${container_url}" + label "big_mem_multi_cpus" + tag "$file_id" + + publishDir "results/mapping/bigwig/", mode: 'copy' + + input: + tuple val(file_id), path(bam), path(idx) + + output: + tuple val(file_id), path("*.bw"), emit: bw + + script: +""" +bamCoverage -p ${task.cpus} --ignoreDuplicates -b ${bam} -o ${file_id}.bw +""" +} + +process compute_matrix { + container = "${container_url}" + label "big_mem_multi_cpus" + tag "${bed_file_id}" + publishDir "results/metagene/region_matrix/", mode: 'copy' + + input: + tuple val(file_id), path(bw) + tuple val(bed_file_id), path(bed) + + output: + tuple val(bed_file_id), path("*.mat.gz"), emit: matrix + + script: +""" +computeMatrix scale-regions -S ${bw} \ + -p ${task.cpus} \ + -R ${bed} \ + --beforeRegionStartLength 100 \ + --afterRegionStartLength 100 \ + -o ${bed_file_id}.mat.gz +""" +} + +process plot_profile { + container = "${container_url}" + label "big_mem_mono_cpus" + tag "$file_id" + publishDir "results/metagene/region_matrix/", mode: 'copy' + + input: + tuple val(file_id), path(matrix) + + output: + tuple val(file_id), path("*.pdf"), emit: pdf + + script: +/* +see more option at +https://deeptools.readthedocs.io/en/develop/content/tools/plotProfile.html +*/ +""" +plotProfile -m ${matrix} \ + --plotFileFormat=pdf \ + -out ${file_id}.pdf \ + --plotType=fill \ + --perGroup \ + --plotTitle "${params.title}" +""" +} diff --git a/src/nf_modules/sambamba/main.nf b/src/nf_modules/sambamba/main.nf index 22614426dec77104e85cf9ca0ec28f304de11684..eb9bbb462fe6048e9aa52b4f1615d624e505d41a 100644 --- a/src/nf_modules/sambamba/main.nf +++ b/src/nf_modules/sambamba/main.nf @@ -3,7 +3,7 @@ container_url = "lbmc/sambamba:${version}" process index_bam { container = "${container_url}" - label "big_mem__cpus" + label "big_mem_multi_cpus" tag "$file_id" input: