Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added nf-test for goat/taxonsearch #6522

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions modules/nf-core/goat/taxonsearch/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,19 @@ process GOAT_TAXONSEARCH {
goat: \$(goat-cli --version | cut -d' ' -f2)
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
input = taxa_file ? "-f ${taxa_file}" : "-t \"${taxon}\""
if (!taxon && !taxa_file) error "No input. Valid input: single taxon identifier or a .txt file with identifiers"
if (taxon && taxa_file ) error "Only one input is required: a single taxon identifier or a .txt file with identifiers"
"""
touch ${prefix}.tsv

cat <<-END_VERSIONS > versions.yml
"${task.process}":
goat: \$(goat-cli --version | cut -d' ' -f2)
END_VERSIONS
"""
}
107 changes: 107 additions & 0 deletions modules/nf-core/goat/taxonsearch/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@

nextflow_process {

name "Test Process GOAT_TAXONSEARCH"
script "../main.nf"
process "GOAT_TAXONSEARCH"
config "./nextflow.config"

tag "modules"
tag "modules_nfcore"
tag "goat"
tag "goat/taxonsearch"

test("test-goat-taxonsearch-single-species") {

when {
process {
"""
input[0] = [
[ id:'test_single_species' ], // meta map
'Meles meles',
[]
]

"""
}
}

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

test("test-goat-taxonsearch-genus-id") {

when {
process {
"""
input[0] = [
[ id:'test_genus_id' ], // meta map
'7215',
[]
]

"""
}
}

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

test("test-goat-taxonsearch-species") {

when {
process {
"""
input[0] = [
[ id:'test_species' ], // meta map
'',
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/generic/txt/species_names.txt', checkIfExists: true)
]

"""
}
}

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

test("test-goat-taxonsearch-species-stub") {
options '-stub'

when {
process {
"""
input[0] = [
[ id:'test_species' ], // meta map
'',
file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/generic/txt/species_names.txt', checkIfExists: true)
]

"""
}
}

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

}
134 changes: 134 additions & 0 deletions modules/nf-core/goat/taxonsearch/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{
"test-goat-taxonsearch-species": {
"content": [
{
"0": [
[
{
"id": "test_species"
},
"test_species.tsv:md5,31d1bc139e5e507015e2ab0581708633"
]
],
"1": [
"versions.yml:md5,d07de5ffeab892f448b03802528bfbbb"
],
"taxonsearch": [
[
{
"id": "test_species"
},
"test_species.tsv:md5,31d1bc139e5e507015e2ab0581708633"
]
],
"versions": [
"versions.yml:md5,d07de5ffeab892f448b03802528bfbbb"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-02T13:10:06.012895"
},
"test-goat-taxonsearch-species-stub": {
"content": [
{
"0": [
[
{
"id": "test_species"
},
"test_species.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,d07de5ffeab892f448b03802528bfbbb"
],
"taxonsearch": [
[
{
"id": "test_species"
},
"test_species.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,d07de5ffeab892f448b03802528bfbbb"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-02T13:10:10.398213"
},
"test-goat-taxonsearch-genus-id": {
"content": [
{
"0": [
[
{
"id": "test_genus_id"
},
"test_genus_id.tsv:md5,31d1bc139e5e507015e2ab0581708633"
]
],
"1": [
"versions.yml:md5,d07de5ffeab892f448b03802528bfbbb"
],
"taxonsearch": [
[
{
"id": "test_genus_id"
},
"test_genus_id.tsv:md5,31d1bc139e5e507015e2ab0581708633"
]
],
"versions": [
"versions.yml:md5,d07de5ffeab892f448b03802528bfbbb"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-02T13:09:58.101426"
},
"test-goat-taxonsearch-single-species": {
"content": [
{
"0": [
[
{
"id": "test_single_species"
},
"test_single_species.tsv:md5,31d1bc139e5e507015e2ab0581708633"
]
],
"1": [
"versions.yml:md5,d07de5ffeab892f448b03802528bfbbb"
],
"taxonsearch": [
[
{
"id": "test_single_species"
},
"test_single_species.tsv:md5,31d1bc139e5e507015e2ab0581708633"
]
],
"versions": [
"versions.yml:md5,d07de5ffeab892f448b03802528bfbbb"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-02T13:09:51.117911"
}
}
5 changes: 5 additions & 0 deletions modules/nf-core/goat/taxonsearch/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: GOAT_TAXONSEARCH {
ext.args = '-l -b'
}
}
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,6 @@ glimpse2/concordance:
glnexus:
- modules/nf-core/glnexus/**
- tests/modules/nf-core/glnexus/**
goat/taxonsearch:
- modules/nf-core/goat/taxonsearch/**
- tests/modules/nf-core/goat/taxonsearch/**
goleft/indexsplit:
- modules/nf-core/goleft/indexsplit/**
- tests/modules/nf-core/goleft/indexsplit/**
Expand Down
44 changes: 0 additions & 44 deletions tests/modules/nf-core/goat/taxonsearch/main.nf

This file was deleted.

8 changes: 0 additions & 8 deletions tests/modules/nf-core/goat/taxonsearch/nextflow.config

This file was deleted.

26 changes: 0 additions & 26 deletions tests/modules/nf-core/goat/taxonsearch/test.yml

This file was deleted.

Loading