Skip to content

Commit

Permalink
snapshot db list file names only
Browse files Browse the repository at this point in the history
  • Loading branch information
sateeshperi committed Jan 16, 2025
1 parent 7681935 commit 7a3bd6b
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 87 deletions.
15 changes: 10 additions & 5 deletions modules/nf-core/krakenuniq/build/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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}":
Expand Down
14 changes: 6 additions & 8 deletions modules/nf-core/krakenuniq/build/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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()
}
)
Expand All @@ -59,7 +60,6 @@ nextflow_process {
}

test("sarscov2 - fasta - stub") {

options "-stub"

when {
Expand All @@ -76,7 +76,5 @@ nextflow_process {
{ assert snapshot(process.out).match() }
)
}

}

}
112 changes: 38 additions & 74 deletions modules/nf-core/krakenuniq/build/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
]
],
Expand All @@ -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"
]
]
],
Expand All @@ -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"
}
}

0 comments on commit 7a3bd6b

Please sign in to comment.