Skip to content

Commit

Permalink
nf-test for snpsites (#5284)
Browse files Browse the repository at this point in the history
* nf-test for snpsites

* remove old pytest

* Delete modules/nf-core/snpsites/tests/nextflow.config

* Update modules/nf-core/snpsites/tests/main.nf.test

Co-authored-by: Joon Klaps <[email protected]>

* Update assert

Co-authored-by: Joon Klaps <[email protected]>

* renamed test

Co-authored-by: Joon Klaps <[email protected]>

* reverted the input

* updated input...again

Co-authored-by: Joon Klaps <[email protected]>

* fixed typo

Co-authored-by: Joon Klaps <[email protected]>

* Regenerate snapshot and fix linting

---------

Co-authored-by: Joon Klaps <[email protected]>
Co-authored-by: Simon Pearce <[email protected]>
  • Loading branch information
3 people authored Jun 26, 2024
1 parent d5622b0 commit c50ccc7
Show file tree
Hide file tree
Showing 9 changed files with 139 additions and 29 deletions.
12 changes: 12 additions & 0 deletions modules/nf-core/snpsites/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,16 @@ process SNPSITES {
snpsites: \$(snp-sites -V 2>&1 | sed 's/snp-sites //')
END_VERSIONS
"""
stub:
"""
touch filtered_alignment.fas
touch constant.sites.txt
CONSTANT_SITES=\$(cat constant.sites.txt)
cat <<-END_VERSIONS > versions.yml
"${task.process}":
snpsites: \$(snp-sites -V 2>&1 | sed 's/snp-sites //')
END_VERSIONS
"""

}
4 changes: 4 additions & 0 deletions modules/nf-core/snpsites/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ output:
type: file
description: Text file containing counts of constant sites
pattern: "*.{sites.txt}"
- constant_sites_string:
type: integer
description: Value with the number of constant sites
pattern: "*.{sites.txt}"
authors:
- "@avantonder"
maintainers:
Expand Down
49 changes: 49 additions & 0 deletions modules/nf-core/snpsites/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
nextflow_process {

name "Test Process SNPSITES"
script "../main.nf"
process "SNPSITES"

tag "modules"
tag "modules_nfcore"
tag "snpsites"

test("sarscov2 - all_sites_fas") {

when {
process {
"""
input[0] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/alignment/all_sites.fas', checkIfExists: true)
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

test("sarscov2 - all_sites_fas - stub") {
options "-stub"
when {
process {
"""
input[0] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/alignment/all_sites.fas', checkIfExists: true)
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

}
72 changes: 72 additions & 0 deletions modules/nf-core/snpsites/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"sarscov2 - all_sites_fas - stub": {
"content": [
{
"0": [
"filtered_alignment.fas:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"1": [
"constant.sites.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"2": [
"versions.yml:md5,af6942a02036a7ff2eadb6ecf344c619"
],
"3": [
""
],
"constant_sites": [
"constant.sites.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"constant_sites_string": [
""
],
"fasta": [
"filtered_alignment.fas:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"versions": [
"versions.yml:md5,af6942a02036a7ff2eadb6ecf344c619"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-05-08T15:20:57.589176616"
},
"sarscov2 - all_sites_fas": {
"content": [
{
"0": [
"filtered_alignment.fas:md5,f96c7513003e878e16fa9eac9fcda0f4"
],
"1": [
"constant.sites.txt:md5,8b9b226e3787f7baaefce07405af22c9"
],
"2": [
"versions.yml:md5,af6942a02036a7ff2eadb6ecf344c619"
],
"3": [
"8789,5363,5747,9456"
],
"constant_sites": [
"constant.sites.txt:md5,8b9b226e3787f7baaefce07405af22c9"
],
"constant_sites_string": [
"8789,5363,5747,9456"
],
"fasta": [
"filtered_alignment.fas:md5,f96c7513003e878e16fa9eac9fcda0f4"
],
"versions": [
"versions.yml:md5,af6942a02036a7ff2eadb6ecf344c619"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-05-08T15:15:41.760289537"
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/snpsites/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
snpsites:
- "modules/nf-core/snpsites/**"
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1579,9 +1579,6 @@ snpsift/dbnsfp:
snpsift/split:
- modules/nf-core/snpsift/split/**
- tests/modules/nf-core/snpsift/split/**
snpsites:
- modules/nf-core/snpsites/**
- tests/modules/nf-core/snpsites/**
somalier/ancestry:
- modules/nf-core/somalier/ancestry/**
- tests/modules/nf-core/somalier/ancestry/**
Expand Down
12 changes: 0 additions & 12 deletions tests/modules/nf-core/snpsites/main.nf

This file was deleted.

5 changes: 0 additions & 5 deletions tests/modules/nf-core/snpsites/nextflow.config

This file was deleted.

9 changes: 0 additions & 9 deletions tests/modules/nf-core/snpsites/test.yml

This file was deleted.

0 comments on commit c50ccc7

Please sign in to comment.