diff --git a/modules/nf-core/decoupler/decoupler/main.nf b/modules/nf-core/decoupler/decoupler/main.nf index 7a174192ac8e..4acdb3c7ab32 100644 --- a/modules/nf-core/decoupler/decoupler/main.nf +++ b/modules/nf-core/decoupler/decoupler/main.nf @@ -11,9 +11,9 @@ process DECOUPLER { path net output: - tuple val(meta), path("*estimate__decoupler.tsv"), emit: dc_estimate - tuple val(meta), path("*pvals__decoupler.tsv"), emit: dc_pvals - path ("versions.yml"), emit: versions + tuple val(meta), path("*estimate__decoupler.tsv") , emit: dc_estimate + tuple val(meta), path("*pvals__decoupler.tsv") , emit: dc_pvals + path("versions.yml") , emit: versions when: task.ext.when == null || task.ext.when @@ -69,4 +69,23 @@ process DECOUPLER { version_file.write('"${task.process}":' + "\\n") version_file.write(f" decoupler-py: {dc.__version__}\\n") """ + + stub: + """ + #!/usr/bin/env python3 + import decoupler as dc + + ## dc_estimate + with open('consensus_estimate__decoupler.tsv', 'a') as tsv_file: + tsv_file.write('') + + ## dc_pvals + with open('consensus_pvals__decoupler.tsv', 'a') as tsv_file: + tsv_file.write('') + + ## VERSIONS FILE + with open('versions.yml', 'a') as version_file: + version_file.write('"${task.process}":' + "\\n") + version_file.write(f" decoupler-py: {dc.__version__}\\n") + """ } diff --git a/modules/nf-core/decoupler/decoupler/tests/main.nf.test b/modules/nf-core/decoupler/decoupler/tests/main.nf.test index cbaf2899de4c..7a6db3991556 100644 --- a/modules/nf-core/decoupler/decoupler/tests/main.nf.test +++ b/modules/nf-core/decoupler/decoupler/tests/main.nf.test @@ -17,10 +17,10 @@ nextflow_process { """ input[0] = [ [ id: 'test' ], - file(params.test_data['generic']['tsv']['expression'], checkIfExists: true) + file(params.modules_testdata_base_path + 'generic/tsv/expression.tsv', checkIfExists: true) ] input[1] = [ - file(params.test_data['generic']['tsv']['network'], checkIfExists: true) + file(params.modules_testdata_base_path + 'generic/tsv/network.tsv', checkIfExists: true) ] """ } @@ -36,4 +36,31 @@ nextflow_process { } + test("decoupler_test - stub") { + + options '-stub' + + when { + process { + """ + input[0] = [ + [ id: 'test' ], + file(params.modules_testdata_base_path + 'generic/tsv/expression.tsv', checkIfExists: true) + ] + input[1] = [ + file(params.modules_testdata_base_path + 'generic/tsv/network.tsv', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + } \ No newline at end of file diff --git a/modules/nf-core/decoupler/decoupler/tests/main.nf.test.snap b/modules/nf-core/decoupler/decoupler/tests/main.nf.test.snap index 56f9335da3f1..7422b31ef92c 100644 --- a/modules/nf-core/decoupler/decoupler/tests/main.nf.test.snap +++ b/modules/nf-core/decoupler/decoupler/tests/main.nf.test.snap @@ -1,4 +1,53 @@ { + "decoupler_test - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "consensus_estimate__decoupler.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "consensus_pvals__decoupler.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,8fd115b4099050429b348981ca1d5e86" + ], + "dc_estimate": [ + [ + { + "id": "test" + }, + "consensus_estimate__decoupler.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "dc_pvals": [ + [ + { + "id": "test" + }, + "consensus_pvals__decoupler.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,8fd115b4099050429b348981ca1d5e86" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.10.1" + }, + "timestamp": "2024-11-25T11:03:58.583432" + }, "versions": { "content": [ {