From f27bf1489ab141ecff93b2df667a351686c8dbcc Mon Sep 17 00:00:00 2001 From: Laurent Modolo <laurent.modolo@ens-lyon.fr> Date: Thu, 28 Apr 2022 15:13:41 +0200 Subject: [PATCH] Merge crey02/nextflow-add_htseq to close #29 --- src/.docker_modules/htseq/1.99.2/Dockerfile | 11 ++++ .../htseq/1.99.2/docker_init.sh | 4 ++ src/nf_modules/htseq/main.nf | 53 +++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 src/.docker_modules/htseq/1.99.2/Dockerfile create mode 100755 src/.docker_modules/htseq/1.99.2/docker_init.sh create mode 100644 src/nf_modules/htseq/main.nf 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 00000000..ba82320c --- /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 00000000..a0aa6479 --- /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 00000000..93377467 --- /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 +} -- GitLab