From 072e204a4d7dd3db0259c5d2a6048815b9a5a617 Mon Sep 17 00:00:00 2001 From: Laurent Modolo <laurent.modolo@ens-lyon.fr> Date: Mon, 4 Jun 2018 17:48:51 +0200 Subject: [PATCH] HTSeq: add nf and tests files --- src/nf_modules/HTSeq/htseq.config | 18 ++++++++++++ src/nf_modules/HTSeq/htseq.nf | 40 ++++++++++++++++++++++++++ src/nf_modules/HTSeq/tests/counting.nf | 33 +++++++++++++++++++++ src/nf_modules/HTSeq/tests/tests.sh | 6 ++++ 4 files changed, 97 insertions(+) create mode 100644 src/nf_modules/HTSeq/htseq.config create mode 100644 src/nf_modules/HTSeq/htseq.nf create mode 100644 src/nf_modules/HTSeq/tests/counting.nf create mode 100644 src/nf_modules/HTSeq/tests/tests.sh diff --git a/src/nf_modules/HTSeq/htseq.config b/src/nf_modules/HTSeq/htseq.config new file mode 100644 index 0000000..ab3cc3a --- /dev/null +++ b/src/nf_modules/HTSeq/htseq.config @@ -0,0 +1,18 @@ +profiles { + docker { + docker.temp = 'auto' + docker.enabled = true + process { + $counting { + container = "htseq:0.8.0" + } + } + } + sge { + process{ + $trimming { + beforeScript = "module purge; module load HTSeq/0.8.0" + } + } + } +} diff --git a/src/nf_modules/HTSeq/htseq.nf b/src/nf_modules/HTSeq/htseq.nf new file mode 100644 index 0000000..5aa2f73 --- /dev/null +++ b/src/nf_modules/HTSeq/htseq.nf @@ -0,0 +1,40 @@ +/* +* htseq : +* Imputs : sorted bams files +* Imputs : gtf +* Output : counts files +*/ +/* quality trimming */ + +params.bam = "$baseDir/data/bam/*.bam" +params.gtf = "$baseDir/data/annotation/*.gtf" + +log.info "bam files : ${params.bam}" +log.info "gtf files : ${params.gtf}" + +Channel + .fromPath( params.bam ) + .ifEmpty { error "Cannot find any fastq files matching: ${params.bam}" } + .set { bam_files } +Channel + .fromPath( params.gtf ) + .ifEmpty { error "Cannot find any gtf file matching: ${params.gtf}" } + .set { gtf_file } + +process counting { + tag "$bam.baseName" + publishDir "results/quantification/", mode: 'copy' + + input: + file bam from bam_files + file gtf from gtf_file + + output: + file "*.count" into count_files + + script: +""" +htseq-count -r pos --mode=intersection-nonempty -a 10 -s no -t exon -i gene_id \ +--format=bam ${bam} ${gtf} > ${bam.baseName}.count +""" +} diff --git a/src/nf_modules/HTSeq/tests/counting.nf b/src/nf_modules/HTSeq/tests/counting.nf new file mode 100644 index 0000000..f11736b --- /dev/null +++ b/src/nf_modules/HTSeq/tests/counting.nf @@ -0,0 +1,33 @@ +params.bam = "$baseDir/data/bam/*.bam" +params.gtf = "$baseDir/data/annotation/*.gtf" + +log.info "bam files : ${params.bam}" +log.info "gtf files : ${params.gtf}" + +Channel + .fromPath( params.bam ) + .ifEmpty { error "Cannot find any fastq files matching: ${params.bam}" } + .set { bam_files } +Channel + .fromPath( params.gtf ) + .ifEmpty { error "Cannot find any gtf file matching: ${params.gtf}" } + .set { gtf_file } + +process counting { + tag "$bam.baseName" + publishDir "results/quantification/", mode: 'copy' + + input: + file bam from bam_files + file gtf from gtf_file + + output: + file "*.count" into count_files + + script: +""" +htseq-count -r pos --mode=intersection-nonempty -a 10 -s no -t exon -i gene_id \ +--format=bam ${bam} ${gtf} > ${bam.baseName}.count +""" +} + diff --git a/src/nf_modules/HTSeq/tests/tests.sh b/src/nf_modules/HTSeq/tests/tests.sh new file mode 100644 index 0000000..7ccef18 --- /dev/null +++ b/src/nf_modules/HTSeq/tests/tests.sh @@ -0,0 +1,6 @@ +nextflow src/nf_modules/HTSeq/tests/counting.nf \ + -c src/nf_modules/HTSeq/htseq.config \ + -profile docker \ + --gtf "data/tiny_dataset/annot/tiny.gff" \ + --bam "data/tiny_dataset/map/tiny_v2.bam" + -- GitLab