diff --git a/modules/nf-core/kofamscan/main.nf b/modules/nf-core/kofamscan/main.nf index 4360fd3e6002..327dd193b213 100644 --- a/modules/nf-core/kofamscan/main.nf +++ b/modules/nf-core/kofamscan/main.nf @@ -15,7 +15,7 @@ process KOFAMSCAN { output: tuple val(meta), path('*.txt'), optional: true, emit: txt tuple val(meta), path('*.tsv'), optional: true, emit: tsv - path "versions.yml" , emit: versions + tuple val("${task.process}"), val('kofamscan'), eval("exec_annotation --version 2>&1 | sed 's/exec_annotation //;'"), topic: versions, emit: versions_kofamscan when: task.ext.when == null || task.ext.when @@ -33,10 +33,14 @@ process KOFAMSCAN { --cpu $task.cpus \\ -o ${prefix}.${extension} \\ $fasta + """ - cat <<-END_VERSIONS > versions.yml - "${task.process}": - kofamscan: \$(echo \$(exec_annotation --version 2>&1) | sed 's/^.*exec_annotation //;') - END_VERSIONS + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def extension = args.contains("--format detail-tsv") ? "tsv" : + "txt" + """ + touch ${prefix}.${extension} """ } diff --git a/modules/nf-core/kofamscan/meta.yml b/modules/nf-core/kofamscan/meta.yml index b9eead84eeec..e320af013c05 100644 --- a/modules/nf-core/kofamscan/meta.yml +++ b/modules/nf-core/kofamscan/meta.yml @@ -1,6 +1,6 @@ name: "kofamscan" -description: Produces annotation using kofamscan against a Profile database and a - KO list +description: Produces annotation using kofamscan against a Profile database and + a KO list keywords: - fasta - kegg @@ -13,7 +13,8 @@ tools: documentation: "https://github.com/takaram/kofam_scan" tool_dev_url: "https://github.com/takaram/kofam_scan" doi: "10.1093/bioinformatics/btz859" - licence: ["MIT License"] + licence: + - "MIT License" identifier: biotools:kofamscan input: - - meta: @@ -38,10 +39,10 @@ input: output: txt: - - meta: - type: file - description: Application-specific text file with hits information - pattern: "*.{txt}" - ontologies: [] + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] - "*.txt": type: file description: Application-specific text file with hits information @@ -49,23 +50,37 @@ output: ontologies: [] tsv: - - meta: - type: file - description: Application-specific text file with hits information - pattern: "*.{txt}" - ontologies: [] + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] - "*.tsv": type: file description: Tab separated file containing with detailed hits pattern: "*.{tsv}" ontologies: - edam: http://edamontology.org/format_3475 # TSV + versions_kofamscan: + - - ${task.process}: + type: string + description: The name of the process + - kofamscan: + type: string + description: kofamscan version string + - "exec_annotation --version 2>&1 | sed 's/exec_annotation //;'": + type: eval + description: The expression to obtain the version of the tool +topics: versions: - - versions.yml: - type: file - description: File containing software versions - pattern: "versions.yml" - ontologies: - - edam: http://edamontology.org/format_3750 # YAML + - - ${task.process}: + type: string + description: The name of the process + - kofamscan: + type: string + description: kofamscan version string + - "exec_annotation --version 2>&1 | sed 's/exec_annotation //;'": + type: eval + description: The expression to obtain the version of the tool authors: - "@toniher" maintainers: diff --git a/modules/nf-core/kofamscan/tests/main.nf.test b/modules/nf-core/kofamscan/tests/main.nf.test index d9de68796b52..c32070c54b6f 100644 --- a/modules/nf-core/kofamscan/tests/main.nf.test +++ b/modules/nf-core/kofamscan/tests/main.nf.test @@ -50,7 +50,7 @@ nextflow_process { assertAll( { assert process.success }, { assert process.out.txt }, - { assert snapshot(process.out.versions).match() } + { assert snapshot(process.out.findAll { key, val -> key.startsWith('versions') }).match() } ) } } @@ -93,7 +93,53 @@ nextflow_process { assertAll( { assert process.success }, { assert path(process.out.tsv.get(0).get(1)).exists() }, - { assert snapshot(process.out.versions).match() } + { assert snapshot(process.out.findAll { key, val -> key.startsWith('versions') }).match() } + ) + } + } + + test("test_kofamscan_txt - stub") { + + options "-stub" + + setup { + run("UNTAR") { + script "../../untar/main.nf" + + process { + """ + input[0] = [[],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/kofamscan/profiles.tar.gz',checkIfExists:true)] + """ + } + } + + run("GUNZIP") { + script "../../gunzip/main.nf" + + process { + """ + input[0] = [[],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/kofamscan/ko_list.gz',checkIfExists:true)] + """ + } + } + } + when { + params { + module_args = '' + } + process { + """ + input[0] = [[id:'test'], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta',checkIfExists: true)] + input[1] = UNTAR.out.untar.map{it[1]} + input[2] = GUNZIP.out.gunzip.map{it[1]} + """ + } + } + then { + assertAll( + { assert process.success }, + { assert process.out.txt }, + { assert snapshot(process.out.findAll { key, val -> key.startsWith('versions') }).match() } ) } } diff --git a/modules/nf-core/kofamscan/tests/main.nf.test.snap b/modules/nf-core/kofamscan/tests/main.nf.test.snap index cc3c51fbf15c..1ea46155010d 100644 --- a/modules/nf-core/kofamscan/tests/main.nf.test.snap +++ b/modules/nf-core/kofamscan/tests/main.nf.test.snap @@ -1,26 +1,56 @@ { "test_kofamscan_tsv": { "content": [ - [ - "versions.yml:md5,27e1b383c38beae2cdebb2cc79ff061e" - ] + { + "versions_kofamscan": [ + [ + "KOFAMSCAN", + "kofamscan", + "1.3.0" + ] + ] + } ], + "timestamp": "2026-04-30T11:04:48.94643", "meta": { - "nf-test": "0.9.2", - "nextflow": "24.10.2" - }, - "timestamp": "2025-03-25T09:10:30.450619346" + "nf-test": "0.9.5", + "nextflow": "26.04.0" + } + }, + "test_kofamscan_txt - stub": { + "content": [ + { + "versions_kofamscan": [ + [ + "KOFAMSCAN", + "kofamscan", + "1.3.0" + ] + ] + } + ], + "timestamp": "2026-04-30T11:05:05.206627", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.04.0" + } }, "test_kofamscan_txt": { "content": [ - [ - "versions.yml:md5,27e1b383c38beae2cdebb2cc79ff061e" - ] + { + "versions_kofamscan": [ + [ + "KOFAMSCAN", + "kofamscan", + "1.3.0" + ] + ] + } ], + "timestamp": "2026-04-30T11:04:27.92766", "meta": { - "nf-test": "0.9.2", - "nextflow": "24.10.2" - }, - "timestamp": "2025-03-24T13:54:47.35695004" + "nf-test": "0.9.5", + "nextflow": "26.04.0" + } } -} +} \ No newline at end of file