diff --git a/modules/nf-core/spring/decompress/main.nf b/modules/nf-core/spring/decompress/main.nf index 94448bddbeb..4cf78299178 100644 --- a/modules/nf-core/spring/decompress/main.nf +++ b/modules/nf-core/spring/decompress/main.nf @@ -9,6 +9,7 @@ process SPRING_DECOMPRESS { input: tuple val(meta), path(spring) + val(write_one_fastq_gz) output: tuple val(meta), path("*.fastq.gz"), emit: fastq @@ -21,7 +22,7 @@ process SPRING_DECOMPRESS { def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" def VERSION = '1.1.1' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. - def output = meta.single_end ? "-o ${prefix}.fastq.gz" : "-o ${prefix}_R1.fastq.gz ${prefix}_R2.fastq.gz" + def output = write_one_fastq_gz ? "-o ${prefix}.fastq.gz" : "-o ${prefix}_R1.fastq.gz ${prefix}_R2.fastq.gz" """ spring \\ diff --git a/modules/nf-core/spring/decompress/meta.yml b/modules/nf-core/spring/decompress/meta.yml index 8f43aa93d4d..a3449b4fb3d 100644 --- a/modules/nf-core/spring/decompress/meta.yml +++ b/modules/nf-core/spring/decompress/meta.yml @@ -11,7 +11,7 @@ tools: documentation: "https://github.com/shubhamchandak94/Spring/blob/master/README.md" tool_dev_url: "https://github.com/shubhamchandak94/Spring" doi: "10.1093/bioinformatics/bty1015" - licence: "['Free for non-commercial use']" + licence: ["Free for non-commercial use"] input: - meta: type: map @@ -22,6 +22,11 @@ input: type: file description: Spring file to decompress. pattern: "*.{spring}" + - write_one_fastq_gz: + type: boolean + description: | + Controls whether spring should write one fastq.gz file with reads from both directions or two fastq.gz files with reads from distinct directions + pattern: "true or false" output: - meta: type: map diff --git a/modules/nf-core/spring/decompress/test/main.nf.test b/modules/nf-core/spring/decompress/test/main.nf.test new file mode 100644 index 00000000000..550c6746b82 --- /dev/null +++ b/modules/nf-core/spring/decompress/test/main.nf.test @@ -0,0 +1,78 @@ +nextflow_process { + + name "Test Process SPRING_DECOMPRESS" + tag "modules_nfcore" + tag "modules" + tag "spring" + tag "spring/decompress" + script "../main.nf" + process "SPRING_DECOMPRESS" + + test("Write-One-File") { + + setup { + run("SPRING_COMPRESS") { + script "../../compress/main.nf" + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + '/genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + [] + ] + """ + } + } + } + + when { + process { + """ + input[0] = SPRING_COMPRESS.out.spring + input[1] = true // write_one_fastq_gz + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("Write-Two-Files") { + + setup { + run("SPRING_COMPRESS") { + script "../../compress/main.nf" + process { + """ + input[0] = [ + [ id:'test2' ], // meta map + file(params.modules_testdata_base_path + '/genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + '/genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true), + ] + """ + } + } + } + + when { + process { + """ + input[0] = SPRING_COMPRESS.out.spring + input[1] = false // write_one_fastq_gz + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } +} \ No newline at end of file diff --git a/modules/nf-core/spring/decompress/test/main.nf.test.snap b/modules/nf-core/spring/decompress/test/main.nf.test.snap new file mode 100644 index 00000000000..14a11d2c41d --- /dev/null +++ b/modules/nf-core/spring/decompress/test/main.nf.test.snap @@ -0,0 +1,74 @@ +{ + "Write-Two-Files": { + "content": [ + { + "0": [ + [ + { + "id": "test2" + }, + [ + "test2_R1.fastq.gz:md5,4161df271f9bfcd25d5845a1e220dbec", + "test2_R2.fastq.gz:md5,2ebae722295ea66d84075a3b042e2b42" + ] + ] + ], + "1": [ + "versions.yml:md5,4711df5941f1464e3693d24dd29c705b" + ], + "fastq": [ + [ + { + "id": "test2" + }, + [ + "test2_R1.fastq.gz:md5,4161df271f9bfcd25d5845a1e220dbec", + "test2_R2.fastq.gz:md5,2ebae722295ea66d84075a3b042e2b42" + ] + ] + ], + "versions": [ + "versions.yml:md5,4711df5941f1464e3693d24dd29c705b" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-21T13:41:46.090761471" + }, + "Write-One-File": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.fastq.gz:md5,4161df271f9bfcd25d5845a1e220dbec" + ] + ], + "1": [ + "versions.yml:md5,4711df5941f1464e3693d24dd29c705b" + ], + "fastq": [ + [ + { + "id": "test" + }, + "test.fastq.gz:md5,4161df271f9bfcd25d5845a1e220dbec" + ] + ], + "versions": [ + "versions.yml:md5,4711df5941f1464e3693d24dd29c705b" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-21T13:02:07.466039653" + } +} \ No newline at end of file diff --git a/modules/nf-core/spring/decompress/test/nextflow.config b/modules/nf-core/spring/decompress/test/nextflow.config new file mode 100644 index 00000000000..50f50a7a357 --- /dev/null +++ b/modules/nf-core/spring/decompress/test/nextflow.config @@ -0,0 +1,5 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + +} \ No newline at end of file diff --git a/modules/nf-core/spring/decompress/test/tags.yml b/modules/nf-core/spring/decompress/test/tags.yml new file mode 100644 index 00000000000..1fe70aec917 --- /dev/null +++ b/modules/nf-core/spring/decompress/test/tags.yml @@ -0,0 +1,3 @@ +spring/decompress: + - modules/nf-core/spring/compress/** + - modules/nf-core/spring/decompress/** diff --git a/tests/modules/nf-core/spring/decompress/main.nf b/tests/modules/nf-core/spring/decompress/main.nf index 57a455bce2c..0a6b7fdc725 100644 --- a/tests/modules/nf-core/spring/decompress/main.nf +++ b/tests/modules/nf-core/spring/decompress/main.nf @@ -8,23 +8,23 @@ include { SPRING_DECOMPRESS } from '../../../../../modules/nf-core/spring/decomp workflow test_spring_decompress_single_end { input = [ - [ id:'test', single_end:true ], // meta map + [ id:'test' ], // meta map file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), [] ] SPRING_COMPRESS ( input ) - SPRING_DECOMPRESS ( SPRING_COMPRESS.out.spring ) + SPRING_DECOMPRESS ( SPRING_COMPRESS.out.spring, true ) } workflow test_spring_decompress_paired_end { input = [ - [ id:'test', single_end:false ], // meta map + [ id:'test' ], // meta map file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) ] SPRING_COMPRESS ( input ) - SPRING_DECOMPRESS ( SPRING_COMPRESS.out.spring ) + SPRING_DECOMPRESS ( SPRING_COMPRESS.out.spring, false ) }