From 7a3bd6b95eb8c3ff9e32c2a586e6d163a0150200 Mon Sep 17 00:00:00 2001 From: Sateesh Date: Thu, 16 Jan 2025 12:16:10 +0000 Subject: [PATCH] snapshot db list file names only --- modules/nf-core/krakenuniq/build/main.nf | 15 ++- .../krakenuniq/build/tests/main.nf.test | 14 +-- .../krakenuniq/build/tests/main.nf.test.snap | 112 ++++++------------ 3 files changed, 54 insertions(+), 87 deletions(-) diff --git a/modules/nf-core/krakenuniq/build/main.nf b/modules/nf-core/krakenuniq/build/main.nf index 8d96cbbd456..84b3796ca63 100644 --- a/modules/nf-core/krakenuniq/build/main.nf +++ b/modules/nf-core/krakenuniq/build/main.nf @@ -12,14 +12,14 @@ process KRAKENUNIQ_BUILD { output: tuple val(meta), path("${prefix}/"), emit: db - path "versions.yml", emit: versions + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' - prefix = task.ext.prefix ?: "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" custom_db = custom_library_dir ? "mkdir ${prefix} && mv library taxonomy ${custom_seqid2taxid} ${prefix}" : "" """ ${custom_db} @@ -36,11 +36,16 @@ process KRAKENUNIQ_BUILD { """ stub: - def args = task.ext.args ?: '' prefix = task.ext.prefix ?: "${meta.id}" - custom_db = custom_library_dir ? "mkdir ${prefix} && mv library taxonomy ${custom_seqid2taxid} ${prefix}" : "" """ mkdir ${prefix}/ + touch ${prefix}/database-build.log + touch ${prefix}/database.idx + touch ${prefix}/database.jdb + touch ${prefix}/database.kdb + touch ${prefix}/database.kdb.counts + touch ${prefix}/database.kraken.tsv + touch ${prefix}/database.report.tsv cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/krakenuniq/build/tests/main.nf.test b/modules/nf-core/krakenuniq/build/tests/main.nf.test index 83900d0855a..e4e3966c8a0 100644 --- a/modules/nf-core/krakenuniq/build/tests/main.nf.test +++ b/modules/nf-core/krakenuniq/build/tests/main.nf.test @@ -1,5 +1,3 @@ -// TODO nf-core: Once you have added the required tests, please run the following command to build this file: -// nf-core modules test krakenuniq/build nextflow_process { name "Test Process KRAKENUNIQ_BUILD" @@ -29,7 +27,7 @@ nextflow_process { when { process { """ - ch_fastas = Channel.fromPath(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ch_fastas = Channel.fromPath(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ch_seqid2mapid = Channel.fromPath(params.modules_testdata_base_path + 'genomics/sarscov2/metagenome/seqid2taxid.map', checkIfExists: true) ch_input = ch_fastas @@ -47,10 +45,13 @@ nextflow_process { } then { + // function to list the output folder and exclude_files from list assertAll( { assert process.success }, - { assert snapshot( - process.out + { + assert snapshot( + path(process.out.db[0][1]).list().sort().collect { it.getFileName().toString() }, + process.out.versions ).match() } ) @@ -59,7 +60,6 @@ nextflow_process { } test("sarscov2 - fasta - stub") { - options "-stub" when { @@ -76,7 +76,5 @@ nextflow_process { { assert snapshot(process.out).match() } ) } - } - } diff --git a/modules/nf-core/krakenuniq/build/tests/main.nf.test.snap b/modules/nf-core/krakenuniq/build/tests/main.nf.test.snap index 49751c835c5..f0ed97a0cf3 100644 --- a/modules/nf-core/krakenuniq/build/tests/main.nf.test.snap +++ b/modules/nf-core/krakenuniq/build/tests/main.nf.test.snap @@ -8,7 +8,13 @@ "id": "test" }, [ - + "database-build.log:md5,d41d8cd98f00b204e9800998ecf8427e", + "database.idx:md5,d41d8cd98f00b204e9800998ecf8427e", + "database.jdb:md5,d41d8cd98f00b204e9800998ecf8427e", + "database.kdb:md5,d41d8cd98f00b204e9800998ecf8427e", + "database.kdb.counts:md5,d41d8cd98f00b204e9800998ecf8427e", + "database.kraken.tsv:md5,d41d8cd98f00b204e9800998ecf8427e", + "database.report.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" ] ] ], @@ -21,7 +27,13 @@ "id": "test" }, [ - + "database-build.log:md5,d41d8cd98f00b204e9800998ecf8427e", + "database.idx:md5,d41d8cd98f00b204e9800998ecf8427e", + "database.jdb:md5,d41d8cd98f00b204e9800998ecf8427e", + "database.kdb:md5,d41d8cd98f00b204e9800998ecf8427e", + "database.kdb.counts:md5,d41d8cd98f00b204e9800998ecf8427e", + "database.kraken.tsv:md5,d41d8cd98f00b204e9800998ecf8427e", + "database.report.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" ] ] ], @@ -31,84 +43,36 @@ } ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.10.2" + "nf-test": "0.9.2", + "nextflow": "24.10.3" }, - "timestamp": "2025-01-16T10:09:14.395632478" + "timestamp": "2025-01-16T10:52:18.228646949" }, "sarscov2 - fasta": { "content": [ - { - "0": [ - [ - { - "id": "test" - }, - [ - "database-build.log:md5,d733cb41ac5d8f7dceb154f9cc8dd9dc", - "database.idx:md5,f5298aa4215c956d2f737b5988721a24", - "database.jdb:md5,48db5f6bb9b9e9db7f5bbdd0d8bec4a8", - "database.kdb:md5,46542be19979e867075f9e455a314e00", - "database.kdb.counts:md5,a82149480a435210ec1e870f06b6cdb3", - "database.kraken.tsv:md5,be9bd0cb3a8bea30989e65aa42a73727", - "database.report.tsv:md5,736b9f6b342ea9c60d960e2c8a801ecf", - "database0.kdb:md5,46542be19979e867075f9e455a314e00", - [ - "genome.fasta:md5,6e9fe4042a72f2345f644f239272b7e6" - ], - "library-files.txt:md5,8a9817d2de8465eb436aa3aa8696a717", - "seqid2taxid.map:md5,fe738f2333d57dde0db32239c04a93b8", - "taxDB:md5,cf89493ad0b9ba0de943f869938da651", - [ - "names.dmp:md5,67d5a66acb8b277c20a3fbcc596fbd85", - "nodes.dmp:md5,0775ea1a670486e0212456a96dbe6aeb", - "taxdump.tar.gz:md5,84073af43762c67cedc853c7cb6bd8f0", - "timestamp:md5,f654a959110dc9ec414ea8d55585a02b" - ] - ] - ] - ], - "1": [ - "versions.yml:md5,b7fb6c70957b2e6b6b810757928d0325" - ], - "db": [ - [ - { - "id": "test" - }, - [ - "database-build.log:md5,d733cb41ac5d8f7dceb154f9cc8dd9dc", - "database.idx:md5,f5298aa4215c956d2f737b5988721a24", - "database.jdb:md5,48db5f6bb9b9e9db7f5bbdd0d8bec4a8", - "database.kdb:md5,46542be19979e867075f9e455a314e00", - "database.kdb.counts:md5,a82149480a435210ec1e870f06b6cdb3", - "database.kraken.tsv:md5,be9bd0cb3a8bea30989e65aa42a73727", - "database.report.tsv:md5,736b9f6b342ea9c60d960e2c8a801ecf", - "database0.kdb:md5,46542be19979e867075f9e455a314e00", - [ - "genome.fasta:md5,6e9fe4042a72f2345f644f239272b7e6" - ], - "library-files.txt:md5,8a9817d2de8465eb436aa3aa8696a717", - "seqid2taxid.map:md5,fe738f2333d57dde0db32239c04a93b8", - "taxDB:md5,cf89493ad0b9ba0de943f869938da651", - [ - "names.dmp:md5,67d5a66acb8b277c20a3fbcc596fbd85", - "nodes.dmp:md5,0775ea1a670486e0212456a96dbe6aeb", - "taxdump.tar.gz:md5,84073af43762c67cedc853c7cb6bd8f0", - "timestamp:md5,f654a959110dc9ec414ea8d55585a02b" - ] - ] - ] - ], - "versions": [ - "versions.yml:md5,b7fb6c70957b2e6b6b810757928d0325" - ] - } + [ + "database-build.log", + "database.idx", + "database.jdb", + "database.kdb", + "database.kdb.counts", + "database.kraken.tsv", + "database.report.tsv", + "database0.kdb", + "library", + "library-files.txt", + "seqid2taxid.map", + "taxDB", + "taxonomy" + ], + [ + "versions.yml:md5,b7fb6c70957b2e6b6b810757928d0325" + ] ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.10.2" + "nf-test": "0.9.2", + "nextflow": "24.10.3" }, - "timestamp": "2025-01-16T10:48:21.448584195" + "timestamp": "2025-01-16T12:09:36.537944286" } } \ No newline at end of file