From 2b4e090f8b9cac2f8a3b372eccdf08c2d6918cd5 Mon Sep 17 00:00:00 2001 From: darcy220606 Date: Thu, 14 Dec 2023 12:47:06 +0100 Subject: [PATCH 1/3] Add main.nf.test --- modules/nf-core/pyrodigal/environment.yml | 9 ++++ modules/nf-core/pyrodigal/tests/main.nf.test | 46 ++++++++++++++++++++ modules/nf-core/pyrodigal/tests/tags.yml | 2 + tests/config/pytest_modules.yml | 4 -- 4 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 modules/nf-core/pyrodigal/environment.yml create mode 100644 modules/nf-core/pyrodigal/tests/main.nf.test create mode 100644 modules/nf-core/pyrodigal/tests/tags.yml diff --git a/modules/nf-core/pyrodigal/environment.yml b/modules/nf-core/pyrodigal/environment.yml new file mode 100644 index 00000000000..a0dad862978 --- /dev/null +++ b/modules/nf-core/pyrodigal/environment.yml @@ -0,0 +1,9 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +name: "pyrodigal" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::pyrodigal=2.1.0 diff --git a/modules/nf-core/pyrodigal/tests/main.nf.test b/modules/nf-core/pyrodigal/tests/main.nf.test new file mode 100644 index 00000000000..831a63d6fc4 --- /dev/null +++ b/modules/nf-core/pyrodigal/tests/main.nf.test @@ -0,0 +1,46 @@ +// TODO nf-core: Once you have added the required tests, please run the following command to build this file: +// nf-core modules test pyrodigal +nextflow_process { + + name "Test Process PYRODIGAL" + script "../main.nf" + process "PYRODIGAL" + + tag "modules" + tag "modules_nfcore" + tag "pyrodigal" + + setup { + + run("GUNZIP") { + script "../../gunzip/main.nf" + process { + """ + input[0] = Channel.fromList([ + tuple([ id:'test1', single_end:false ], // meta map + file(params.test_data['haemophilus_influenzae']['genome']['genome_fna_gz'], checkIfExists: true)) + ]) + """ + } + } + } + + when { + process { + """ + input[0] = GUNZIP.out.gunzip + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + //TODO nf-core: Add all required assertions to verify the test output. + ) + } + + } + +} diff --git a/modules/nf-core/pyrodigal/tests/tags.yml b/modules/nf-core/pyrodigal/tests/tags.yml new file mode 100644 index 00000000000..8851ca8b815 --- /dev/null +++ b/modules/nf-core/pyrodigal/tests/tags.yml @@ -0,0 +1,2 @@ +pyrodigal: + - "modules/nf-core/pyrodigal/**" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 5225f5d1dda..f24559702ef 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -2684,10 +2684,6 @@ pydamage/filter: - modules/nf-core/pydamage/filter/** - tests/modules/nf-core/pydamage/filter/** -pyrodigal: - - modules/nf-core/pyrodigal/** - - tests/modules/nf-core/pyrodigal/** - qcat: - modules/nf-core/qcat/** - tests/modules/nf-core/qcat/** From 004a2e3427842819720b2185d79ae494859ba077 Mon Sep 17 00:00:00 2001 From: darcy220606 Date: Thu, 14 Dec 2023 14:11:16 +0100 Subject: [PATCH 2/3] migrate to nf-test format --- modules/nf-core/pyrodigal/meta.yml | 2 +- modules/nf-core/pyrodigal/tests/main.nf.test | 28 ++---- .../nf-core/pyrodigal/tests/main.nf.test.snap | 87 +++++++++++++++++++ tests/modules/nf-core/pyrodigal/main.nf | 15 ---- .../modules/nf-core/pyrodigal/nextflow.config | 5 -- tests/modules/nf-core/pyrodigal/test.yml | 14 --- 6 files changed, 94 insertions(+), 57 deletions(-) create mode 100644 modules/nf-core/pyrodigal/tests/main.nf.test.snap delete mode 100644 tests/modules/nf-core/pyrodigal/main.nf delete mode 100644 tests/modules/nf-core/pyrodigal/nextflow.config delete mode 100644 tests/modules/nf-core/pyrodigal/test.yml diff --git a/modules/nf-core/pyrodigal/meta.yml b/modules/nf-core/pyrodigal/meta.yml index 969efa404e2..024d04ffb95 100644 --- a/modules/nf-core/pyrodigal/meta.yml +++ b/modules/nf-core/pyrodigal/meta.yml @@ -12,7 +12,7 @@ tools: documentation: "https://pyrodigal.readthedocs.org/" tool_dev_url: "https://github.com/althonos/pyrodigal/" doi: "10.21105/joss.04296" - licence: "['GPL v3']" + licence: ["GPL v3"] input: - meta: type: map diff --git a/modules/nf-core/pyrodigal/tests/main.nf.test b/modules/nf-core/pyrodigal/tests/main.nf.test index 831a63d6fc4..299325c7ce2 100644 --- a/modules/nf-core/pyrodigal/tests/main.nf.test +++ b/modules/nf-core/pyrodigal/tests/main.nf.test @@ -1,5 +1,3 @@ -// TODO nf-core: Once you have added the required tests, please run the following command to build this file: -// nf-core modules test pyrodigal nextflow_process { name "Test Process PYRODIGAL" @@ -10,25 +8,14 @@ nextflow_process { tag "modules_nfcore" tag "pyrodigal" - setup { - - run("GUNZIP") { - script "../../gunzip/main.nf" - process { - """ - input[0] = Channel.fromList([ - tuple([ id:'test1', single_end:false ], // meta map - file(params.test_data['haemophilus_influenzae']['genome']['genome_fna_gz'], checkIfExists: true)) - ]) - """ - } - } - } - + test("pyrodigal") { when { process { """ - input[0] = GUNZIP.out.gunzip + input[0] = [ + [id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + ] """ } } @@ -37,10 +24,7 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out).match() } - //TODO nf-core: Add all required assertions to verify the test output. ) } - } - -} +} \ No newline at end of file diff --git a/modules/nf-core/pyrodigal/tests/main.nf.test.snap b/modules/nf-core/pyrodigal/tests/main.nf.test.snap new file mode 100644 index 00000000000..ee5965441d8 --- /dev/null +++ b/modules/nf-core/pyrodigal/tests/main.nf.test.snap @@ -0,0 +1,87 @@ +{ + "pyrodigal": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.gff.gz:md5,8ef64ae87208a8190742c7d49ed47476" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fna.gz:md5,1bc8a05bcb72a3c324f5e4ffaa716d3b" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "test.faa.gz:md5,7168b854103f3586ccfdb71a44c389f7" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test.score.gz:md5,fd1fc2fd86e747aafc8601e9efda9702" + ] + ], + "4": [ + "versions.yml:md5,052c8f18b0f7a8d108ddf0e5b9d8723f" + ], + "faa": [ + [ + { + "id": "test", + "single_end": false + }, + "test.faa.gz:md5,7168b854103f3586ccfdb71a44c389f7" + ] + ], + "fna": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fna.gz:md5,1bc8a05bcb72a3c324f5e4ffaa716d3b" + ] + ], + "gff": [ + [ + { + "id": "test", + "single_end": false + }, + "test.gff.gz:md5,8ef64ae87208a8190742c7d49ed47476" + ] + ], + "score": [ + [ + { + "id": "test", + "single_end": false + }, + "test.score.gz:md5,fd1fc2fd86e747aafc8601e9efda9702" + ] + ], + "versions": [ + "versions.yml:md5,052c8f18b0f7a8d108ddf0e5b9d8723f" + ] + } + ], + "timestamp": "2023-12-14T13:11:18.929874991" + } +} \ No newline at end of file diff --git a/tests/modules/nf-core/pyrodigal/main.nf b/tests/modules/nf-core/pyrodigal/main.nf deleted file mode 100644 index e373c93378f..00000000000 --- a/tests/modules/nf-core/pyrodigal/main.nf +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { PYRODIGAL } from '../../../../modules/nf-core/pyrodigal/main.nf' - -workflow test_pyrodigal { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) - ] - - PYRODIGAL ( input ) -} diff --git a/tests/modules/nf-core/pyrodigal/nextflow.config b/tests/modules/nf-core/pyrodigal/nextflow.config deleted file mode 100644 index 50f50a7a357..00000000000 --- a/tests/modules/nf-core/pyrodigal/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} \ No newline at end of file diff --git a/tests/modules/nf-core/pyrodigal/test.yml b/tests/modules/nf-core/pyrodigal/test.yml deleted file mode 100644 index ddcbde3825a..00000000000 --- a/tests/modules/nf-core/pyrodigal/test.yml +++ /dev/null @@ -1,14 +0,0 @@ -- name: pyrodigal test_pyrodigal - command: nextflow run ./tests/modules/nf-core/pyrodigal -entry test_pyrodigal -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/pyrodigal/nextflow.config - tags: - - pyrodigal - files: - - path: output/pyrodigal/test.faa.gz - md5sum: 7524e6583836529618b9b7469e7248ff - - path: output/pyrodigal/test.fna.gz - md5sum: e5978af4ef6535146bc92a701e23129f - - path: output/pyrodigal/test.gff.gz - md5sum: 4d95a2c1ceb35252f23e20b34b9382d0 - - path: output/pyrodigal/test.score.gz - md5sum: 169cfd95a0eb36f89b9edf6d3e760caa - - path: output/pyrodigal/versions.yml From a7399602ae210de4aae713ed9256a0bfab29971f Mon Sep 17 00:00:00 2001 From: darcy220606 Date: Tue, 2 Jan 2024 13:58:11 +0100 Subject: [PATCH 3/3] add stub --- modules/nf-core/pyrodigal/main.nf | 16 ++++++++++++ modules/nf-core/pyrodigal/tests/main.nf.test | 26 +++++++++++++++++++ .../nf-core/pyrodigal/tests/main.nf.test.snap | 12 +++++++++ 3 files changed, 54 insertions(+) diff --git a/modules/nf-core/pyrodigal/main.nf b/modules/nf-core/pyrodigal/main.nf index 08a4d27985f..9b89857443d 100644 --- a/modules/nf-core/pyrodigal/main.nf +++ b/modules/nf-core/pyrodigal/main.nf @@ -41,4 +41,20 @@ process PYRODIGAL { pyrodigal: \$(echo \$(pyrodigal --version 2>&1 | sed 's/pyrodigal v//')) END_VERSIONS """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.gff.gz + touch ${prefix}.fna.gz + touch ${prefix}.faa.gz + touch ${prefix}.score.gz + touch versions.yml + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + pyrodigal: \$(echo \$(pyrodigal --version 2>&1 | sed 's/pyrodigal v//')) + END_VERSIONS + """ } diff --git a/modules/nf-core/pyrodigal/tests/main.nf.test b/modules/nf-core/pyrodigal/tests/main.nf.test index 299325c7ce2..4eb8929a633 100644 --- a/modules/nf-core/pyrodigal/tests/main.nf.test +++ b/modules/nf-core/pyrodigal/tests/main.nf.test @@ -27,4 +27,30 @@ nextflow_process { ) } } + + test("pyrodigal - stub") { + options "-stub" + when { + process { + """ + input[0] = [ + [id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.gff.collect { file(it[1]).getName() } + + process.out.fna.collect { file(it[1]).getName() } + + process.out.faa.collect { file(it[1]).getName() } + + process.out.score.collect { file(it[1]).getName() } + + process.out.versions).match() } + ) + } + } + } \ No newline at end of file diff --git a/modules/nf-core/pyrodigal/tests/main.nf.test.snap b/modules/nf-core/pyrodigal/tests/main.nf.test.snap index ee5965441d8..a32b8261c7f 100644 --- a/modules/nf-core/pyrodigal/tests/main.nf.test.snap +++ b/modules/nf-core/pyrodigal/tests/main.nf.test.snap @@ -1,4 +1,16 @@ { + "pyrodigal - stub": { + "content": [ + [ + "test.gff.gz", + "test.fna.gz", + "test.faa.gz", + "test.score.gz", + "versions.yml:md5,052c8f18b0f7a8d108ddf0e5b9d8723f" + ] + ], + "timestamp": "2024-01-02T13:54:40.71233412" + }, "pyrodigal": { "content": [ {