From 789f692681ef915a83873b0d88f10e564ba6bc80 Mon Sep 17 00:00:00 2001 From: Laurent Modolo <laurent.modolo@ens-lyon.fr> Date: Thu, 29 Apr 2021 09:26:08 +0200 Subject: [PATCH] alntools: add bam2ec process --- src/nf_modules/alntools/main.nf | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/nf_modules/alntools/main.nf diff --git a/src/nf_modules/alntools/main.nf b/src/nf_modules/alntools/main.nf new file mode 100644 index 00000000..e6f990d0 --- /dev/null +++ b/src/nf_modules/alntools/main.nf @@ -0,0 +1,32 @@ +version = "dd69682" +container_url = "lbmc/alntools:${version}" + +process bam2ec { + container = "${container_url}" + label "big_mem_mono_cpus" + tag "$file_id" + + input: + tuple val(file_id), path(bam) + tuple val(gtf_id), path(gtf) + + output: + tuple val(file_id), path("${bam.simpleName}.bin"), emit: bin + tuple val(gtf_id), path("${gtf.simpleName}_transcripts_lengths.tsv"), emit: tsv + + script: +""" +awk -F"\t" ' +$3=="exon" + { + ID=substr($9, length($9)-16, 15); + L[ID]+=$5-$4+1 + } +END{ + for(i in L) + {print i"\t"L[i]} + } +' ${gtf} ${gtf.simpleName}_transcripts_lengths.tsv +alntools bam2ec -t ${gtf.simpleName}_transcripts_lengths.tsv -c 8 ${bam} ${bam.simpleName}.bin +""" +} \ No newline at end of file -- GitLab