From de331fa799c88b30530a6646b0b48ebefddd6ea3 Mon Sep 17 00:00:00 2001 From: Laurent Modolo <laurent@modolo.fr> Date: Mon, 25 Jan 2021 15:55:33 +0100 Subject: [PATCH] samtools: nf_module add mapped and unmapped filter --- src/nf_modules/samtools/main.nf | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/nf_modules/samtools/main.nf b/src/nf_modules/samtools/main.nf index ea757d8b..cf0d2158 100644 --- a/src/nf_modules/samtools/main.nf +++ b/src/nf_modules/samtools/main.nf @@ -18,6 +18,41 @@ samtools view -@ ${task.cpus} -hb ${bam} -L ${bed} > ${file_id}_filtered.bam """ } +process filter_bam_mapped { + container = "${container_url}" + label "big_mem_multi_cpus" + tag "$file_id" + + input: + tuple val(file_id), path(bam) + path bed + + output: + tuple val(file_id), path("*_filtered.bam"), emit: bam + script: +""" +samtools view -@ ${task.cpus} -F 4 -hb ${bam} -L ${bed} > ${file_id}_mapped.bam +""" +} + +process filter_bam_unmapped { + container = "${container_url}" + label "big_mem_multi_cpus" + tag "$file_id" + + input: + tuple val(file_id), path(bam) + path bed + + output: + tuple val(file_id), path("*_filtered.bam"), emit: bam + script: +""" +samtools view -@ ${task.cpus} -f 4 -hb ${bam} > ${file_id}_unmapped.bam +""" +} + + process index_bam { container = "${container_url}" label "big_mem_mono_cpus" -- GitLab