From e87b963ea90e68e85bfb113f6ba5e656ad77907b Mon Sep 17 00:00:00 2001 From: Tommaso Mazza Date: Mon, 23 Dec 2024 19:09:07 +0000 Subject: [PATCH] Add args in command line - gzrt --- modules/nf-core/gzrt/main.nf | 13 +-- modules/nf-core/gzrt/tests/main.nf.test.snap | 89 ++++++++++---------- 2 files changed, 52 insertions(+), 50 deletions(-) diff --git a/modules/nf-core/gzrt/main.nf b/modules/nf-core/gzrt/main.nf index 2205b4251de..a8c398ec652 100644 --- a/modules/nf-core/gzrt/main.nf +++ b/modules/nf-core/gzrt/main.nf @@ -11,14 +11,15 @@ process GZRT { tuple val(meta), path(fastqgz) output: - tuple val(meta), path("${prefix}(?:_1|_2)?.fastq.gz"), emit: recovered - path "versions.yml" , emit: versions + tuple val(meta), path("${prefix}*.fastq.gz"), emit: recovered + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when script: - prefix = task.ext.prefix ?: "${meta.id}_recovered" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}_recovered" fastqgz.each { file -> if (file.extension != "gz") { error "GZRT works with .gz files only. Offending file: ${file}" @@ -32,14 +33,14 @@ process GZRT { """ if [ "$meta.single_end" == true ]; then - gzrecover -p ${fastqgz} | gzip > ${prefix}.fastq.gz + gzrecover ${args} -p ${fastqgz} | gzip > ${prefix}.fastq.gz if [ -e "${prefix}.fastq.gz" ] && [ ! -s "${prefix}.fastq.gz" ]; then echo "" | gzip > ${prefix}.fastq.gz fi else - gzrecover -p ${fastqgz[0]} | gzip > ${prefix}_1.fastq.gz - gzrecover -p ${fastqgz[1]} | gzip > ${prefix}_2.fastq.gz + gzrecover ${args} -p ${fastqgz[0]} | gzip > ${prefix}_1.fastq.gz + gzrecover ${args} -p ${fastqgz[1]} | gzip > ${prefix}_2.fastq.gz if [ -e "${prefix}_1.fastq.gz" ] && [ ! -s "${prefix}_1.fastq.gz" ]; then echo "" | gzip > ${prefix}_1.fastq.gz diff --git a/modules/nf-core/gzrt/tests/main.nf.test.snap b/modules/nf-core/gzrt/tests/main.nf.test.snap index 2a574165110..af87aac1011 100644 --- a/modules/nf-core/gzrt/tests/main.nf.test.snap +++ b/modules/nf-core/gzrt/tests/main.nf.test.snap @@ -1,14 +1,14 @@ { - "Run gzrt on test2_1_corrupted - fastq.gz - stub": { + "Run gzrt on test2_1_corrupted single-end - fastq.gz": { "content": [ { "0": [ [ { - "id": "test", - "single_end": false + "id": "test-single", + "single_end": true }, - "test_recovered.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + "test-single_recovered.fastq.gz:md5,78b566f63fbd4e4c29902c6217993e03" ] ], "1": [ @@ -17,10 +17,10 @@ "recovered": [ [ { - "id": "test", - "single_end": false + "id": "test-single", + "single_end": true }, - "test_recovered.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + "test-single_recovered.fastq.gz:md5,78b566f63fbd4e4c29902c6217993e03" ] ], "versions": [ @@ -32,18 +32,21 @@ "nf-test": "0.9.2", "nextflow": "24.10.3" }, - "timestamp": "2024-12-22T10:35:18.233218" + "timestamp": "2024-12-23T19:00:33.679803153" }, - "Run gzrt on test2_1_corrupted single-end - fastq.gz": { + "Run gzrt on test2_1_corrupted - fastq.gz - stub": { "content": [ { "0": [ [ { - "id": "test-single", - "single_end": true + "id": "test", + "single_end": false }, - "test-single_recovered.fastq.gz:md5,78b566f63fbd4e4c29902c6217993e03" + [ + "test_recovered_1.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test_recovered_2.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] ] ], "1": [ @@ -52,10 +55,13 @@ "recovered": [ [ { - "id": "test-single", - "single_end": true + "id": "test", + "single_end": false }, - "test-single_recovered.fastq.gz:md5,78b566f63fbd4e4c29902c6217993e03" + [ + "test_recovered_1.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test_recovered_2.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] ] ], "versions": [ @@ -67,45 +73,40 @@ "nf-test": "0.9.2", "nextflow": "24.10.3" }, - "timestamp": "2024-12-22T14:48:19.882831" + "timestamp": "2024-12-23T19:01:25.657233606" }, "Run gzrt on test2_1_corrupted paired-end - fastq.gz": { "content": [ { "0": [ - - ], - "1": [ - - ], - "recovered": [ - - ], - "versions": [ - - ] - } - ], - "meta": { - "nf-test": "0.9.2", - "nextflow": "24.10.3" - }, - "timestamp": "2024-12-22T14:49:18.818601" - }, - "Run gzrt on test2_1_corrupted - fastq.gz": { - "content": [ - { - "0": [ - + [ + { + "id": "test-paired", + "single_end": false + }, + [ + "test-paired_recovered_1.fastq.gz:md5,78b566f63fbd4e4c29902c6217993e03", + "test-paired_recovered_2.fastq.gz:md5,641919946a0e572ca7483f6e54476f3b" + ] + ] ], "1": [ - + "versions.yml:md5,6d1e28b8a8043e3cba67606c7acdc676" ], "recovered": [ - + [ + { + "id": "test-paired", + "single_end": false + }, + [ + "test-paired_recovered_1.fastq.gz:md5,78b566f63fbd4e4c29902c6217993e03", + "test-paired_recovered_2.fastq.gz:md5,641919946a0e572ca7483f6e54476f3b" + ] + ] ], "versions": [ - + "versions.yml:md5,6d1e28b8a8043e3cba67606c7acdc676" ] } ], @@ -113,6 +114,6 @@ "nf-test": "0.9.2", "nextflow": "24.10.3" }, - "timestamp": "2024-12-22T14:35:45.10345" + "timestamp": "2024-12-23T19:01:02.506192477" } } \ No newline at end of file