diff --git a/src/nf_modules/HTSeq/htseq.config b/src/nf_modules/HTSeq/htseq.config new file mode 100644 index 0000000000000000000000000000000000000000..ab3cc3a268f8c3d0f0233beb184c2ace5d9b7031 --- /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 0000000000000000000000000000000000000000..5aa2f739bd64381724450640e9828a0b4fce1494 --- /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 0000000000000000000000000000000000000000..f11736b1443f36e13b1986518f5de1c9187ca62e --- /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 0000000000000000000000000000000000000000..7ccef1815eb2f2e430095f764230160b26be85a6 --- /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" +