From 8291e7e35cf305b26433cb9c255d49f7d559aa97 Mon Sep 17 00:00:00 2001 From: Usman Rashid Date: Fri, 6 Sep 2024 17:22:50 +1200 Subject: [PATCH] Added nf-test for goleft/indexsplit (#6595) --- .../nf-core/goleft/indexsplit/environment.yml | 1 - modules/nf-core/goleft/indexsplit/meta.yml | 2 +- .../goleft/indexsplit/tests/main.nf.test | 68 ++++++++++++++++++ .../goleft/indexsplit/tests/main.nf.test.snap | 72 +++++++++++++++++++ tests/config/pytest_modules.yml | 3 - .../modules/nf-core/goleft/indexsplit/main.nf | 21 ------ .../nf-core/goleft/indexsplit/nextflow.config | 5 -- .../nf-core/goleft/indexsplit/test.yml | 9 --- 8 files changed, 141 insertions(+), 40 deletions(-) create mode 100644 modules/nf-core/goleft/indexsplit/tests/main.nf.test create mode 100644 modules/nf-core/goleft/indexsplit/tests/main.nf.test.snap delete mode 100644 tests/modules/nf-core/goleft/indexsplit/main.nf delete mode 100644 tests/modules/nf-core/goleft/indexsplit/nextflow.config delete mode 100644 tests/modules/nf-core/goleft/indexsplit/test.yml diff --git a/modules/nf-core/goleft/indexsplit/environment.yml b/modules/nf-core/goleft/indexsplit/environment.yml index d8c37692adc..192482ae457 100644 --- a/modules/nf-core/goleft/indexsplit/environment.yml +++ b/modules/nf-core/goleft/indexsplit/environment.yml @@ -2,6 +2,5 @@ name: goleft_indexsplit channels: - conda-forge - bioconda - - defaults dependencies: - bioconda::goleft=0.2.4 diff --git a/modules/nf-core/goleft/indexsplit/meta.yml b/modules/nf-core/goleft/indexsplit/meta.yml index 023a25a4ce3..49ee3b4f4eb 100644 --- a/modules/nf-core/goleft/indexsplit/meta.yml +++ b/modules/nf-core/goleft/indexsplit/meta.yml @@ -13,7 +13,7 @@ tools: documentation: "https://github.com/brentp/goleft" tool_dev_url: "https://github.com/brentp/goleft" doi: "10.1093/gigascience/gix090" - licence: "['MIT']" + licence: ["MIT"] input: - meta: type: map diff --git a/modules/nf-core/goleft/indexsplit/tests/main.nf.test b/modules/nf-core/goleft/indexsplit/tests/main.nf.test new file mode 100644 index 00000000000..9469e402f78 --- /dev/null +++ b/modules/nf-core/goleft/indexsplit/tests/main.nf.test @@ -0,0 +1,68 @@ + +nextflow_process { + + name "Test Process GOLEFT_INDEXSPLIT" + script "../main.nf" + process "GOLEFT_INDEXSPLIT" + + tag "modules" + tag "modules_nfcore" + tag "goleft" + tag "goleft/indexsplit" + + test("test-goleft-indexsplit") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.single_end.sorted.bam.bai', checkIfExists: true) + ] + input[1] = [ + [ id:'sarscov2'], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.fai', checkIfExists: true) + + ] + input[2] = 10 + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("test-goleft-indexsplit-stub") { + options '-stub' + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.single_end.sorted.bam.bai', checkIfExists: true) + ] + input[1] = [ + [ id:'sarscov2'], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.fai', checkIfExists: true) + ] + input[2] = 10 + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + +} diff --git a/modules/nf-core/goleft/indexsplit/tests/main.nf.test.snap b/modules/nf-core/goleft/indexsplit/tests/main.nf.test.snap new file mode 100644 index 00000000000..d8c7963eb10 --- /dev/null +++ b/modules/nf-core/goleft/indexsplit/tests/main.nf.test.snap @@ -0,0 +1,72 @@ +{ + "test-goleft-indexsplit": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bed:md5,6158ae22773bda2b1380c1f7e324d7a9" + ] + ], + "1": [ + "versions.yml:md5,f71bc54dc512c7e78b0cf5fe7d3f0b05" + ], + "bed": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bed:md5,6158ae22773bda2b1380c1f7e324d7a9" + ] + ], + "versions": [ + "versions.yml:md5,f71bc54dc512c7e78b0cf5fe7d3f0b05" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-06T08:39:21.842028" + }, + "test-goleft-indexsplit-stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bed:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,f71bc54dc512c7e78b0cf5fe7d3f0b05" + ], + "bed": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bed:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,f71bc54dc512c7e78b0cf5fe7d3f0b05" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-06T08:39:26.342137" + } +} \ No newline at end of file diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 41a01d0afde..6943f7e3d72 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -284,9 +284,6 @@ glimpse2/concordance: glnexus: - modules/nf-core/glnexus/** - tests/modules/nf-core/glnexus/** -goleft/indexsplit: - - modules/nf-core/goleft/indexsplit/** - - tests/modules/nf-core/goleft/indexsplit/** gprofiler2/gost: - modules/nf-core/gprofiler2/gost/** - tests/modules/nf-core/gprofiler2/gost/** diff --git a/tests/modules/nf-core/goleft/indexsplit/main.nf b/tests/modules/nf-core/goleft/indexsplit/main.nf deleted file mode 100644 index 30df3304d63..00000000000 --- a/tests/modules/nf-core/goleft/indexsplit/main.nf +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { GOLEFT_INDEXSPLIT } from '../../../../../modules/nf-core/goleft/indexsplit/main.nf' - -workflow test_goleft_indexsplit { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_single_end_sorted_bam_bai'], checkIfExists: true) - ] - - fai = [ - [ id:'sarscov2'], // meta map - file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true) - - ] - - GOLEFT_INDEXSPLIT ( input, fai, 10 ) -} diff --git a/tests/modules/nf-core/goleft/indexsplit/nextflow.config b/tests/modules/nf-core/goleft/indexsplit/nextflow.config deleted file mode 100644 index 8730f1c4b93..00000000000 --- a/tests/modules/nf-core/goleft/indexsplit/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} diff --git a/tests/modules/nf-core/goleft/indexsplit/test.yml b/tests/modules/nf-core/goleft/indexsplit/test.yml deleted file mode 100644 index e089286a932..00000000000 --- a/tests/modules/nf-core/goleft/indexsplit/test.yml +++ /dev/null @@ -1,9 +0,0 @@ -- name: goleft indexsplit test_goleft_indexsplit - command: nextflow run ./tests/modules/nf-core/goleft/indexsplit -entry test_goleft_indexsplit -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/goleft/indexsplit/nextflow.config - tags: - - goleft - - goleft/indexsplit - files: - - path: output/goleft/test.bed - md5sum: 6158ae22773bda2b1380c1f7e324d7a9 - - path: output/goleft/versions.yml