From 79d27030d30724e9a2ad1c6d2b981f146d634957 Mon Sep 17 00:00:00 2001 From: Matthias De Smet <11850640+matthdsm@users.noreply.github.com> Date: Thu, 15 Feb 2024 08:44:02 +0100 Subject: [PATCH] move gatk4/mergevcfs to nf-test (#4913) * move gatk4/mergevcfs to nf-test * Update modules/nf-core/gatk4/mergevcfs/tests/main.nf.test Co-authored-by: Nicolas Vannieuwkerke <101190534+nvnieuwk@users.noreply.github.com> * Update modules/nf-core/gatk4/mergevcfs/tests/main.nf.test Co-authored-by: Nicolas Vannieuwkerke <101190534+nvnieuwk@users.noreply.github.com> * fix tests * Delete modules/nf-core/gatk4/mergevcfs/tests/nextflow.config --------- Co-authored-by: Nicolas Vannieuwkerke <101190534+nvnieuwk@users.noreply.github.com> --- modules/nf-core/gatk4/mergevcfs/meta.yml | 2 +- .../gatk4/mergevcfs/tests/main.nf.test | 87 +++++++++++++++++++ .../gatk4/mergevcfs/tests/main.nf.test.snap | 35 ++++++++ .../nf-core/gatk4/mergevcfs/tests/tags.yml | 2 + tests/config/pytest_modules.yml | 3 - tests/modules/nf-core/gatk4/mergevcfs/main.nf | 34 -------- .../nf-core/gatk4/mergevcfs/nextflow.config | 5 -- .../modules/nf-core/gatk4/mergevcfs/test.yml | 32 ------- 8 files changed, 125 insertions(+), 75 deletions(-) create mode 100644 modules/nf-core/gatk4/mergevcfs/tests/main.nf.test create mode 100644 modules/nf-core/gatk4/mergevcfs/tests/main.nf.test.snap create mode 100644 modules/nf-core/gatk4/mergevcfs/tests/tags.yml delete mode 100644 tests/modules/nf-core/gatk4/mergevcfs/main.nf delete mode 100644 tests/modules/nf-core/gatk4/mergevcfs/nextflow.config delete mode 100644 tests/modules/nf-core/gatk4/mergevcfs/test.yml diff --git a/modules/nf-core/gatk4/mergevcfs/meta.yml b/modules/nf-core/gatk4/mergevcfs/meta.yml index 30290a854f36..996053fcc617 100644 --- a/modules/nf-core/gatk4/mergevcfs/meta.yml +++ b/modules/nf-core/gatk4/mergevcfs/meta.yml @@ -29,7 +29,7 @@ input: description: | Groovy Map containing reference information e.g. [ id:'genome'] - - ref_dict: + - dict: type: file description: Optional Sequence Dictionary as input pattern: "*.dict" diff --git a/modules/nf-core/gatk4/mergevcfs/tests/main.nf.test b/modules/nf-core/gatk4/mergevcfs/tests/main.nf.test new file mode 100644 index 000000000000..e0237cfaed87 --- /dev/null +++ b/modules/nf-core/gatk4/mergevcfs/tests/main.nf.test @@ -0,0 +1,87 @@ +nextflow_process { + + name "Test Process GATK4_MERGEVCFS" + script "../main.nf" + process "GATK4_MERGEVCFS" + + tag "modules" + tag "modules_nfcore" + tag "gatk4" + tag "gatk4/mergevcfs" + + test("test_gatk4_mergevcfs") { + when { + process { + """ + input[0] = [ [ id:'test' ], [ file(params.test_data['homo_sapiens']['genome']['dbsnp_146_hg38_vcf_gz'], checkIfExists: true), file(params.test_data['homo_sapiens']['genome']['gnomad_r2_1_1_vcf_gz'], checkIfExists: true) ]] + input[1] = [ [], file(params.test_data['homo_sapiens']['genome']['genome_dict'], checkIfExists: true)] + """ + } + } + + then { + assertAll( + { assert process.success }, + { + assert snapshot( + file(process.out.vcf.get(0).get(1)).name, + file(process.out.tbi.get(0).get(1)).name + ).match("test_gatk4_mergevcfs") + }, + ) + } + + } + + test("test_gatk4_mergevcfs_no_dict") { + when { + process { + """ + input[0] = [ [ id:'test' ], [ file(params.test_data['homo_sapiens']['genome']['dbsnp_146_hg38_vcf_gz'], checkIfExists: true), file(params.test_data['homo_sapiens']['genome']['gnomad_r2_1_1_vcf_gz'], checkIfExists: true) ]] + input[1] = [ [],[]] + """ + } + } + + then { + assertAll( + { assert process.success }, + { + assert snapshot( + file(process.out.vcf.get(0).get(1)).name, + file(process.out.tbi.get(0).get(1)).name + ).match("test_gatk4_mergevcfs_no_dict") + }, + ) + } + + } + + test("test_gatk4_mergevcfs_no_dict_stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ [ id:'test' ], [ file(params.test_data['homo_sapiens']['genome']['dbsnp_146_hg38_vcf_gz'], checkIfExists: true), file(params.test_data['homo_sapiens']['genome']['gnomad_r2_1_1_vcf_gz'], checkIfExists: true) ]] + input[1] = [ [],[]] + """ + } + } + + then { + assertAll( + { assert process.success }, + { + assert snapshot( + file(process.out.vcf.get(0).get(1)).name, + file(process.out.tbi.get(0).get(1)).name + ).match("test_gatk4_mergevcfs_no_dict_stub") + }, + ) + } + + } + +} diff --git a/modules/nf-core/gatk4/mergevcfs/tests/main.nf.test.snap b/modules/nf-core/gatk4/mergevcfs/tests/main.nf.test.snap new file mode 100644 index 000000000000..62cceed57bf3 --- /dev/null +++ b/modules/nf-core/gatk4/mergevcfs/tests/main.nf.test.snap @@ -0,0 +1,35 @@ +{ + "test_gatk4_mergevcfs_no_dict_stub": { + "content": [ + "test.vcf.gz", + "test.vcf.gz.tbi" + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-14T14:57:40.784590995" + }, + "test_gatk4_mergevcfs": { + "content": [ + "test.vcf.gz", + "test.vcf.gz.tbi" + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-14T14:56:42.178255913" + }, + "test_gatk4_mergevcfs_no_dict": { + "content": [ + "test.vcf.gz", + "test.vcf.gz.tbi" + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-02-14T14:57:11.404322124" + } +} \ No newline at end of file diff --git a/modules/nf-core/gatk4/mergevcfs/tests/tags.yml b/modules/nf-core/gatk4/mergevcfs/tests/tags.yml new file mode 100644 index 000000000000..d2a74ba2c9d0 --- /dev/null +++ b/modules/nf-core/gatk4/mergevcfs/tests/tags.yml @@ -0,0 +1,2 @@ +gatk4/mergevcfs: + - "modules/nf-core/gatk4/mergevcfs/**" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 3d2b03595d59..b0a463a95963 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -822,9 +822,6 @@ gatk4/mergebamalignment: gatk4/mergemutectstats: - modules/nf-core/gatk4/mergemutectstats/** - tests/modules/nf-core/gatk4/mergemutectstats/** -gatk4/mergevcfs: - - modules/nf-core/gatk4/mergevcfs/** - - tests/modules/nf-core/gatk4/mergevcfs/** gatk4/mutect2: - modules/nf-core/gatk4/mutect2/** - tests/modules/nf-core/gatk4/mutect2/** diff --git a/tests/modules/nf-core/gatk4/mergevcfs/main.nf b/tests/modules/nf-core/gatk4/mergevcfs/main.nf deleted file mode 100644 index 88f98a62165b..000000000000 --- a/tests/modules/nf-core/gatk4/mergevcfs/main.nf +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { GATK4_MERGEVCFS } from '../../../../../modules/nf-core/gatk4/mergevcfs/main.nf' - -workflow test_gatk4_mergevcfs { - input = [ [ id:'test' ], // meta map - [ file(params.test_data['homo_sapiens']['genome']['dbsnp_146_hg38_vcf_gz'], checkIfExists: true), - file(params.test_data['homo_sapiens']['genome']['gnomad_r2_1_1_vcf_gz'], checkIfExists: true) ] - ] - - dict = [ [id:'dict'], file(params.test_data['homo_sapiens']['genome']['genome_dict'], checkIfExists: true)] - - GATK4_MERGEVCFS ( input, dict ) -} - -workflow test_gatk4_mergevcfs_no_dict { - input = [ [ id:'test' ], // meta map - [ file(params.test_data['homo_sapiens']['genome']['dbsnp_146_hg38_vcf_gz'], checkIfExists: true), - file(params.test_data['homo_sapiens']['genome']['gnomad_r2_1_1_vcf_gz'], checkIfExists: true) ] - ] - - GATK4_MERGEVCFS ( input, [[id:'genome'],[]] ) -} - -workflow test_gatk4_mergevcfs_no_dict_stubs { - input = [ [ id:'test' ], // meta map - [ file(params.test_data['homo_sapiens']['genome']['dbsnp_146_hg38_vcf_gz'], checkIfExists: true), - file(params.test_data['homo_sapiens']['genome']['gnomad_r2_1_1_vcf_gz'], checkIfExists: true) ] - ] - - GATK4_MERGEVCFS ( input, [[id:'genome'],[]] ) -} diff --git a/tests/modules/nf-core/gatk4/mergevcfs/nextflow.config b/tests/modules/nf-core/gatk4/mergevcfs/nextflow.config deleted file mode 100644 index 8730f1c4b930..000000000000 --- a/tests/modules/nf-core/gatk4/mergevcfs/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/gatk4/mergevcfs/test.yml b/tests/modules/nf-core/gatk4/mergevcfs/test.yml deleted file mode 100644 index 1907396ded40..000000000000 --- a/tests/modules/nf-core/gatk4/mergevcfs/test.yml +++ /dev/null @@ -1,32 +0,0 @@ -- name: gatk4 mergevcfs test_gatk4_mergevcfs - command: nextflow run ./tests/modules/nf-core/gatk4/mergevcfs -entry test_gatk4_mergevcfs -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/gatk4/mergevcfs/nextflow.config - tags: - - gatk4/mergevcfs - - gatk4 - files: - - path: output/gatk4/test.vcf.gz - md5sum: cfc515bf5631629504ffe349aa37fcc9 - - path: output/gatk4/test.vcf.gz.tbi - md5sum: 7b0508f89cdab07a4509ad7c2db3d942 - -- name: gatk4 mergevcfs test_gatk4_mergevcfs_no_dict - command: nextflow run ./tests/modules/nf-core/gatk4/mergevcfs -entry test_gatk4_mergevcfs_no_dict -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/gatk4/mergevcfs/nextflow.config - tags: - - gatk4/mergevcfs - - gatk4 - files: - - path: output/gatk4/test.vcf.gz - md5sum: cfc515bf5631629504ffe349aa37fcc9 - - path: output/gatk4/test.vcf.gz.tbi - md5sum: 7b0508f89cdab07a4509ad7c2db3d942 - -- name: gatk4 mergevcfs test_gatk4_mergevcfs_no_dict_stubs - command: nextflow run ./tests/modules/nf-core/gatk4/mergevcfs -entry test_gatk4_mergevcfs_no_dict_stubs -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/gatk4/mergevcfs/nextflow.config - tags: - - gatk4/mergevcfs - - gatk4 - files: - - path: output/gatk4/test.vcf.gz - md5sum: cfc515bf5631629504ffe349aa37fcc9 - - path: output/gatk4/test.vcf.gz.tbi - md5sum: 7b0508f89cdab07a4509ad7c2db3d942