diff --git a/src/nf_modules/cutadapt/1.14/Dockerfile b/src/nf_modules/cutadapt/1.14/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..b8c5f54f41d5d349453fdb7062e9a1d3f0639c10 --- /dev/null +++ b/src/nf_modules/cutadapt/1.14/Dockerfile @@ -0,0 +1,15 @@ +FROM ubuntu:18.04 +MAINTAINER Laurent Modolo + +ENV CUTADAPT_VERSION=1.14 +ENV PACKAGES build-essential=12.4* \ + python3-pip=9.0.1* \ + python3-setuptools=39.0.1* \ + python3-dev=3.6.5* \ + python3-wheel=0.30.0* + +RUN apt-get update && \ + apt-get install -y --no-install-recommends ${PACKAGES} && \ + apt-get clean + +RUN pip3 install cutadapt==${CUTADAPT_VERSION} diff --git a/src/nf_modules/cutadapt/1.14/docker_init.sh b/src/nf_modules/cutadapt/1.14/docker_init.sh new file mode 100755 index 0000000000000000000000000000000000000000..57657469ce6305e9ac96015cd32ced1dfdcc8fd0 --- /dev/null +++ b/src/nf_modules/cutadapt/1.14/docker_init.sh @@ -0,0 +1,2 @@ +#!/bin/sh +docker build src/nf_modules/cutadapt/1.14 -t 'cutadapt:1.14' diff --git a/src/nf_modules/cutadapt/cutadapt.config b/src/nf_modules/cutadapt/cutadapt.config new file mode 100644 index 0000000000000000000000000000000000000000..79a6478597a3f5669fc6e8af77b902c2bdccaac5 --- /dev/null +++ b/src/nf_modules/cutadapt/cutadapt.config @@ -0,0 +1,37 @@ +profiles { + docker { + docker { + temp = 'auto' + enabled = true + } + process { + $adaptor_removal { + container = "cutadapt:1.14" + } + } + } + sge { + process{ + $adaptor_removal { + beforeScript = "module purge; module load cutadapt/1.14" + } + } + } +} + +profiles { + docker { + process { + $trimming { + container = "cutadapt:1.14" + } + } + } + sge { + process{ + $trimming { + beforeScript = "module purge; module load cutadapt/1.14" + } + } + } +} diff --git a/src/nf_modules/cutadapt/cutadapt.nf b/src/nf_modules/cutadapt/cutadapt.nf index b5f69fb152c4134bed8ed04a6d135e81da8d1668..3f3db6a4417aba5df23f841c1c7490b2e010e1ca 100644 --- a/src/nf_modules/cutadapt/cutadapt.nf +++ b/src/nf_modules/cutadapt/cutadapt.nf @@ -67,10 +67,6 @@ process adaptor_removal { /* quality trimming */ -${this.params.cutadapt} -q ${this.params.quality_threshold},${this.params.quality_threshold} -o ${tagname}_trim_R1.fastq.gz -p ${tagname}_trim_R2.fastq.gz ${file[0]} ${file[1]} > ${tagname}_cutadapt_report.txt" - -${this.params.cutadapt} -q ${this.params.quality_threshold},${this.params.quality_threshold} -o ${tagname}_trim.fastq.gz ${file} > ${tagname}_cutadapt_report.txt - /* * for paired-end data */ diff --git a/src/nf_modules/cutadapt/tests/adaptor_removal_paired.nf b/src/nf_modules/cutadapt/tests/adaptor_removal_paired.nf new file mode 100644 index 0000000000000000000000000000000000000000..d665d236a9321751ca70bc4dbe22664f04519eec --- /dev/null +++ b/src/nf_modules/cutadapt/tests/adaptor_removal_paired.nf @@ -0,0 +1,24 @@ +log.info "fastq files : ${params.fastq}" + +Channel + .fromFilePairs( params.fastq ) + .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" } + .set { fastq_files } + +process adaptor_removal { + tag "$pair_id" + + input: + set pair_id, file(reads) from fastq_files + + output: + file "*_cut_R{1,2}.fastq.gz" into fastq_files_cut + + script: + """ + cutadapt -a AGATCGGAAGAG -g CTCTTCCGATCT -A AGATCGGAAGAG -G CTCTTCCGATCT \ + -o ${pair_id}_cut_R1.fastq.gz -p ${pair_id}_cut_R2.fastq.gz \ + ${reads[0]} ${reads[1]} > ${pair_id}_report.txt + """ +} + diff --git a/src/nf_modules/cutadapt/tests/adaptor_removal_single.nf b/src/nf_modules/cutadapt/tests/adaptor_removal_single.nf new file mode 100644 index 0000000000000000000000000000000000000000..dc889a0e26d12e90f4913ee2043f60e6f930df4d --- /dev/null +++ b/src/nf_modules/cutadapt/tests/adaptor_removal_single.nf @@ -0,0 +1,24 @@ +log.info "fastq files : ${params.fastq}" + +Channel + .fromPath( params.fastq ) + .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" } + .set { fastq_files } + +process adaptor_removal { + tag "$reads.baseName" + + input: + file reads from fastq_files + + output: + file "*_cut.fastq.gz" into fastq_files_cut + + script: + """ + cutadapt -a AGATCGGAAGAG -g CTCTTCCGATCT\ + -o ${reads.baseName}_cut.fastq.gz \ + ${reads} > ${reads.baseName}_report.txt + """ +} + diff --git a/src/nf_modules/cutadapt/tests/tests.sh b/src/nf_modules/cutadapt/tests/tests.sh new file mode 100644 index 0000000000000000000000000000000000000000..9651978b62121b80ece061e22efec69f6b8b2faa --- /dev/null +++ b/src/nf_modules/cutadapt/tests/tests.sh @@ -0,0 +1,19 @@ +nextflow src/nf_modules/cutadapt/test/adaptor_removal_paired.nf \ + -c src/nf_modules/cutadapt/cutadapt.config \ + -profile docker \ + --fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq" + +nextflow src/nf_modules/cutadapt/test/adaptor_removal_single.nf \ + -c src/nf_modules/cutadapt/cutadapt.config \ + -profile docker \ + --fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq" + +nextflow src/nf_modules/cutadapt/test/trimming_paired.nf \ + -c src/nf_modules/cutadapt/cutadapt.config \ + -profile docker \ + --fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq" + +nextflow src/nf_modules/cutadapt/test/trimming_single.nf \ + -c src/nf_modules/cutadapt/cutadapt.config \ + -profile docker \ + --fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq" diff --git a/src/nf_modules/cutadapt/tests/trimming_paired.nf b/src/nf_modules/cutadapt/tests/trimming_paired.nf new file mode 100644 index 0000000000000000000000000000000000000000..d0b83e1c8de4ff149d5d686b1808fa2db7300353 --- /dev/null +++ b/src/nf_modules/cutadapt/tests/trimming_paired.nf @@ -0,0 +1,24 @@ +log.info "fastq files : ${params.fastq}" + +Channel + .fromFilePairs( params.fastq ) + .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" } + .set { fastq_files } + +process trimming { + tag "$pair_id" + + input: + set pair_id, file(reads) from fastq_files + + output: + file "*_trim_R{1,2}.fastq.gz" into fastq_files_cut + + script: + """ + cutadapt -q 20,20 \ + -o ${pair_id}_trim_R1.fastq.gz -p ${pair_id}_trim_R2.fastq.gz \ + ${reads[0]} ${reads[1]} > ${pair_id}_report.txt + """ +} + diff --git a/src/nf_modules/cutadapt/tests/trimming_single.nf b/src/nf_modules/cutadapt/tests/trimming_single.nf new file mode 100644 index 0000000000000000000000000000000000000000..c2dd2627da7d3b989b556c479ca86a43897e4898 --- /dev/null +++ b/src/nf_modules/cutadapt/tests/trimming_single.nf @@ -0,0 +1,24 @@ +log.info "fastq files : ${params.fastq}" + +Channel + .fromPath( params.fastq ) + .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" } + .set { fastq_files } + +process trimming { + tag "$reads.baseName" + + input: + file reads from fastq_files + + output: + file "*_trim.fastq.gz" into fastq_files_cut + + script: + """ + cutadapt -q 20,20 \ + -o ${reads.baseName}_trim.fastq.gz \ + ${reads} > ${reads.baseName}_report.txt + """ +} +