diff --git a/src/.docker_modules/htseq/1.99.2/Dockerfile b/src/.docker_modules/htseq/1.99.2/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..ba82320ca874b213d4951da658e0454094708d8b --- /dev/null +++ b/src/.docker_modules/htseq/1.99.2/Dockerfile @@ -0,0 +1,11 @@ +FROM ubuntu:20.04 +LABEL maintainer= Laurent Modolo + +RUN apt-get update \ + && apt-get install -y \ + procps \ + build-essential \ + python3 \ + python3-pip + +RUN pip install HTSeq==1.99.2 \ No newline at end of file diff --git a/src/.docker_modules/htseq/1.99.2/docker_init.sh b/src/.docker_modules/htseq/1.99.2/docker_init.sh new file mode 100755 index 0000000000000000000000000000000000000000..a0aa647971875e01cfd0a2e9949aa9cadaf6cec2 --- /dev/null +++ b/src/.docker_modules/htseq/1.99.2/docker_init.sh @@ -0,0 +1,4 @@ +#!/bin/sh +docker pull lbmc/htseq:1.99.2 +docker build src/.docker_modules/htseq/1.99.2 -t 'lbmc/htseq:1.99.2' +docker push lbmc/htseq:1.99.2 diff --git a/src/nf_modules/htseq/main.nf b/src/nf_modules/htseq/main.nf new file mode 100644 index 0000000000000000000000000000000000000000..93377467bc8cc61c3c7fad459c51bc253737be2e --- /dev/null +++ b/src/nf_modules/htseq/main.nf @@ -0,0 +1,53 @@ + +version = "1.99.2" +container_url = "lbmc/htseq:${version}" + +params.htseq_out = "" + + + +process gff3_2_gtf { + container = "dceoy/cufflinks" + label "small_mem_mono_cpus" + + input: + tuple val(genome_id), path(gff3_file) + output: + path "${genome_id}.gtf", emit: gtf + script: +""" +gffread ${gff3_file} -T -o ${genome_id}.gtf +""" +} + + +process htseq_count { + container = "${container_url}" + label "big_mem_multi_cpus" + tag "file_id: $file_id" + if (params.htseq_out != "") { + publishDir "results/${params.htseq_out}", mode: 'copy' + } + input: + tuple val(file_id), path(bam), path(bai) + path (gtf) + + output: + path "${file_id}.tsv", emit: counts + + script: +""" +htseq-count -n ${task.cpus} -r pos -a 10 -s yes -t exon -i gene_id $bam $gtf > ${file_id}.tsv +""" +} + +workflow htseq_count_with_gff { + take: + bam_tuple + gff_file + main: + gff3_2_gtf(gff_file) + htseq_count(bam_tuple,gff3_2_gtf.out.gtf) + emit: + counts = htseq_count.out.counts +}