From b7adbf00b9bd3c1715963f909371002a9d2c091b Mon Sep 17 00:00:00 2001 From: Usman Rashid Date: Tue, 27 Aug 2024 12:10:02 +1200 Subject: [PATCH] Added nf-test for survivor/merge --- modules/nf-core/survivor/merge/meta.yml | 4 +- .../nf-core/survivor/merge/tests/main.nf.test | 79 +++++++++++++++++++ .../survivor/merge/tests/main.nf.test.snap | 50 ++++++++++++ tests/config/pytest_modules.yml | 3 - tests/modules/nf-core/survivor/merge/main.nf | 26 ------ .../nf-core/survivor/merge/nextflow.config | 5 -- tests/modules/nf-core/survivor/merge/test.yml | 11 --- 7 files changed, 131 insertions(+), 47 deletions(-) create mode 100644 modules/nf-core/survivor/merge/tests/main.nf.test create mode 100644 modules/nf-core/survivor/merge/tests/main.nf.test.snap delete mode 100644 tests/modules/nf-core/survivor/merge/main.nf delete mode 100644 tests/modules/nf-core/survivor/merge/nextflow.config delete mode 100644 tests/modules/nf-core/survivor/merge/test.yml diff --git a/modules/nf-core/survivor/merge/meta.yml b/modules/nf-core/survivor/merge/meta.yml index a7c2e2b3b98..529e9175dde 100644 --- a/modules/nf-core/survivor/merge/meta.yml +++ b/modules/nf-core/survivor/merge/meta.yml @@ -12,7 +12,7 @@ tools: documentation: "https://github.com/fritzsedlazeck/SURVIVOR/wiki" tool_dev_url: "https://github.com/fritzsedlazeck/SURVIVOR" doi: "10.1038/NCOMMS14061" - licence: "['MIT']" + licence: ["MIT"] input: - meta: type: map @@ -20,7 +20,7 @@ input: Groovy Map containing sample information e.g. [ id:'test', single_end:false ] - vcfs: - type: files + type: list description: | The VCF files to be merged Gzipped VCF files are not supported: https://github.com/fritzsedlazeck/SURVIVOR/issues/158 diff --git a/modules/nf-core/survivor/merge/tests/main.nf.test b/modules/nf-core/survivor/merge/tests/main.nf.test new file mode 100644 index 00000000000..6ec81edeb41 --- /dev/null +++ b/modules/nf-core/survivor/merge/tests/main.nf.test @@ -0,0 +1,79 @@ + +nextflow_process { + + name "Test Process SURVIVOR_MERGE" + script "../main.nf" + process "SURVIVOR_MERGE" + + tag "modules" + tag "modules_nfcore" + tag "survivor" + tag "survivor/merge" + + test("test-survivor-merge") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test2.genome.vcf', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf', checkIfExists: true) + ] + ] + input[1] = 0.2 + input[2] = 1 + input[3] = 0 + input[4] = 0 + input[5] = 0 + input[6] = 20 + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + path(process.out.vcf[0][1]).vcf.summary, + process.out.versions + ).match() + } + ) + } + } + + test("test-survivor-merge-stub") { + options '-stub' + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test2.genome.vcf', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf', checkIfExists: true) + ] + ] + input[1] = 0.2 + input[2] = 1 + input[3] = 0 + input[4] = 0 + input[5] = 0 + input[6] = 20 + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + +} diff --git a/modules/nf-core/survivor/merge/tests/main.nf.test.snap b/modules/nf-core/survivor/merge/tests/main.nf.test.snap new file mode 100644 index 00000000000..087faea29ce --- /dev/null +++ b/modules/nf-core/survivor/merge/tests/main.nf.test.snap @@ -0,0 +1,50 @@ +{ + "test-survivor-merge": { + "content": [ + "VcfFile [chromosomes=[], sampleCount=2, variantCount=0, phased=true, phasedAutodetect=true]", + [ + "versions.yml:md5,ed584c94eb1af847390f47ab2ab32726" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-08-27T12:08:46.453672" + }, + "test-survivor-merge-stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.vcf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,ed584c94eb1af847390f47ab2ab32726" + ], + "vcf": [ + [ + { + "id": "test", + "single_end": false + }, + "test.vcf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,ed584c94eb1af847390f47ab2ab32726" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-08-27T12:07:10.999159" + } +} \ No newline at end of file diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 8384aafa635..b2d001bf1a2 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1278,9 +1278,6 @@ subworkflows/vcf_phase_shapeit5: survivor/filter: - modules/nf-core/survivor/filter/** - tests/modules/nf-core/survivor/filter/** -survivor/merge: - - modules/nf-core/survivor/merge/** - - tests/modules/nf-core/survivor/merge/** survivor/simsv: - modules/nf-core/survivor/simsv/** - tests/modules/nf-core/survivor/simsv/** diff --git a/tests/modules/nf-core/survivor/merge/main.nf b/tests/modules/nf-core/survivor/merge/main.nf deleted file mode 100644 index c1e7b7c4353..00000000000 --- a/tests/modules/nf-core/survivor/merge/main.nf +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { SURVIVOR_MERGE } from '../../../../../modules/nf-core/survivor/merge/main.nf' - -workflow test_survivor_merge { - - input = [ - [ id:'test', single_end:false ], // meta map - [ - file(params.test_data['homo_sapiens']['illumina']['test2_genome_vcf'], checkIfExists: true), - file(params.test_data['homo_sapiens']['illumina']['test_genome_vcf'], checkIfExists: true) - ] - ] - - SURVIVOR_MERGE ( - input, - 0.2, - 1, - 0, - 0, - 0, - 20 - ) -} diff --git a/tests/modules/nf-core/survivor/merge/nextflow.config b/tests/modules/nf-core/survivor/merge/nextflow.config deleted file mode 100644 index 8730f1c4b93..00000000000 --- a/tests/modules/nf-core/survivor/merge/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/survivor/merge/test.yml b/tests/modules/nf-core/survivor/merge/test.yml deleted file mode 100644 index 2ad3170cb07..00000000000 --- a/tests/modules/nf-core/survivor/merge/test.yml +++ /dev/null @@ -1,11 +0,0 @@ -- name: survivor merge test_survivor_merge - command: nextflow run ./tests/modules/nf-core/survivor/merge -entry test_survivor_merge -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/survivor/merge/nextflow.config - tags: - - survivor - - survivor/merge - files: - - path: output/survivor/test.vcf - contains: - - "##fileformat=VCFv4.1" - - "##source=SURVIVOR" - - path: output/survivor/versions.yml