From a3525c765b76400269695235bbf164a948604c4a Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Thu, 19 Oct 2023 10:32:14 -0400 Subject: [PATCH 1/2] fix: modify cutadapt args for paired-end resolves #9 --- modules/CCBR/cutadapt/main.nf | 18 ++++++++++++++---- tests/modules/CCBR/cutadapt/nextflow.config | 4 ---- tests/modules/CCBR/cutadapt/test.yml | 11 +++++++++++ 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/modules/CCBR/cutadapt/main.nf b/modules/CCBR/cutadapt/main.nf index e4a758f..775ca2c 100644 --- a/modules/CCBR/cutadapt/main.nf +++ b/modules/CCBR/cutadapt/main.nf @@ -16,15 +16,25 @@ process CUTADAPT { task.ext.when == null || task.ext.when script: + def prefix = task.ext.prefix ?: "${meta.id}" + def trimmed = meta.single_end ? "-o ${prefix}.trim.fastq.gz" : "-o ${prefix}_1.trim.fastq.gz -p ${prefix}_2.trim.fastq.gz" def args = task.ext.args ?: [ '--nextseq-trim=2', '--trim-n -n 5 -O 5', '-q 10,10', - '-m 20', '-b file:/opt2/TruSeq_and_nextera_adapters.consolidated.fa' - ].join(' ').trim() - def prefix = task.ext.prefix ?: "${meta.id}" - def trimmed = meta.single_end ? "-o ${prefix}.trim.fastq.gz" : "-o ${prefix}_1.trim.fastq.gz -p ${prefix}_2.trim.fastq.gz" + ] + if (meta.single_end) { + args += [ + '-m 20' + ] + } else { + args += [ + '-B file:/opt2/TruSeq_and_nextera_adapters.consolidated.fa', + '-m 20:20', + ] + } + args = args.join(' ').trim() """ cutadapt \\ --cores ${task.cpus} \\ diff --git a/tests/modules/CCBR/cutadapt/nextflow.config b/tests/modules/CCBR/cutadapt/nextflow.config index 2af532c..8730f1c 100644 --- a/tests/modules/CCBR/cutadapt/nextflow.config +++ b/tests/modules/CCBR/cutadapt/nextflow.config @@ -2,8 +2,4 @@ process { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - withName: CUTADAPT { - ext.args = '-q 25' - } - } diff --git a/tests/modules/CCBR/cutadapt/test.yml b/tests/modules/CCBR/cutadapt/test.yml index 155f4b0..4431487 100644 --- a/tests/modules/CCBR/cutadapt/test.yml +++ b/tests/modules/CCBR/cutadapt/test.yml @@ -4,7 +4,11 @@ - cutadapt files: - path: ./output/cutadapt/test.cutadapt.log + contains: + - "Command line parameters: --cores 2 --nextseq-trim=2 --trim-n -n 5 -O 5 -q 10,10 -b file:/opt2/TruSeq_and_nextera_adapters.consolidated.fa -m 20 -o test.trim.fastq.gz test_1.fastq.gz" + - path: ./output/cutadapt/versions.yml - path: ./output/cutadapt/test.trim.fastq.gz + md5sum: 457a0f3ce7901051741998cb0fdde4e6 - name: cutadapt single-end stub command: nextflow run ./tests/modules/CCBR/cutadapt -entry test_cutadapt_single_end -c ./tests/config/nextflow.config -c ./tests/modules/CCBR/cutadapt/nextflow.config -stub-run @@ -12,6 +16,7 @@ - cutadapt files: - path: ./output/cutadapt/test.cutadapt.log + - path: ./output/cutadapt/versions.yml - path: ./output/cutadapt/test.trim.fastq.gz - name: cutadapt paired-end @@ -20,8 +25,13 @@ - cutadapt files: - path: ./output/cutadapt/test.cutadapt.log + contains: + - "Command line parameters: --cores 2 --nextseq-trim=2 --trim-n -n 5 -O 5 -q 10,10 -b file:/opt2/TruSeq_and_nextera_adapters.consolidated.fa -B file:/opt2/TruSeq_and_nextera_adapters.consolidated.fa -m 20:20 -o test_1.trim.fastq.gz -p test_2.trim.fastq.gz test_1.fastq.gz test_2.fastq.gz" + - path: ./output/cutadapt/versions.yml - path: ./output/cutadapt/test_1.trim.fastq.gz + md5sum: 61b8cabfa206d4867b5be4c78f0b9015 - path: ./output/cutadapt/test_2.trim.fastq.gz + md5sum: cff4ada2ab02c3b95bc91efa59d12ac0 - name: cutadapt paired-end stub command: nextflow run ./tests/modules/CCBR/cutadapt -entry test_cutadapt_paired_end -c ./tests/config/nextflow.config -c ./tests/modules/CCBR/cutadapt/nextflow.config -stub-run @@ -29,5 +39,6 @@ - cutadapt files: - path: ./output/cutadapt/test.cutadapt.log + - path: ./output/cutadapt/versions.yml - path: ./output/cutadapt/test_1.trim.fastq.gz - path: ./output/cutadapt/test_2.trim.fastq.gz From 24a287edd75e3d41ed54fc54282a63ba77003cd1 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Thu, 19 Oct 2023 10:50:58 -0400 Subject: [PATCH 2/2] fix: md5sums for cutadapt are unstable, don't use them --- tests/modules/CCBR/cutadapt/test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/modules/CCBR/cutadapt/test.yml b/tests/modules/CCBR/cutadapt/test.yml index 4431487..c8c08cc 100644 --- a/tests/modules/CCBR/cutadapt/test.yml +++ b/tests/modules/CCBR/cutadapt/test.yml @@ -8,7 +8,6 @@ - "Command line parameters: --cores 2 --nextseq-trim=2 --trim-n -n 5 -O 5 -q 10,10 -b file:/opt2/TruSeq_and_nextera_adapters.consolidated.fa -m 20 -o test.trim.fastq.gz test_1.fastq.gz" - path: ./output/cutadapt/versions.yml - path: ./output/cutadapt/test.trim.fastq.gz - md5sum: 457a0f3ce7901051741998cb0fdde4e6 - name: cutadapt single-end stub command: nextflow run ./tests/modules/CCBR/cutadapt -entry test_cutadapt_single_end -c ./tests/config/nextflow.config -c ./tests/modules/CCBR/cutadapt/nextflow.config -stub-run @@ -29,9 +28,7 @@ - "Command line parameters: --cores 2 --nextseq-trim=2 --trim-n -n 5 -O 5 -q 10,10 -b file:/opt2/TruSeq_and_nextera_adapters.consolidated.fa -B file:/opt2/TruSeq_and_nextera_adapters.consolidated.fa -m 20:20 -o test_1.trim.fastq.gz -p test_2.trim.fastq.gz test_1.fastq.gz test_2.fastq.gz" - path: ./output/cutadapt/versions.yml - path: ./output/cutadapt/test_1.trim.fastq.gz - md5sum: 61b8cabfa206d4867b5be4c78f0b9015 - path: ./output/cutadapt/test_2.trim.fastq.gz - md5sum: cff4ada2ab02c3b95bc91efa59d12ac0 - name: cutadapt paired-end stub command: nextflow run ./tests/modules/CCBR/cutadapt -entry test_cutadapt_paired_end -c ./tests/config/nextflow.config -c ./tests/modules/CCBR/cutadapt/nextflow.config -stub-run