From f36c3dc44793d6c70c281ac64de31f032552d3c8 Mon Sep 17 00:00:00 2001 From: Sateesh Date: Thu, 28 Dec 2023 02:43:31 +0000 Subject: [PATCH 1/6] sourmash/compare stub, nf-test, snapshot --- modules/nf-core/sourmash/compare/main.nf | 21 ++++- modules/nf-core/sourmash/compare/meta.yml | 4 +- .../sourmash/compare/tests/main.nf.test | 85 +++++++++++++++++++ .../sourmash/compare/tests/main.nf.test.snap | 64 ++++++++++++++ .../sourmash/compare/tests/nextflow.config | 5 ++ .../nf-core/sourmash/compare/tests/tags.yml | 2 + tests/config/pytest_modules.yml | 3 - .../modules/nf-core/sourmash/compare/main.nf | 35 -------- .../nf-core/sourmash/compare/nextflow.config | 8 -- .../modules/nf-core/sourmash/compare/test.yml | 15 ---- 10 files changed, 175 insertions(+), 67 deletions(-) create mode 100644 modules/nf-core/sourmash/compare/tests/main.nf.test create mode 100644 modules/nf-core/sourmash/compare/tests/main.nf.test.snap create mode 100644 modules/nf-core/sourmash/compare/tests/nextflow.config create mode 100644 modules/nf-core/sourmash/compare/tests/tags.yml delete mode 100644 tests/modules/nf-core/sourmash/compare/main.nf delete mode 100644 tests/modules/nf-core/sourmash/compare/nextflow.config delete mode 100644 tests/modules/nf-core/sourmash/compare/test.yml diff --git a/modules/nf-core/sourmash/compare/main.nf b/modules/nf-core/sourmash/compare/main.nf index c3f2ddfe2e8..ba6b7d8b3f4 100644 --- a/modules/nf-core/sourmash/compare/main.nf +++ b/modules/nf-core/sourmash/compare/main.nf @@ -14,16 +14,17 @@ process SOURMASH_COMPARE { val save_csv output: - tuple val(meta), path("*comp.npy.labels.txt"), path("*comp.npy"), optional:true, emit: matrix - path "*comp.csv" , optional:true, emit: csv - path "versions.yml" , emit: versions + tuple val(meta), path("*comp.npy") , optional:true, emit: matrix + tuple val(meta), path("*comp.npy.labels.txt"), optional:true, emit: labels + path "*comp.csv" , optional:true, emit: csv + 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 prefix = task.ext.prefix ?: "${meta.id}" def comp = save_numpy_matrix ? "--output comp.npy" : '' def csv = save_csv ? "--csv comp.csv" : '' if ( !save_numpy_matrix && !save_csv ) error "Supply either save_numpy_matrix, save_csv, or both or no output will be created" @@ -44,4 +45,16 @@ process SOURMASH_COMPARE { sourmash: \$(echo \$(sourmash --version 2>&1) | sed 's/^sourmash //' ) END_VERSIONS """ + + stub: + """ + touch comp.npy.labels.txt + touch comp.npy + touch comp.csv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + sourmash: \$(echo \$(sourmash --version 2>&1) | sed 's/^sourmash //' ) + END_VERSIONS + """ } diff --git a/modules/nf-core/sourmash/compare/meta.yml b/modules/nf-core/sourmash/compare/meta.yml index e69dfde8f6e..e9a3eabc29c 100644 --- a/modules/nf-core/sourmash/compare/meta.yml +++ b/modules/nf-core/sourmash/compare/meta.yml @@ -15,7 +15,7 @@ tools: documentation: "https://sourmash.readthedocs.io/" tool_dev_url: "https://github.com/sourmash-bio/sourmash" doi: "10.21105/joss.00027" - licence: "['BSD-3-clause']" + licence: ["BSD-3-clause"] input: - meta: type: map @@ -50,7 +50,7 @@ output: type: file description: File containing software versions pattern: "versions.yml" - - numpy_matrix: + - matrix: type: file description: An optional (dis)similarity matrix numpy binary format pattern: "*.comp" diff --git a/modules/nf-core/sourmash/compare/tests/main.nf.test b/modules/nf-core/sourmash/compare/tests/main.nf.test new file mode 100644 index 00000000000..059466f516e --- /dev/null +++ b/modules/nf-core/sourmash/compare/tests/main.nf.test @@ -0,0 +1,85 @@ +nextflow_process { + + name "Test Process SOURMASH_COMPARE" + script "../main.nf" + process "SOURMASH_COMPARE" + config "./nextflow.config" + + tag "modules" + tag "modules_nfcore" + tag "sourmash" + tag "sourmash/compare" + tag "sourmash/sketch" + + setup { + run("SOURMASH_SKETCH") { + script "../../sketch/main.nf" + process { + """ + input[0] = Channel.fromList([ + [ [ id:'test1', single_end:false ], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ], + [ [ id: 'test2', single_end:false ], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ] + ]) + """ + } + } + } + + test("sarscov2 genome [fasta]") { + + when { + process { + """ + input[0] = SOURMASH_SKETCH.out.signatures.collect { it[1] }.map { signatures -> + def meta = [:] + meta.id = "group1" + [ meta, signatures ] + } + input[1] = [] + input[2] = true // save_numpy_matrix + input[3] = true // save_csv + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("sarscov2 - bam - stub") { + + options "-stub" + + when { + process { + """ + input[0] = SOURMASH_SKETCH.out.signatures.collect { it[1] }.map { signatures -> + def meta = [:] + meta.id = "group1" + [ meta, signatures ] + } + input[1] = [] + input[2] = true // save_numpy_matrix + input[3] = true // save_csv + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.matrix.collect { file(it[1]).getName() } + + process.out.labels.collect { file(it[1]).getName() } + + process.out.csv.collect { file(it).getName() } + + process.out.versions ).match() } + ) + } + + } + +} diff --git a/modules/nf-core/sourmash/compare/tests/main.nf.test.snap b/modules/nf-core/sourmash/compare/tests/main.nf.test.snap new file mode 100644 index 00000000000..e8c44b51ee8 --- /dev/null +++ b/modules/nf-core/sourmash/compare/tests/main.nf.test.snap @@ -0,0 +1,64 @@ +{ + "sarscov2 - bam - stub": { + "content": [ + [ + "comp.npy", + "comp.npy.labels.txt", + "comp.csv", + "versions.yml:md5,6c61aed52902d1e343640d606122f411" + ] + ], + "timestamp": "2023-12-28T02:41:21.87755465" + }, + "sarscov2 genome [fasta]": { + "content": [ + { + "0": [ + [ + { + "id": "group1" + }, + "comp.npy:md5,8a8683e1201544f28e2c2e21d2b89e4f" + ] + ], + "1": [ + [ + { + "id": "group1" + }, + "comp.npy.labels.txt:md5,5bdd30886cf6f00a7286ac6e7322a46e" + ] + ], + "2": [ + "comp.csv:md5,79bb8895742bfa32d4a39d2fbc2be941" + ], + "3": [ + "versions.yml:md5,6c61aed52902d1e343640d606122f411" + ], + "csv": [ + "comp.csv:md5,79bb8895742bfa32d4a39d2fbc2be941" + ], + "labels": [ + [ + { + "id": "group1" + }, + "comp.npy.labels.txt:md5,5bdd30886cf6f00a7286ac6e7322a46e" + ] + ], + "matrix": [ + [ + { + "id": "group1" + }, + "comp.npy:md5,8a8683e1201544f28e2c2e21d2b89e4f" + ] + ], + "versions": [ + "versions.yml:md5,6c61aed52902d1e343640d606122f411" + ] + } + ], + "timestamp": "2023-12-28T02:41:06.706848406" + } +} \ No newline at end of file diff --git a/modules/nf-core/sourmash/compare/tests/nextflow.config b/modules/nf-core/sourmash/compare/tests/nextflow.config new file mode 100644 index 00000000000..c325a16b040 --- /dev/null +++ b/modules/nf-core/sourmash/compare/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName:SOURMASH_COMPARE { + ext.args = "--ksize 31" + } +} diff --git a/modules/nf-core/sourmash/compare/tests/tags.yml b/modules/nf-core/sourmash/compare/tests/tags.yml new file mode 100644 index 00000000000..99450e1e708 --- /dev/null +++ b/modules/nf-core/sourmash/compare/tests/tags.yml @@ -0,0 +1,2 @@ +sourmash/compare: + - "modules/nf-core/sourmash/compare/**" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 6aae9729bf9..5cd21a10a66 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -2356,9 +2356,6 @@ somalier/extract: somalier/relate: - modules/nf-core/somalier/relate/** - tests/modules/nf-core/somalier/relate/** -sourmash/compare: - - modules/nf-core/sourmash/compare/** - - tests/modules/nf-core/sourmash/compare/** sourmash/gather: - modules/nf-core/sourmash/gather/** - tests/modules/nf-core/sourmash/gather/** diff --git a/tests/modules/nf-core/sourmash/compare/main.nf b/tests/modules/nf-core/sourmash/compare/main.nf deleted file mode 100644 index c2ab085f3c7..00000000000 --- a/tests/modules/nf-core/sourmash/compare/main.nf +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { SOURMASH_SKETCH } from '../../../../../modules/nf-core/sourmash/sketch/main.nf' -include { SOURMASH_COMPARE } from '../../../../../modules/nf-core/sourmash/compare/main.nf' - -workflow test_sourmash_compare { - - input = Channel.fromList([ - [ [ id:'test1', single_end:false ], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ], - [ [ id: 'test2', single_end:false ], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ] - ]) - - ch_sketch_for_compare = SOURMASH_SKETCH ( input ).signatures - .collect { it[1] } - .map { - signatures -> - def meta = [:] - meta.id = "group1" - [ meta, signatures ] - } - - save_numpy_matrix = true - save_csv = true - - SOURMASH_COMPARE ( - ch_sketch_for_compare, - [], - save_numpy_matrix, - save_csv - ) - - SOURMASH_COMPARE.out.matrix -} diff --git a/tests/modules/nf-core/sourmash/compare/nextflow.config b/tests/modules/nf-core/sourmash/compare/nextflow.config deleted file mode 100644 index d205e0f210b..00000000000 --- a/tests/modules/nf-core/sourmash/compare/nextflow.config +++ /dev/null @@ -1,8 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName:SOURMASH_COMPARE { - ext.args = "--ksize 31" - } -} diff --git a/tests/modules/nf-core/sourmash/compare/test.yml b/tests/modules/nf-core/sourmash/compare/test.yml deleted file mode 100644 index 752688c6690..00000000000 --- a/tests/modules/nf-core/sourmash/compare/test.yml +++ /dev/null @@ -1,15 +0,0 @@ -- name: sourmash compare test_sourmash_compare - command: nextflow run ./tests/modules/nf-core/sourmash/compare -entry test_sourmash_compare -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/sourmash/compare/nextflow.config - tags: - - sourmash - - sourmash/compare - files: - - path: output/sourmash/comp.npy - md5sum: 8a8683e1201544f28e2c2e21d2b89e4f - - path: output/sourmash/comp.csv - contains: - - "1.0,1.0" - - path: output/sourmash/comp.npy.labels.txt - contains: - - "test1" - - "test2" From f08e12888416e1ea483fb799ee54228739eefe3b Mon Sep 17 00:00:00 2001 From: Simon Pearce <24893913+SPPearce@users.noreply.github.com> Date: Fri, 14 Jun 2024 12:16:25 +0000 Subject: [PATCH 2/6] Add sort --- .../sourmash/compare/tests/main.nf.test | 17 +---- .../sourmash/compare/tests/main.nf.test.snap | 64 ++++++++++++++++--- 2 files changed, 59 insertions(+), 22 deletions(-) diff --git a/modules/nf-core/sourmash/compare/tests/main.nf.test b/modules/nf-core/sourmash/compare/tests/main.nf.test index 059466f516e..c4be94aba5b 100644 --- a/modules/nf-core/sourmash/compare/tests/main.nf.test +++ b/modules/nf-core/sourmash/compare/tests/main.nf.test @@ -30,11 +30,7 @@ nextflow_process { when { process { """ - input[0] = SOURMASH_SKETCH.out.signatures.collect { it[1] }.map { signatures -> - def meta = [:] - meta.id = "group1" - [ meta, signatures ] - } + input[0] = SOURMASH_SKETCH.out.signatures.view().collect({ it[1] }, sort: true ).map { it -> [ [id:"group1"], it ] } input[1] = [] input[2] = true // save_numpy_matrix input[3] = true // save_csv @@ -58,11 +54,7 @@ nextflow_process { when { process { """ - input[0] = SOURMASH_SKETCH.out.signatures.collect { it[1] }.map { signatures -> - def meta = [:] - meta.id = "group1" - [ meta, signatures ] - } + input[0] = SOURMASH_SKETCH.out.signatures.collect { it[1] }.map { it -> [ [id:"group1"], it.sort() ] } input[1] = [] input[2] = true // save_numpy_matrix input[3] = true // save_csv @@ -73,10 +65,7 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out.matrix.collect { file(it[1]).getName() } + - process.out.labels.collect { file(it[1]).getName() } + - process.out.csv.collect { file(it).getName() } + - process.out.versions ).match() } + { assert snapshot(process.out).match() } ) } diff --git a/modules/nf-core/sourmash/compare/tests/main.nf.test.snap b/modules/nf-core/sourmash/compare/tests/main.nf.test.snap index e8c44b51ee8..18820243b8f 100644 --- a/modules/nf-core/sourmash/compare/tests/main.nf.test.snap +++ b/modules/nf-core/sourmash/compare/tests/main.nf.test.snap @@ -1,14 +1,58 @@ { "sarscov2 - bam - stub": { "content": [ - [ - "comp.npy", - "comp.npy.labels.txt", - "comp.csv", - "versions.yml:md5,6c61aed52902d1e343640d606122f411" - ] + { + "0": [ + [ + { + "id": "group1" + }, + "comp.npy:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "group1" + }, + "comp.npy.labels.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "comp.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "3": [ + "versions.yml:md5,6c61aed52902d1e343640d606122f411" + ], + "csv": [ + "comp.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "labels": [ + [ + { + "id": "group1" + }, + "comp.npy.labels.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "matrix": [ + [ + { + "id": "group1" + }, + "comp.npy:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,6c61aed52902d1e343640d606122f411" + ] + } ], - "timestamp": "2023-12-28T02:41:21.87755465" + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-14T11:15:29.003420843" }, "sarscov2 genome [fasta]": { "content": [ @@ -59,6 +103,10 @@ ] } ], - "timestamp": "2023-12-28T02:41:06.706848406" + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-14T12:11:52.962800752" } } \ No newline at end of file From 38a4607d6f99cdd9aa421c27b38b9e85f97796ba Mon Sep 17 00:00:00 2001 From: Simon Pearce <24893913+SPPearce@users.noreply.github.com> Date: Wed, 26 Jun 2024 11:11:19 +0000 Subject: [PATCH 3/6] Add a sort --- modules/nf-core/sourmash/compare/main.nf | 2 +- modules/nf-core/sourmash/compare/tests/main.nf.test | 2 +- .../nf-core/sourmash/compare/tests/main.nf.test.snap | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/nf-core/sourmash/compare/main.nf b/modules/nf-core/sourmash/compare/main.nf index ba6b7d8b3f4..2aae8e7f7ec 100644 --- a/modules/nf-core/sourmash/compare/main.nf +++ b/modules/nf-core/sourmash/compare/main.nf @@ -29,7 +29,7 @@ process SOURMASH_COMPARE { def csv = save_csv ? "--csv comp.csv" : '' if ( !save_numpy_matrix && !save_csv ) error "Supply either save_numpy_matrix, save_csv, or both or no output will be created" def ffile = file_list ? "--from-file ${file_list}" : '' - def sigs = signatures ? "${signatures.join(' ')}" : '' + def sigs = signatures ? "${signatures.sort().join(' ')}" : '' if ( !file_list && !signatures ) error "Supply either signatures, file_list, or both" """ sourmash compare \\ diff --git a/modules/nf-core/sourmash/compare/tests/main.nf.test b/modules/nf-core/sourmash/compare/tests/main.nf.test index c4be94aba5b..cee591bcc95 100644 --- a/modules/nf-core/sourmash/compare/tests/main.nf.test +++ b/modules/nf-core/sourmash/compare/tests/main.nf.test @@ -30,7 +30,7 @@ nextflow_process { when { process { """ - input[0] = SOURMASH_SKETCH.out.signatures.view().collect({ it[1] }, sort: true ).map { it -> [ [id:"group1"], it ] } + input[0] = SOURMASH_SKETCH.out.signatures.collect({ it[1] }, sort: true ).map { it -> [ [id:"group1"], it ] } input[1] = [] input[2] = true // save_numpy_matrix input[3] = true // save_csv diff --git a/modules/nf-core/sourmash/compare/tests/main.nf.test.snap b/modules/nf-core/sourmash/compare/tests/main.nf.test.snap index 18820243b8f..184bbc6a7f3 100644 --- a/modules/nf-core/sourmash/compare/tests/main.nf.test.snap +++ b/modules/nf-core/sourmash/compare/tests/main.nf.test.snap @@ -70,24 +70,24 @@ { "id": "group1" }, - "comp.npy.labels.txt:md5,5bdd30886cf6f00a7286ac6e7322a46e" + "comp.npy.labels.txt:md5,e98872a95beb59490cbab3286e6c3c9f" ] ], "2": [ - "comp.csv:md5,79bb8895742bfa32d4a39d2fbc2be941" + "comp.csv:md5,904fc7a4ea1a87fdfe6e2b9f60a4430a" ], "3": [ "versions.yml:md5,6c61aed52902d1e343640d606122f411" ], "csv": [ - "comp.csv:md5,79bb8895742bfa32d4a39d2fbc2be941" + "comp.csv:md5,904fc7a4ea1a87fdfe6e2b9f60a4430a" ], "labels": [ [ { "id": "group1" }, - "comp.npy.labels.txt:md5,5bdd30886cf6f00a7286ac6e7322a46e" + "comp.npy.labels.txt:md5,e98872a95beb59490cbab3286e6c3c9f" ] ], "matrix": [ @@ -107,6 +107,6 @@ "nf-test": "0.8.4", "nextflow": "24.04.2" }, - "timestamp": "2024-06-14T12:11:52.962800752" + "timestamp": "2024-06-26T11:07:18.809936262" } } \ No newline at end of file From a9d19e6e91951e15342e475e887e30b8af4c6001 Mon Sep 17 00:00:00 2001 From: Simon Pearce <24893913+SPPearce@users.noreply.github.com> Date: Wed, 26 Jun 2024 21:50:13 +0000 Subject: [PATCH 4/6] Update snap --- modules/nf-core/sourmash/compare/tests/main.nf.test.snap | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/nf-core/sourmash/compare/tests/main.nf.test.snap b/modules/nf-core/sourmash/compare/tests/main.nf.test.snap index 184bbc6a7f3..73f85992ac2 100644 --- a/modules/nf-core/sourmash/compare/tests/main.nf.test.snap +++ b/modules/nf-core/sourmash/compare/tests/main.nf.test.snap @@ -15,7 +15,7 @@ { "id": "group1" }, - "comp.npy.labels.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + "comp.npy.labels.txt:md5,5bdd30886cf6f00a7286ac6e7322a46e" ] ], "2": [ @@ -25,7 +25,7 @@ "versions.yml:md5,6c61aed52902d1e343640d606122f411" ], "csv": [ - "comp.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + "comp.csv:md5,79bb8895742bfa32d4a39d2fbc2be941" ], "labels": [ [ @@ -109,4 +109,4 @@ }, "timestamp": "2024-06-26T11:07:18.809936262" } -} \ No newline at end of file +} From 30bf80d1de67eefdb537e625e299022fd135d34a Mon Sep 17 00:00:00 2001 From: Simon Pearce <24893913+SPPearce@users.noreply.github.com> Date: Tue, 2 Jul 2024 13:41:43 +0000 Subject: [PATCH 5/6] Try sort inside the module --- modules/nf-core/sourmash/compare/main.nf | 2 +- .../sourmash/compare/tests/main.nf.test.snap | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/nf-core/sourmash/compare/main.nf b/modules/nf-core/sourmash/compare/main.nf index 2aae8e7f7ec..ad13677ffb7 100644 --- a/modules/nf-core/sourmash/compare/main.nf +++ b/modules/nf-core/sourmash/compare/main.nf @@ -29,7 +29,7 @@ process SOURMASH_COMPARE { def csv = save_csv ? "--csv comp.csv" : '' if ( !save_numpy_matrix && !save_csv ) error "Supply either save_numpy_matrix, save_csv, or both or no output will be created" def ffile = file_list ? "--from-file ${file_list}" : '' - def sigs = signatures ? "${signatures.sort().join(' ')}" : '' + def sigs = signatures ? "${signatures.sort{it.toString()}.join(' ')}" : '' if ( !file_list && !signatures ) error "Supply either signatures, file_list, or both" """ sourmash compare \\ diff --git a/modules/nf-core/sourmash/compare/tests/main.nf.test.snap b/modules/nf-core/sourmash/compare/tests/main.nf.test.snap index 73f85992ac2..1cb834804e0 100644 --- a/modules/nf-core/sourmash/compare/tests/main.nf.test.snap +++ b/modules/nf-core/sourmash/compare/tests/main.nf.test.snap @@ -15,7 +15,7 @@ { "id": "group1" }, - "comp.npy.labels.txt:md5,5bdd30886cf6f00a7286ac6e7322a46e" + "comp.npy.labels.txt:md5,d41d8cd98f00b204e9800998ecf8427e" ] ], "2": [ @@ -25,7 +25,7 @@ "versions.yml:md5,6c61aed52902d1e343640d606122f411" ], "csv": [ - "comp.csv:md5,79bb8895742bfa32d4a39d2fbc2be941" + "comp.csv:md5,d41d8cd98f00b204e9800998ecf8427e" ], "labels": [ [ @@ -52,7 +52,7 @@ "nf-test": "0.8.4", "nextflow": "24.04.2" }, - "timestamp": "2024-06-14T11:15:29.003420843" + "timestamp": "2024-07-02T13:35:50.943329071" }, "sarscov2 genome [fasta]": { "content": [ @@ -70,24 +70,24 @@ { "id": "group1" }, - "comp.npy.labels.txt:md5,e98872a95beb59490cbab3286e6c3c9f" + "comp.npy.labels.txt:md5,5bdd30886cf6f00a7286ac6e7322a46e" ] ], "2": [ - "comp.csv:md5,904fc7a4ea1a87fdfe6e2b9f60a4430a" + "comp.csv:md5,79bb8895742bfa32d4a39d2fbc2be941" ], "3": [ "versions.yml:md5,6c61aed52902d1e343640d606122f411" ], "csv": [ - "comp.csv:md5,904fc7a4ea1a87fdfe6e2b9f60a4430a" + "comp.csv:md5,79bb8895742bfa32d4a39d2fbc2be941" ], "labels": [ [ { "id": "group1" }, - "comp.npy.labels.txt:md5,e98872a95beb59490cbab3286e6c3c9f" + "comp.npy.labels.txt:md5,5bdd30886cf6f00a7286ac6e7322a46e" ] ], "matrix": [ @@ -107,6 +107,6 @@ "nf-test": "0.8.4", "nextflow": "24.04.2" }, - "timestamp": "2024-06-26T11:07:18.809936262" + "timestamp": "2024-07-02T13:35:32.613894339" } -} +} \ No newline at end of file From a79cfdd9d1b0eedd08153d1cb5d78fd70eb95d63 Mon Sep 17 00:00:00 2001 From: Simon Pearce <24893913+SPPearce@users.noreply.github.com> Date: Tue, 2 Jul 2024 14:48:22 +0000 Subject: [PATCH 6/6] Add meta to output and change formatting on test --- modules/nf-core/sourmash/compare/main.nf | 8 ++--- .../sourmash/compare/tests/main.nf.test | 17 +++++++--- .../sourmash/compare/tests/main.nf.test.snap | 32 +++++++++++++++---- 3 files changed, 42 insertions(+), 15 deletions(-) diff --git a/modules/nf-core/sourmash/compare/main.nf b/modules/nf-core/sourmash/compare/main.nf index ad13677ffb7..510d71e09f7 100644 --- a/modules/nf-core/sourmash/compare/main.nf +++ b/modules/nf-core/sourmash/compare/main.nf @@ -14,10 +14,10 @@ process SOURMASH_COMPARE { val save_csv output: - tuple val(meta), path("*comp.npy") , optional:true, emit: matrix - tuple val(meta), path("*comp.npy.labels.txt"), optional:true, emit: labels - path "*comp.csv" , optional:true, emit: csv - path "versions.yml" , emit: versions + tuple val(meta), path("*comp.npy") , emit: matrix, optional:true + tuple val(meta), path("*comp.npy.labels.txt") , emit: labels, optional:true + tuple val(meta), path("*comp.csv") , emit: csv , optional:true + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when diff --git a/modules/nf-core/sourmash/compare/tests/main.nf.test b/modules/nf-core/sourmash/compare/tests/main.nf.test index cee591bcc95..43963e58faf 100644 --- a/modules/nf-core/sourmash/compare/tests/main.nf.test +++ b/modules/nf-core/sourmash/compare/tests/main.nf.test @@ -17,9 +17,16 @@ nextflow_process { process { """ input[0] = Channel.fromList([ - [ [ id:'test1', single_end:false ], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ], - [ [ id: 'test2', single_end:false ], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ] - ]) + [ + [ id: 'test1' ], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ], + [ + [ id: 'test2' ], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + ] + ) """ } } @@ -30,7 +37,7 @@ nextflow_process { when { process { """ - input[0] = SOURMASH_SKETCH.out.signatures.collect({ it[1] }, sort: true ).map { it -> [ [id:"group1"], it ] } + input[0] = SOURMASH_SKETCH.out.signatures.collect{ it[1] }.map { it -> [ [id: "group1" ], it ] } input[1] = [] input[2] = true // save_numpy_matrix input[3] = true // save_csv @@ -54,7 +61,7 @@ nextflow_process { when { process { """ - input[0] = SOURMASH_SKETCH.out.signatures.collect { it[1] }.map { it -> [ [id:"group1"], it.sort() ] } + input[0] = SOURMASH_SKETCH.out.signatures.collect{ it[1] }.map { it -> [ [id: "group1" ], it ] } input[1] = [] input[2] = true // save_numpy_matrix input[3] = true // save_csv diff --git a/modules/nf-core/sourmash/compare/tests/main.nf.test.snap b/modules/nf-core/sourmash/compare/tests/main.nf.test.snap index 1cb834804e0..4c55d0bcd0f 100644 --- a/modules/nf-core/sourmash/compare/tests/main.nf.test.snap +++ b/modules/nf-core/sourmash/compare/tests/main.nf.test.snap @@ -19,13 +19,23 @@ ] ], "2": [ - "comp.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + [ + { + "id": "group1" + }, + "comp.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] ], "3": [ "versions.yml:md5,6c61aed52902d1e343640d606122f411" ], "csv": [ - "comp.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + [ + { + "id": "group1" + }, + "comp.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] ], "labels": [ [ @@ -52,7 +62,7 @@ "nf-test": "0.8.4", "nextflow": "24.04.2" }, - "timestamp": "2024-07-02T13:35:50.943329071" + "timestamp": "2024-07-02T14:45:34.007399207" }, "sarscov2 genome [fasta]": { "content": [ @@ -74,13 +84,23 @@ ] ], "2": [ - "comp.csv:md5,79bb8895742bfa32d4a39d2fbc2be941" + [ + { + "id": "group1" + }, + "comp.csv:md5,79bb8895742bfa32d4a39d2fbc2be941" + ] ], "3": [ "versions.yml:md5,6c61aed52902d1e343640d606122f411" ], "csv": [ - "comp.csv:md5,79bb8895742bfa32d4a39d2fbc2be941" + [ + { + "id": "group1" + }, + "comp.csv:md5,79bb8895742bfa32d4a39d2fbc2be941" + ] ], "labels": [ [ @@ -107,6 +127,6 @@ "nf-test": "0.8.4", "nextflow": "24.04.2" }, - "timestamp": "2024-07-02T13:35:32.613894339" + "timestamp": "2024-07-02T14:45:19.227025783" } } \ No newline at end of file