From 324f550545360e6f883c32032c379d9fea3921b6 Mon Sep 17 00:00:00 2001 From: Laurent Modolo <laurent.modolo@ens-lyon.fr> Date: Mon, 15 Mar 2021 12:17:19 +0100 Subject: [PATCH] minimap2: add main.nf --- src/nf_modules/minimap2/main.nf | 50 +++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/nf_modules/minimap2/main.nf diff --git a/src/nf_modules/minimap2/main.nf b/src/nf_modules/minimap2/main.nf new file mode 100644 index 00000000..73dc0e34 --- /dev/null +++ b/src/nf_modules/minimap2/main.nf @@ -0,0 +1,50 @@ +version = "2.17" +container_url = "lbmc/minimap2:${version}" + +process index_fasta { + container = "${container_url}" + label "big_mem_multi_cpus" + tag "$fasta.baseName" + + input: + path fasta + + output: + tuple path("${fasta}"), path("*.mmi*"), emit: index + path "*_report.txt", emit: report + + script: + memory = "${task.memory}" - ~/\s*GB/ +""" +minimap2 -t ${task.cpus} -I ${memory}G -d ${fasta.baseName}.mmi ${fasta} +""" +} + + +process mapping_fastq { + container = "${container_url}" + label "big_mem_multi_cpus" + tag "$pair_id" + + input: + tuple path(fasta), path(index) + tuple val(pair_id), path(reads) + + output: + tuple val(pair_id), path("*.bam"), emit: bam + path "*_report.txt", emit: report + + script: + memory = "${task.memory}" - ~/\s*GB/ + memory = memory / (task.cpus + 1.0) +if (reads instanceof List) +""" +minimap2 -ax sr -t ${task.cpus} -K ${memory} ${fasta} ${reads[0]} ${reads[1]} | + samtools view -Sb - > ${pair_id}.bam +""" +else +""" +minimap2 -ax sr -t ${task.cpus} -K ${memory} ${fasta} ${reads} | + samtools view -Sb - > ${reads.baseName}.bam +""" +} \ No newline at end of file -- GitLab