From 94c41f304b735ec3457e01df28d2bce20c230e72 Mon Sep 17 00:00:00 2001 From: Laurent Modolo <laurent@modolo.fr> Date: Fri, 22 Jan 2021 15:13:12 +0100 Subject: [PATCH] nf_modules: add sambamba to DSL2 --- src/nf_modules/sambamba/main.nf | 55 +++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/nf_modules/sambamba/main.nf diff --git a/src/nf_modules/sambamba/main.nf b/src/nf_modules/sambamba/main.nf new file mode 100644 index 00000000..22614426 --- /dev/null +++ b/src/nf_modules/sambamba/main.nf @@ -0,0 +1,55 @@ +version = "0.6.7" +container_url = "lbmc/sambamba:${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 sort_bam { + container = "${container_url}" + label "big_mem_multi_cpus" + tag "$file_id" + + input: + tuple val(file_id), path(bam) + + output: + tuple val(file_id), path("*.bam*"), emit: bam + + script: +""" +sambamba sort -t ${task.cpus} -o ${file_id}_sorted.bam ${bam} +""" +} + + +process split_bam { + container = "${container_url}" + label "big_mem_multi_cpus" + tag "$file_id" + + input: + tuple val(file_id), path(bam) + + output: + tuple val(file_id), path("*_forward.bam*"), emit: bam_forward + tuple val(file_id), path("*_reverse.bam*"), emit: bam_reverse + script: +""" +sambamba view -t ${task.cpus} -h -F "strand == '+'" ${bam} > ${file_id}_forward.bam +sambamba view -t ${task.cpus} -h -F "strand == '-'" ${bam} > ${file_id}_reverse.bam +""" +} -- GitLab