From 7b298e9246be8f85104f628cf9fe9024c5e1b6f9 Mon Sep 17 00:00:00 2001 From: Laurent Modolo <laurent@modolo.fr> Date: Fri, 22 Jan 2021 15:21:43 +0100 Subject: [PATCH] nf_modules: add deeptools to DSL2 --- src/nf_modules/deeptools/main.nf | 89 ++++++++++++++++++++++++++++++++ src/nf_modules/sambamba/main.nf | 2 +- 2 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 src/nf_modules/deeptools/main.nf diff --git a/src/nf_modules/deeptools/main.nf b/src/nf_modules/deeptools/main.nf new file mode 100644 index 00000000..ba2be7c5 --- /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 22614426..eb9bbb46 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: -- GitLab