Skip to content

Commit

Permalink
Updated test data paths and added a stub
Browse files Browse the repository at this point in the history
  • Loading branch information
GallVp committed Nov 24, 2024
1 parent ebffab4 commit 368c3a2
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 5 deletions.
25 changes: 22 additions & 3 deletions modules/nf-core/decoupler/decoupler/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
"""
}
31 changes: 29 additions & 2 deletions modules/nf-core/decoupler/decoupler/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -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)
]
"""
}
Expand All @@ -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() }
)
}

}

}
49 changes: 49 additions & 0 deletions modules/nf-core/decoupler/decoupler/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -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": [
{
Expand Down

0 comments on commit 368c3a2

Please sign in to comment.