From f83f04e61a8662920db1802fbaa29ce8585c4a49 Mon Sep 17 00:00:00 2001 From: Darko Cucin Date: Tue, 29 Oct 2024 15:44:02 +0100 Subject: [PATCH 1/5] Adding sequali module --- modules/nf-core/sequali/environment.yml | 7 + modules/nf-core/sequali/main.nf | 58 +++++++ modules/nf-core/sequali/meta.yml | 60 +++++++ modules/nf-core/sequali/tests/main.nf.test | 163 ++++++++++++++++++ .../nf-core/sequali/tests/main.nf.test.snap | 74 ++++++++ 5 files changed, 362 insertions(+) create mode 100644 modules/nf-core/sequali/environment.yml create mode 100644 modules/nf-core/sequali/main.nf create mode 100644 modules/nf-core/sequali/meta.yml create mode 100644 modules/nf-core/sequali/tests/main.nf.test create mode 100644 modules/nf-core/sequali/tests/main.nf.test.snap diff --git a/modules/nf-core/sequali/environment.yml b/modules/nf-core/sequali/environment.yml new file mode 100644 index 00000000000..079b71cde87 --- /dev/null +++ b/modules/nf-core/sequali/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - "bioconda::sequali=0.12.0" diff --git a/modules/nf-core/sequali/main.nf b/modules/nf-core/sequali/main.nf new file mode 100644 index 00000000000..718c07171c9 --- /dev/null +++ b/modules/nf-core/sequali/main.nf @@ -0,0 +1,58 @@ +process SEQUALI { + tag "$meta.id" + label 'process_low' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'oras://community.wave.seqera.io/library/sequali:0.12.0--c288fa2befb47d0f': + 'community.wave.seqera.io/library/sequali:0.12.0--07485bec824d914a' }" + + input: + + tuple val(meta), path(reads) + + output: + + tuple val(meta), path("*.html"), emit: html + tuple val(meta), path("*.json"), emit: json + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def read_1_bam = reads.size() == 1 ? reads : reads[0] + def read_2 = reads.size() == 2 ? reads[1]: "" + + """ + sequali \\ + $args \\ + -t $task.cpus \\ + --html ${prefix}.html \\ + --json ${prefix}.json \\ + $read_1_bam \\ + $read_2 + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + sequali: \$(sequali --version |& sed '1!d ; s/sequali //') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + """ + touch ${prefix}.html + touch ${prefix}.json + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + sequali: \$(sequali --version |& sed '1!d ; s/sequali //') + END_VERSIONS + """ +} + diff --git a/modules/nf-core/sequali/meta.yml b/modules/nf-core/sequali/meta.yml new file mode 100644 index 00000000000..62dc6e85e00 --- /dev/null +++ b/modules/nf-core/sequali/meta.yml @@ -0,0 +1,60 @@ +--- +name: sequali +description: Sequence quality metrics for FASTQ and uBAM files. +keywords: + - quality_control + - qc + - preprocessing +tools: + - sequali: + description: Fast sequencing quality metrics + homepage: "https://github.com/rhpvorderman/sequali" + documentation: "https://sequali.readthedocs.io/en/latest/" + tool_dev_url: "https://github.com/rhpvorderman/sequali" + doi: "10.5281/zenodo.10854010" + licence: ["AGPL v3-or-later"] + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + - reads: + type: file + description: Input FASTQ(s) or uBAM file. The format is autodetected and compressed formats are supported. + pattern: "*.{fastq,fq,fastq.gz,fq.gz,bam}" +output: + - json: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.json": + type: file + description: JSON output file. + pattern: "*.{json}" + - html: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.html": + type: file + description: HTML output file. + pattern: "*.{html}" + + - versions: + - "versions.yml": + type: file + description: File containing software versions. + pattern: "versions.yml" +authors: + - "@irliampa" + - "@DarkoCucin" +maintainers: + - "@irliampa" + - "@DarkoCucin" diff --git a/modules/nf-core/sequali/tests/main.nf.test b/modules/nf-core/sequali/tests/main.nf.test new file mode 100644 index 00000000000..071ee70fab5 --- /dev/null +++ b/modules/nf-core/sequali/tests/main.nf.test @@ -0,0 +1,163 @@ +nextflow_process { + + name "Test Process SEQUALI" + script "../main.nf" + process "SEQUALI" + + tag "modules" + tag "modules_nfcore" + tag "sequali" + + test("sarscov2 - fastq single-end [sequali]") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:true], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert process.out.html[0][1] ==~ ".*/test.html"}, + { assert process.out.json[0][1] ==~ ".*/test.json"}, + { assert snapshot(process.out.versions).match() } + ) + } + + } + + test("sarscov2 - fastq paired-end [sequali]") { + + when { + process { + """ + input[0] = Channel.of([ + [id: 'test', single_end: false], // 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) ] + ]) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert process.out.html[0][1] ==~ ".*/test.html"}, + { assert process.out.json[0][1] ==~ ".*/test.json"}, + { assert snapshot(process.out.versions).match() } + ) + } + + } + + + test("sarscov2 - unaligned bam [sequali]") { + + when { + process { + """ + input[0] = Channel.of([ + [id: 'test', single_end: true], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.unaligned.bam', checkIfExists: true) ]) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert process.out.html[0][1] ==~ ".*/test.html"}, + { assert process.out.json[0][1] ==~ ".*/test.json"}, + { assert snapshot(process.out.versions).match() } + ) + } + + } + + test("sarscov2 - fastq single-end - stub[sequali]") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:true ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert process.out.html[0][1] ==~ ".*/test.html"}, + { assert process.out.json[0][1] ==~ ".*/test.json"}, + { assert snapshot(process.out.versions).match() } + ) + } + + } + + test("sarscov2 - fastq paired-end - stub[sequali]") { + + options "-stub" + + when { + process { + """ + input[0] = Channel.of([ + [id: 'test', single_end: false], // 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) ] + ]) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert process.out.html[0][1] ==~ ".*/test.html"}, + { assert process.out.json[0][1] ==~ ".*/test.json"}, + { assert snapshot(process.out.versions).match() } + ) + } + + } + + test("sarscov2 - unaligned bam - stub[sequali]") { + + options "-stub" + + when { + process { + """ + input[0] = Channel.of([ + [id: 'test', single_end: true], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.unaligned.bam', checkIfExists: true) ]) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert process.out.html[0][1] ==~ ".*/test.html"}, + { assert process.out.json[0][1] ==~ ".*/test.json"}, + { assert snapshot(process.out.versions).match() } + ) + } + + } + + +} diff --git a/modules/nf-core/sequali/tests/main.nf.test.snap b/modules/nf-core/sequali/tests/main.nf.test.snap new file mode 100644 index 00000000000..201aec4ee83 --- /dev/null +++ b/modules/nf-core/sequali/tests/main.nf.test.snap @@ -0,0 +1,74 @@ +{ + "sarscov2 - unaligned bam stub [sequali]": { + "content": [ + [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-10-29T12:56:50.266586" + }, + "sarscov2 - fastq paired-end [sequali]": { + "content": [ + [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-10-29T12:55:13.71146" + }, + "sarscov2 - fastq paired-end stub[sequali]": { + "content": [ + [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-10-29T12:56:28.225926" + }, + "sarscov2 - fastq single-end - stub[sequali]": { + "content": [ + [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-10-29T12:56:05.920598" + }, + "sarscov2 - fastq single-end [sequali]": { + "content": [ + [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-10-29T12:54:09.135042" + }, + "sarscov2 - unaligned bam [sequali]": { + "content": [ + [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-10-29T12:55:43.528332" + } +} \ No newline at end of file From 095766489d7899d39e13645fe57ab6d445dc597e Mon Sep 17 00:00:00 2001 From: "Eirini (Irene) Liampa" Date: Wed, 30 Oct 2024 10:25:16 +0100 Subject: [PATCH 2/5] Update modules/nf-core/sequali/environment.yml typo fixed Co-authored-by: Louis LE NEZET <58640615+LouisLeNezet@users.noreply.github.com> --- modules/nf-core/sequali/environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nf-core/sequali/environment.yml b/modules/nf-core/sequali/environment.yml index 079b71cde87..b712a24fdd5 100644 --- a/modules/nf-core/sequali/environment.yml +++ b/modules/nf-core/sequali/environment.yml @@ -4,4 +4,4 @@ channels: - conda-forge - bioconda dependencies: - - "bioconda::sequali=0.12.0" + - bioconda::sequali=0.12.0 From b817325b655c8364afb729bdd6f09ae003209b12 Mon Sep 17 00:00:00 2001 From: Darko Cucin Date: Wed, 30 Oct 2024 12:54:21 +0100 Subject: [PATCH 3/5] Getting a snapsot for JSON file (without meta field) --- modules/nf-core/sequali/environment.yml | 2 +- modules/nf-core/sequali/tests/main.nf.test | 9 ++--- .../nf-core/sequali/tests/main.nf.test.snap | 34 ++++++++----------- 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/modules/nf-core/sequali/environment.yml b/modules/nf-core/sequali/environment.yml index 079b71cde87..b712a24fdd5 100644 --- a/modules/nf-core/sequali/environment.yml +++ b/modules/nf-core/sequali/environment.yml @@ -4,4 +4,4 @@ channels: - conda-forge - bioconda dependencies: - - "bioconda::sequali=0.12.0" + - bioconda::sequali=0.12.0 diff --git a/modules/nf-core/sequali/tests/main.nf.test b/modules/nf-core/sequali/tests/main.nf.test index 071ee70fab5..5b1acd9d4be 100644 --- a/modules/nf-core/sequali/tests/main.nf.test +++ b/modules/nf-core/sequali/tests/main.nf.test @@ -25,8 +25,7 @@ nextflow_process { assertAll( { assert process.success }, { assert process.out.html[0][1] ==~ ".*/test.html"}, - { assert process.out.json[0][1] ==~ ".*/test.json"}, - { assert snapshot(process.out.versions).match() } + { assert snapshot( path(process.out.json[0][1]).json.key != "meta" + process.out.versions ).match() } ) } @@ -50,8 +49,7 @@ nextflow_process { assertAll( { assert process.success }, { assert process.out.html[0][1] ==~ ".*/test.html"}, - { assert process.out.json[0][1] ==~ ".*/test.json"}, - { assert snapshot(process.out.versions).match() } + { assert snapshot( path(process.out.json[0][1]).json.key != "meta" + process.out.versions ).match() } ) } @@ -74,8 +72,7 @@ nextflow_process { assertAll( { assert process.success }, { assert process.out.html[0][1] ==~ ".*/test.html"}, - { assert process.out.json[0][1] ==~ ".*/test.json"}, - { assert snapshot(process.out.versions).match() } + { assert snapshot( path(process.out.json[0][1]).json.key != "meta" + process.out.versions ).match() } ) } diff --git a/modules/nf-core/sequali/tests/main.nf.test.snap b/modules/nf-core/sequali/tests/main.nf.test.snap index 201aec4ee83..6c15f87c950 100644 --- a/modules/nf-core/sequali/tests/main.nf.test.snap +++ b/modules/nf-core/sequali/tests/main.nf.test.snap @@ -1,5 +1,5 @@ { - "sarscov2 - unaligned bam stub [sequali]": { + "sarscov2 - unaligned bam - stub[sequali]": { "content": [ [ "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" @@ -9,21 +9,19 @@ "nf-test": "0.9.1", "nextflow": "24.10.0" }, - "timestamp": "2024-10-29T12:56:50.266586" + "timestamp": "2024-10-30T12:50:13.212374" }, "sarscov2 - fastq paired-end [sequali]": { "content": [ - [ - "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" - ] + true ], "meta": { "nf-test": "0.9.1", "nextflow": "24.10.0" }, - "timestamp": "2024-10-29T12:55:13.71146" + "timestamp": "2024-10-30T12:49:19.262845" }, - "sarscov2 - fastq paired-end stub[sequali]": { + "sarscov2 - fastq single-end - stub[sequali]": { "content": [ [ "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" @@ -33,33 +31,29 @@ "nf-test": "0.9.1", "nextflow": "24.10.0" }, - "timestamp": "2024-10-29T12:56:28.225926" + "timestamp": "2024-10-30T12:49:49.874109" }, - "sarscov2 - fastq single-end - stub[sequali]": { + "sarscov2 - fastq single-end [sequali]": { "content": [ - [ - "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" - ] + true ], "meta": { "nf-test": "0.9.1", "nextflow": "24.10.0" }, - "timestamp": "2024-10-29T12:56:05.920598" + "timestamp": "2024-10-30T12:48:24.833688" }, - "sarscov2 - fastq single-end [sequali]": { + "sarscov2 - unaligned bam [sequali]": { "content": [ - [ - "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" - ] + true ], "meta": { "nf-test": "0.9.1", "nextflow": "24.10.0" }, - "timestamp": "2024-10-29T12:54:09.135042" + "timestamp": "2024-10-30T12:49:38.254876" }, - "sarscov2 - unaligned bam [sequali]": { + "sarscov2 - fastq paired-end - stub[sequali]": { "content": [ [ "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" @@ -69,6 +63,6 @@ "nf-test": "0.9.1", "nextflow": "24.10.0" }, - "timestamp": "2024-10-29T12:55:43.528332" + "timestamp": "2024-10-30T12:50:01.630902" } } \ No newline at end of file From 2544f4bd8f2e7df9469da55bd2629b2885a11b3b Mon Sep 17 00:00:00 2001 From: Darko Cucin Date: Thu, 31 Oct 2024 08:04:27 +0100 Subject: [PATCH 4/5] modifying main.nf.test --- modules/nf-core/sequali/tests/main.nf.test | 61 +++--- .../nf-core/sequali/tests/main.nf.test.snap | 201 ++++++++++++++++-- 2 files changed, 213 insertions(+), 49 deletions(-) diff --git a/modules/nf-core/sequali/tests/main.nf.test b/modules/nf-core/sequali/tests/main.nf.test index 5b1acd9d4be..a2341c42cab 100644 --- a/modules/nf-core/sequali/tests/main.nf.test +++ b/modules/nf-core/sequali/tests/main.nf.test @@ -13,25 +13,26 @@ nextflow_process { when { process { """ - input[0] = [ - [ id:'test', single_end:true], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), - ] + input[0] = Channel.of([ + [ id:'test', single_end:true ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)]) """ } } - then { + def json_file = path(process.out.json[0][1]).json.get('summary') assertAll( { assert process.success }, { assert process.out.html[0][1] ==~ ".*/test.html"}, - { assert snapshot( path(process.out.json[0][1]).json.key != "meta" + process.out.versions ).match() } + { assert snapshot( + process.out.versions, + json_file, + ).match() } ) } } - - test("sarscov2 - fastq paired-end [sequali]") { + test("sarscov2 - fastq paired-end [sequali]") { when { process { @@ -46,49 +47,55 @@ nextflow_process { } then { + def json_file = path(process.out.json[0][1]).json.get('summary') assertAll( { assert process.success }, { assert process.out.html[0][1] ==~ ".*/test.html"}, - { assert snapshot( path(process.out.json[0][1]).json.key != "meta" + process.out.versions ).match() } + { assert snapshot( + process.out.versions, + json_file, + ).match() } ) } } - - test("sarscov2 - unaligned bam [sequali]") { + test("sarscov2 - unaligned bam [sequali]") { when { process { """ input[0] = Channel.of([ [id: 'test', single_end: true], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.unaligned.bam', checkIfExists: true) ]) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.unaligned.bam', checkIfExists: true)]) """ } } then { + def json_file = path(process.out.json[0][1]).json.get('summary') assertAll( { assert process.success }, { assert process.out.html[0][1] ==~ ".*/test.html"}, - { assert snapshot( path(process.out.json[0][1]).json.key != "meta" + process.out.versions ).match() } + { assert snapshot( + process.out.versions, + json_file, + ).match() } ) } } - test("sarscov2 - fastq single-end - stub[sequali]") { + test("sarscov2 - fastq single-end - stub[sequali]") { options "-stub" when { process { """ - input[0] = [ + input[0] = Channel.of([ [ id:'test', single_end:true ], // 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_1.fastq.gz', checkIfExists: true)]) """ } } @@ -96,15 +103,12 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert process.out.html[0][1] ==~ ".*/test.html"}, - { assert process.out.json[0][1] ==~ ".*/test.json"}, - { assert snapshot(process.out.versions).match() } + { assert snapshot(process.out).match() } ) } } - - test("sarscov2 - fastq paired-end - stub[sequali]") { + test("sarscov2 - fastq paired-end - stub[sequali]") { options "-stub" @@ -123,15 +127,13 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert process.out.html[0][1] ==~ ".*/test.html"}, - { assert process.out.json[0][1] ==~ ".*/test.json"}, - { assert snapshot(process.out.versions).match() } + { assert snapshot(process.out).match() } ) } } - test("sarscov2 - unaligned bam - stub[sequali]") { + test("sarscov2 - unaligned bam - stub[sequali]") { options "-stub" @@ -140,7 +142,7 @@ nextflow_process { """ input[0] = Channel.of([ [id: 'test', single_end: true], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.unaligned.bam', checkIfExists: true) ]) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.unaligned.bam', checkIfExists: true)]) """ } } @@ -148,13 +150,10 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert process.out.html[0][1] ==~ ".*/test.html"}, - { assert process.out.json[0][1] ==~ ".*/test.json"}, - { assert snapshot(process.out.versions).match() } + { assert snapshot(process.out).match() } ) } } - } diff --git a/modules/nf-core/sequali/tests/main.nf.test.snap b/modules/nf-core/sequali/tests/main.nf.test.snap index 6c15f87c950..8a2315e6014 100644 --- a/modules/nf-core/sequali/tests/main.nf.test.snap +++ b/modules/nf-core/sequali/tests/main.nf.test.snap @@ -1,68 +1,233 @@ { "sarscov2 - unaligned bam - stub[sequali]": { "content": [ - [ - "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" - ] + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": true + }, + "test.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ], + "html": [ + [ + { + "id": "test", + "single_end": true + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "json": [ + [ + { + "id": "test", + "single_end": true + }, + "test.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ] + } ], "meta": { "nf-test": "0.9.1", "nextflow": "24.10.0" }, - "timestamp": "2024-10-30T12:50:13.212374" + "timestamp": "2024-10-31T08:01:31.355353" }, "sarscov2 - fastq paired-end [sequali]": { "content": [ - true + [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ], + { + "mean_length": 138.97, + "minimum_length": 72, + "maximum_length": 151, + "total_reads": 100, + "q20_reads": 91, + "total_bases": 13897, + "q20_bases": 12922, + "total_gc_bases": 5430, + "total_n_bases": 0, + "read_pair_info": "Read 1" + } ], "meta": { "nf-test": "0.9.1", "nextflow": "24.10.0" }, - "timestamp": "2024-10-30T12:49:19.262845" + "timestamp": "2024-10-31T08:00:35.477844" }, "sarscov2 - fastq single-end - stub[sequali]": { "content": [ - [ - "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" - ] + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": true + }, + "test.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ], + "html": [ + [ + { + "id": "test", + "single_end": true + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "json": [ + [ + { + "id": "test", + "single_end": true + }, + "test.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ] + } ], "meta": { "nf-test": "0.9.1", "nextflow": "24.10.0" }, - "timestamp": "2024-10-30T12:49:49.874109" + "timestamp": "2024-10-31T08:01:06.366473" }, "sarscov2 - fastq single-end [sequali]": { "content": [ - true + [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ], + { + "mean_length": 138.97, + "minimum_length": 72, + "maximum_length": 151, + "total_reads": 100, + "q20_reads": 91, + "total_bases": 13897, + "q20_bases": 12922, + "total_gc_bases": 5430, + "total_n_bases": 0, + "read_pair_info": null + } ], "meta": { "nf-test": "0.9.1", "nextflow": "24.10.0" }, - "timestamp": "2024-10-30T12:48:24.833688" + "timestamp": "2024-10-31T07:59:41.195578" }, "sarscov2 - unaligned bam [sequali]": { "content": [ - true + [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ], + { + "mean_length": 138.97, + "minimum_length": 72, + "maximum_length": 151, + "total_reads": 100, + "q20_reads": 91, + "total_bases": 13897, + "q20_bases": 12922, + "total_gc_bases": 5430, + "total_n_bases": 0, + "read_pair_info": null + } ], "meta": { "nf-test": "0.9.1", "nextflow": "24.10.0" }, - "timestamp": "2024-10-30T12:49:38.254876" + "timestamp": "2024-10-31T08:00:54.4785" }, "sarscov2 - fastq paired-end - stub[sequali]": { "content": [ - [ - "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" - ] + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ], + "html": [ + [ + { + "id": "test", + "single_end": false + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "json": [ + [ + { + "id": "test", + "single_end": false + }, + "test.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ] + } ], "meta": { "nf-test": "0.9.1", "nextflow": "24.10.0" }, - "timestamp": "2024-10-30T12:50:01.630902" + "timestamp": "2024-10-31T08:01:19.342814" } } \ No newline at end of file From a0e464dfaad5592742f9f09a70706fcabfe7dbb2 Mon Sep 17 00:00:00 2001 From: Darko Cucin Date: Thu, 31 Oct 2024 14:35:31 +0100 Subject: [PATCH 5/5] Adding naming check for JSON file --- modules/nf-core/sequali/tests/main.nf.test | 44 ++++++++++------- .../nf-core/sequali/tests/main.nf.test.snap | 48 ++++++++++++------- 2 files changed, 58 insertions(+), 34 deletions(-) diff --git a/modules/nf-core/sequali/tests/main.nf.test b/modules/nf-core/sequali/tests/main.nf.test index a2341c42cab..9876153caf6 100644 --- a/modules/nf-core/sequali/tests/main.nf.test +++ b/modules/nf-core/sequali/tests/main.nf.test @@ -20,13 +20,12 @@ nextflow_process { } } then { - def json_file = path(process.out.json[0][1]).json.get('summary') assertAll( - { assert process.success }, - { assert process.out.html[0][1] ==~ ".*/test.html"}, - { assert snapshot( - process.out.versions, - json_file, + { assert snapshot( + path(process.out.html[0][1]).getFileName().toString(), + path(process.out.json[0][1]).getFileName().toString(), + path(process.out.json[0][1]).json.remove('summary'), + process.out.versions ).match() } ) } @@ -47,13 +46,13 @@ nextflow_process { } then { - def json_file = path(process.out.json[0][1]).json.get('summary') assertAll( { assert process.success }, - { assert process.out.html[0][1] ==~ ".*/test.html"}, { assert snapshot( - process.out.versions, - json_file, + path(process.out.html[0][1]).getFileName().toString(), + path(process.out.json[0][1]).getFileName().toString(), + path(process.out.json[0][1]).json.remove('summary'), + process.out.versions ).match() } ) } @@ -76,10 +75,11 @@ nextflow_process { def json_file = path(process.out.json[0][1]).json.get('summary') assertAll( { assert process.success }, - { assert process.out.html[0][1] ==~ ".*/test.html"}, { assert snapshot( - process.out.versions, - json_file, + path(process.out.html[0][1]).getFileName().toString(), + path(process.out.json[0][1]).getFileName().toString(), + path(process.out.json[0][1]).json.remove('summary'), + process.out.versions ).match() } ) } @@ -103,7 +103,11 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot( + path(process.out.html[0][1]).getFileName().toString(), + path(process.out.json[0][1]).getFileName().toString(), + process.out + ).match() } ) } @@ -127,7 +131,11 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot( + path(process.out.html[0][1]).getFileName().toString(), + path(process.out.json[0][1]).getFileName().toString(), + process.out + ).match() } ) } @@ -150,7 +158,11 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot( + path(process.out.html[0][1]).getFileName().toString(), + path(process.out.json[0][1]).getFileName().toString(), + process.out + ).match() } ) } diff --git a/modules/nf-core/sequali/tests/main.nf.test.snap b/modules/nf-core/sequali/tests/main.nf.test.snap index 8a2315e6014..441c352bea4 100644 --- a/modules/nf-core/sequali/tests/main.nf.test.snap +++ b/modules/nf-core/sequali/tests/main.nf.test.snap @@ -1,6 +1,8 @@ { "sarscov2 - unaligned bam - stub[sequali]": { "content": [ + "test.html", + "test.json", { "0": [ [ @@ -50,13 +52,12 @@ "nf-test": "0.9.1", "nextflow": "24.10.0" }, - "timestamp": "2024-10-31T08:01:31.355353" + "timestamp": "2024-10-31T14:30:30.653577" }, "sarscov2 - fastq paired-end [sequali]": { "content": [ - [ - "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" - ], + "test.html", + "test.json", { "mean_length": 138.97, "minimum_length": 72, @@ -68,16 +69,21 @@ "total_gc_bases": 5430, "total_n_bases": 0, "read_pair_info": "Read 1" - } + }, + [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ] ], "meta": { "nf-test": "0.9.1", "nextflow": "24.10.0" }, - "timestamp": "2024-10-31T08:00:35.477844" + "timestamp": "2024-10-31T14:29:34.748364" }, "sarscov2 - fastq single-end - stub[sequali]": { "content": [ + "test.html", + "test.json", { "0": [ [ @@ -127,13 +133,12 @@ "nf-test": "0.9.1", "nextflow": "24.10.0" }, - "timestamp": "2024-10-31T08:01:06.366473" + "timestamp": "2024-10-31T14:30:06.387152" }, "sarscov2 - fastq single-end [sequali]": { "content": [ - [ - "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" - ], + "test.html", + "test.json", { "mean_length": 138.97, "minimum_length": 72, @@ -145,19 +150,21 @@ "total_gc_bases": 5430, "total_n_bases": 0, "read_pair_info": null - } + }, + [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ] ], "meta": { "nf-test": "0.9.1", "nextflow": "24.10.0" }, - "timestamp": "2024-10-31T07:59:41.195578" + "timestamp": "2024-10-31T14:28:42.093895" }, "sarscov2 - unaligned bam [sequali]": { "content": [ - [ - "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" - ], + "test.html", + "test.json", { "mean_length": 138.97, "minimum_length": 72, @@ -169,16 +176,21 @@ "total_gc_bases": 5430, "total_n_bases": 0, "read_pair_info": null - } + }, + [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ] ], "meta": { "nf-test": "0.9.1", "nextflow": "24.10.0" }, - "timestamp": "2024-10-31T08:00:54.4785" + "timestamp": "2024-10-31T14:29:54.657233" }, "sarscov2 - fastq paired-end - stub[sequali]": { "content": [ + "test.html", + "test.json", { "0": [ [ @@ -228,6 +240,6 @@ "nf-test": "0.9.1", "nextflow": "24.10.0" }, - "timestamp": "2024-10-31T08:01:19.342814" + "timestamp": "2024-10-31T14:30:18.654267" } } \ No newline at end of file