From 2c488dbfc63f5c1c2f53febe4345ce0ca4607c02 Mon Sep 17 00:00:00 2001 From: Laurent Modolo <laurent.modolo@ens-lyon.fr> Date: Fri, 1 Jun 2018 14:15:56 +0200 Subject: [PATCH] cutadapt: add tests and config --- src/nf_modules/cutadapt/1.14/Dockerfile | 15 ++++++++ src/nf_modules/cutadapt/1.14/docker_init.sh | 2 + src/nf_modules/cutadapt/cutadapt.config | 37 +++++++++++++++++++ src/nf_modules/cutadapt/cutadapt.nf | 4 -- .../cutadapt/tests/adaptor_removal_paired.nf | 24 ++++++++++++ .../cutadapt/tests/adaptor_removal_single.nf | 24 ++++++++++++ src/nf_modules/cutadapt/tests/tests.sh | 19 ++++++++++ .../cutadapt/tests/trimming_paired.nf | 24 ++++++++++++ .../cutadapt/tests/trimming_single.nf | 24 ++++++++++++ 9 files changed, 169 insertions(+), 4 deletions(-) create mode 100644 src/nf_modules/cutadapt/1.14/Dockerfile create mode 100755 src/nf_modules/cutadapt/1.14/docker_init.sh create mode 100644 src/nf_modules/cutadapt/cutadapt.config create mode 100644 src/nf_modules/cutadapt/tests/adaptor_removal_paired.nf create mode 100644 src/nf_modules/cutadapt/tests/adaptor_removal_single.nf create mode 100644 src/nf_modules/cutadapt/tests/tests.sh create mode 100644 src/nf_modules/cutadapt/tests/trimming_paired.nf create mode 100644 src/nf_modules/cutadapt/tests/trimming_single.nf diff --git a/src/nf_modules/cutadapt/1.14/Dockerfile b/src/nf_modules/cutadapt/1.14/Dockerfile new file mode 100644 index 0000000..b8c5f54 --- /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 0000000..5765746 --- /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 0000000..79a6478 --- /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 b5f69fb..3f3db6a 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 0000000..d665d23 --- /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 0000000..dc889a0 --- /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 0000000..9651978 --- /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 0000000..d0b83e1 --- /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 0000000..c2dd262 --- /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 + """ +} + -- GitLab