From 726c6ad13d03a780cf280d1e30a18102cb4a9495 Mon Sep 17 00:00:00 2001 From: Usman Rashid Date: Mon, 26 Aug 2024 12:19:10 +1200 Subject: [PATCH] Added nf-test for gatk4/gatherpileupsummaries --- .../gatk4/gatherpileupsummaries/main.nf | 2 +- .../gatherpileupsummaries/tests/main.nf.test | 37 +++++++++++++++++++ .../tests/main.nf.test.snap | 37 +++++++++++++++++++ .../tests}/nextflow.config | 3 -- tests/config/pytest_modules.yml | 3 -- .../gatk4/gatherpileupsummaries/main.nf | 18 --------- .../gatk4/gatherpileupsummaries/test.yml | 9 ----- 7 files changed, 75 insertions(+), 34 deletions(-) create mode 100644 modules/nf-core/gatk4/gatherpileupsummaries/tests/main.nf.test create mode 100644 modules/nf-core/gatk4/gatherpileupsummaries/tests/main.nf.test.snap rename {tests/modules/nf-core/gatk4/gatherpileupsummaries => modules/nf-core/gatk4/gatherpileupsummaries/tests}/nextflow.config (51%) delete mode 100644 tests/modules/nf-core/gatk4/gatherpileupsummaries/main.nf delete mode 100644 tests/modules/nf-core/gatk4/gatherpileupsummaries/test.yml diff --git a/modules/nf-core/gatk4/gatherpileupsummaries/main.nf b/modules/nf-core/gatk4/gatherpileupsummaries/main.nf index 561e9bb8b88..c784d59ab26 100644 --- a/modules/nf-core/gatk4/gatherpileupsummaries/main.nf +++ b/modules/nf-core/gatk4/gatherpileupsummaries/main.nf @@ -14,7 +14,7 @@ process GATK4_GATHERPILEUPSUMMARIES { output: tuple val(meta), path("*.pileups.table"), emit: table - path "versions.yml" , emit: versions + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when diff --git a/modules/nf-core/gatk4/gatherpileupsummaries/tests/main.nf.test b/modules/nf-core/gatk4/gatherpileupsummaries/tests/main.nf.test new file mode 100644 index 00000000000..8497e64db37 --- /dev/null +++ b/modules/nf-core/gatk4/gatherpileupsummaries/tests/main.nf.test @@ -0,0 +1,37 @@ + +nextflow_process { + + name "Test Process GATK4_GATHERPILEUPSUMMARIES" + script "../main.nf" + process "GATK4_GATHERPILEUPSUMMARIES" + config "./nextflow.config" + + tag "modules" + tag "modules_nfcore" + tag "gatk4" + tag "gatk4/gatherpileupsummaries" + + test("test-gatk4-gatherpileupsummaries") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/test.pileups.table', checkIfExists: true) ] + ] + input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.dict', checkIfExists: true) + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + +} diff --git a/modules/nf-core/gatk4/gatherpileupsummaries/tests/main.nf.test.snap b/modules/nf-core/gatk4/gatherpileupsummaries/tests/main.nf.test.snap new file mode 100644 index 00000000000..f05a7ef0d11 --- /dev/null +++ b/modules/nf-core/gatk4/gatherpileupsummaries/tests/main.nf.test.snap @@ -0,0 +1,37 @@ +{ + "test-gatk4-gatherpileupsummaries": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.out.pileups.table:md5,8e0ca6f66e112bd2f7ec1d31a2d62469" + ] + ], + "1": [ + "versions.yml:md5,d3772ab0d5963a88a2748fd83af76c02" + ], + "table": [ + [ + { + "id": "test", + "single_end": false + }, + "test.out.pileups.table:md5,8e0ca6f66e112bd2f7ec1d31a2d62469" + ] + ], + "versions": [ + "versions.yml:md5,d3772ab0d5963a88a2748fd83af76c02" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-08-26T12:18:40.835226" + } +} \ No newline at end of file diff --git a/tests/modules/nf-core/gatk4/gatherpileupsummaries/nextflow.config b/modules/nf-core/gatk4/gatherpileupsummaries/tests/nextflow.config similarity index 51% rename from tests/modules/nf-core/gatk4/gatherpileupsummaries/nextflow.config rename to modules/nf-core/gatk4/gatherpileupsummaries/tests/nextflow.config index 48afc706e6c..2b49a6fa39d 100644 --- a/tests/modules/nf-core/gatk4/gatherpileupsummaries/nextflow.config +++ b/modules/nf-core/gatk4/gatherpileupsummaries/tests/nextflow.config @@ -1,7 +1,4 @@ process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - withName: 'GATK4_GATHERPILEUPSUMMARIES' { ext.prefix = { "${meta.id}.out" } } diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 4aea9c2af1e..f7bf4394c60 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -476,9 +476,6 @@ gatk4/filtervarianttranches: gatk4/gatherbqsrreports: - modules/nf-core/gatk4/gatherbqsrreports/** - tests/modules/nf-core/gatk4/gatherbqsrreports/** -gatk4/gatherpileupsummaries: - - modules/nf-core/gatk4/gatherpileupsummaries/** - - tests/modules/nf-core/gatk4/gatherpileupsummaries/** gatk4/genotypegvcfs: - modules/nf-core/gatk4/genotypegvcfs/** - tests/modules/nf-core/gatk4/genotypegvcfs/** diff --git a/tests/modules/nf-core/gatk4/gatherpileupsummaries/main.nf b/tests/modules/nf-core/gatk4/gatherpileupsummaries/main.nf deleted file mode 100644 index a30364439f5..00000000000 --- a/tests/modules/nf-core/gatk4/gatherpileupsummaries/main.nf +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { GATK4_GATHERPILEUPSUMMARIES } from '../../../../../modules/nf-core/gatk4/gatherpileupsummaries/main.nf' - -workflow test_gatk4_gatherpileupsummaries { - - input = [ - [ id:'test', single_end:false ], // meta map - [file(params.test_data['homo_sapiens']['illumina']['test_pileups_table'], checkIfExists: true)] - //file(params.test_data['homo_sapiens']['illumina']['test_pileups_table'], checkIfExists: true)] - ] - - dict = file(params.test_data['homo_sapiens']['genome']['genome_21_dict'], checkIfExists: true) - - GATK4_GATHERPILEUPSUMMARIES ( input, dict ) -} diff --git a/tests/modules/nf-core/gatk4/gatherpileupsummaries/test.yml b/tests/modules/nf-core/gatk4/gatherpileupsummaries/test.yml deleted file mode 100644 index 835d20d2d7d..00000000000 --- a/tests/modules/nf-core/gatk4/gatherpileupsummaries/test.yml +++ /dev/null @@ -1,9 +0,0 @@ -- name: gatk4 gatherpileupsummaries - command: nextflow run ./tests/modules/nf-core/gatk4/gatherpileupsummaries -entry test_gatk4_gatherpileupsummaries -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/gatk4/gatherpileupsummaries/nextflow.config - tags: - - gatk4 - - gatk4/gatherpileupsummaries - files: - - path: output/gatk4/test.out.pileups.table - md5sum: 8e0ca6f66e112bd2f7ec1d31a2d62469 - - path: output/gatk4/versions.yml