Skip to content

Commit

Permalink
Added nf-test for krona/ktimporttaxonomy
Browse files Browse the repository at this point in the history
  • Loading branch information
GallVp committed Jan 25, 2025
1 parent 50a50b8 commit 9b7a89b
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 95 deletions.
1 change: 0 additions & 1 deletion modules/nf-core/krona/ktimporttaxonomy/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ process KRONA_KTIMPORTTAXONOMY {
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def VERSION = '2.8.1' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
"""
Expand Down
100 changes: 80 additions & 20 deletions modules/nf-core/krona/ktimporttaxonomy/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
nextflow_process {

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

Expand All @@ -9,53 +10,112 @@ nextflow_process {
tag "krona"
tag "krona/ktimporttaxonomy"

test ("sarscov2 - metagenome - kraken report") {


test("test_krona_ktimporttaxonomy_reads") {

when {
params {
module_args = '-t 3'
}
process {
"""
input[0] = Channel.of([
[id: 'test'],
file(params.modules_testdata_base_path + 'genomics/sarscov2/metagenome/test_1.kraken2.report.txt', checkIfExists: true)
])
input[1] = Channel.of([
file(params.modules_testdata_base_path + 'genomics/sarscov2/metagenome/krona_taxonomy.tab', checkIfExists: true)
])
input[0] = [
[id:'test',single_end:false],// meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/metagenome/test_1.kraken2.reads.txt', checkIfExists: true)
]
input[1] = file(params.modules_testdata_base_path + 'genomics/sarscov2/metagenome/krona_taxonomy.tab', checkIfExists: true)
"""
}
}
then {
assertAll(
{ assert process.success },
{ assert snapshot(
file(process.out.html[0][1]).text.contains('Severe acute respiratory syndrome-related coronavirus'),
process.out.versions
).match()
}
)
}
}


test("test_krona_ktimporttaxonomy_report") {

when {
params {
module_args = '-m 3 -t 5'
}
process {
"""
input[0] = [
[id:'test',single_end:false],// meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/metagenome/test_1.kraken2.report.txt', checkIfExists: true)
]
input[1] = file(params.modules_testdata_base_path + 'genomics/sarscov2/metagenome/krona_taxonomy.tab', checkIfExists: true)
"""
}
}
then {
assertAll(
{ assert process.success },
{ assert snapshot ( process.out.versions ).match() },
{ assert file(process.out.html.get(0).get(1)).exists() }
{ assert snapshot(
file(process.out.html[0][1]).text.contains('Severe acute respiratory syndrome-related coronavirus'),
process.out.versions
).match()
}
)
}
}

test ("sarscov2 - metagenome - kraken report - stub") {

test("test_krona_ktimporttaxonomy_reads -- stub") {
options '-stub'
when {
params {
module_args = '-t 3'
}
process {
"""
input[0] = Channel.of([
[id: 'test'],
file(params.modules_testdata_base_path + 'genomics/sarscov2/metagenome/test_1.kraken2.report.txt', checkIfExists: true)
])
input[1] = Channel.of([
file(params.modules_testdata_base_path + 'genomics/sarscov2/metagenome/krona_taxonomy.tab', checkIfExists: true)
])
input[0] = [
[id:'test',single_end:false],// meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/metagenome/test_1.kraken2.reads.txt', checkIfExists: true)
]
input[1] = file(params.modules_testdata_base_path + 'genomics/sarscov2/metagenome/krona_taxonomy.tab', checkIfExists: true)
"""
}
}
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}


test("test_krona_ktimporttaxonomy_report -- stub") {
options '-stub'
when {
params {
module_args = '-m 3 -t 5'
}
process {
"""
input[0] = [
[id:'test',single_end:false],// meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/metagenome/test_1.kraken2.report.txt', checkIfExists: true)
]
input[1] = file(params.modules_testdata_base_path + 'genomics/sarscov2/metagenome/krona_taxonomy.tab', checkIfExists: true)
"""
}
}
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() },
{ assert snapshot(process.out).match() }
)
}
}
}
}
73 changes: 62 additions & 11 deletions modules/nf-core/krona/ktimporttaxonomy/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
{
"sarscov2 - metagenome - kraken report": {
"test_krona_ktimporttaxonomy_report": {
"content": [
true,
[
"versions.yml:md5,59fc89b6db8fad0aa9aa06f7437a18a7"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.04.1"
"nf-test": "0.9.0",
"nextflow": "24.10.3"
},
"timestamp": "2024-08-08T10:34:23.760055"
"timestamp": "2025-01-25T19:59:51.434122"
},
"sarscov2 - metagenome - kraken report - stub": {
"test_krona_ktimporttaxonomy_report -- stub": {
"content": [
{
"0": [
[
{
"id": "test"
"id": "test",
"single_end": false
},
"test.html:md5,d41d8cd98f00b204e9800998ecf8427e"
]
Expand All @@ -28,7 +30,8 @@
"html": [
[
{
"id": "test"
"id": "test",
"single_end": false
},
"test.html:md5,d41d8cd98f00b204e9800998ecf8427e"
]
Expand All @@ -39,9 +42,57 @@
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.04.1"
"nf-test": "0.9.0",
"nextflow": "24.10.3"
},
"timestamp": "2024-08-08T10:34:29.695251"
"timestamp": "2025-01-25T19:54:28.461618"
},
"test_krona_ktimporttaxonomy_reads": {
"content": [
true,
[
"versions.yml:md5,59fc89b6db8fad0aa9aa06f7437a18a7"
]
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.10.3"
},
"timestamp": "2025-01-25T19:59:46.33943"
},
"test_krona_ktimporttaxonomy_reads -- stub": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test.html:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,59fc89b6db8fad0aa9aa06f7437a18a7"
],
"html": [
[
{
"id": "test",
"single_end": false
},
"test.html:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,59fc89b6db8fad0aa9aa06f7437a18a7"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.10.3"
},
"timestamp": "2025-01-25T19:54:23.95162"
}
}
}
5 changes: 5 additions & 0 deletions modules/nf-core/krona/ktimporttaxonomy/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: "KRONA_KTIMPORTTAXONOMY" {
ext.args = params.module_args
}
}
2 changes: 0 additions & 2 deletions modules/nf-core/krona/ktimporttaxonomy/tests/tags.yml

This file was deleted.

3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,6 @@ krakentools/combinekreports:
krona/kronadb:
- modules/nf-core/krona/kronadb/**
- tests/modules/nf-core/krona/kronadb/**
krona/ktimporttaxonomy:
- modules/nf-core/krona/ktimporttaxonomy/**
- tests/modules/nf-core/krona/ktimporttaxonomy/**
krona/ktimporttext:
- modules/nf-core/krona/ktimporttext/**
- tests/modules/nf-core/krona/ktimporttext/**
Expand Down
28 changes: 0 additions & 28 deletions tests/modules/nf-core/krona/ktimporttaxonomy/main.nf

This file was deleted.

13 changes: 0 additions & 13 deletions tests/modules/nf-core/krona/ktimporttaxonomy/nextflow.config

This file was deleted.

17 changes: 0 additions & 17 deletions tests/modules/nf-core/krona/ktimporttaxonomy/test.yml

This file was deleted.

0 comments on commit 9b7a89b

Please sign in to comment.