From ab4d0571d5da8f663ef5c040899d3372d9467840 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Mon, 19 Feb 2024 16:14:55 -0600 Subject: [PATCH] test(gxf2bed): Add basic tests --- modules/nf-core/gxf2bed/main.nf | 6 +-- modules/nf-core/gxf2bed/tests/main.nf.test | 43 ++++++++++------------ 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/modules/nf-core/gxf2bed/main.nf b/modules/nf-core/gxf2bed/main.nf index efaa539f30e..cabd4613ece 100644 --- a/modules/nf-core/gxf2bed/main.nf +++ b/modules/nf-core/gxf2bed/main.nf @@ -1,5 +1,5 @@ process GXF2BED { - tag '$bam' + tag '$gxf.baseName' label 'process_low' conda "${moduleDir}/environment.yml" @@ -18,7 +18,7 @@ process GXF2BED { task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${gxf.baseName}" """ gxf2bed \\ --input $gxf \\ @@ -32,7 +32,7 @@ process GXF2BED { """ stub: - def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${gxf.baseName}" """ touch ${prefix}.bed diff --git a/modules/nf-core/gxf2bed/tests/main.nf.test b/modules/nf-core/gxf2bed/tests/main.nf.test index 6702d4766c7..41cc57ec027 100644 --- a/modules/nf-core/gxf2bed/tests/main.nf.test +++ b/modules/nf-core/gxf2bed/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 gxf2bed nextflow_process { name "Test Process GXF2BED" @@ -10,20 +8,11 @@ nextflow_process { tag "modules_nfcore" tag "gxf2bed" - // TODO nf-core: Change the test name preferably indicating the test-data and file-format used - test("sarscov2 - bam") { - - // TODO nf-core: If you are created a test for a chained module - // (the module requires running more than one process to generate the required output) - // add the 'setup' method here. - // You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules). - + test("sarscov2 - gtf") { when { process { """ - // TODO nf-core: define inputs of the process here. Example: - - input[0] = file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true) + input[0] = file(params.test_data['sarscov2']['genome']['genome_gtf'], checkIfExists: true) """ } } @@ -32,24 +21,18 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out).match() } - //TODO nf-core: Add all required assertions to verify the test output. - // See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples. ) } - } - // TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix. - test("sarscov2 - bam - stub") { + test("sarscov2 - gtf - stub") { options "-stub" when { process { """ - // TODO nf-core: define inputs of the process here. Example: - - input[0] = file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true) + input[0] = file(params.test_data['sarscov2']['genome']['genome_gtf'], checkIfExists: true) """ } } @@ -58,10 +41,24 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out).match() } - //TODO nf-core: Add all required assertions to verify the test output. ) } - } + test("sarscov2 - gff") { + when { + process { + """ + input[0] = file(params.test_data['homo_sapiens']['genome']['genome_gff3'], checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } }