diff --git a/src/nf_modules/samtools/main.nf b/src/nf_modules/samtools/main.nf index ea757d8b7133799d3465c5104655ce46480a4e3d..cf0d2158e7f62f9e71849639f5148456789311f3 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"