From bcf36bc95e3e5605e9859b8e9a49648841e04fe8 Mon Sep 17 00:00:00 2001 From: Felix Lenner <52530259+fellen31@users.noreply.github.com> Date: Thu, 31 Oct 2024 10:01:15 +0100 Subject: [PATCH] Add regions bed and nf-test to glnexus (#6888) Add regions and nf-test to glnexus Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> --- modules/nf-core/glnexus/main.nf | 5 +- modules/nf-core/glnexus/meta.yml | 9 ++ modules/nf-core/glnexus/tests/main.nf.test | 97 +++++++++++++++++ .../nf-core/glnexus/tests/main.nf.test.snap | 101 ++++++++++++++++++ tests/config/pytest_modules.yml | 3 - tests/modules/nf-core/glnexus/main.nf | 17 --- tests/modules/nf-core/glnexus/nextflow.config | 5 - tests/modules/nf-core/glnexus/test.yml | 7 -- 8 files changed, 211 insertions(+), 33 deletions(-) create mode 100644 modules/nf-core/glnexus/tests/main.nf.test create mode 100644 modules/nf-core/glnexus/tests/main.nf.test.snap delete mode 100644 tests/modules/nf-core/glnexus/main.nf delete mode 100644 tests/modules/nf-core/glnexus/nextflow.config delete mode 100644 tests/modules/nf-core/glnexus/test.yml diff --git a/modules/nf-core/glnexus/main.nf b/modules/nf-core/glnexus/main.nf index eb86b9b8d9c..191f04995df 100644 --- a/modules/nf-core/glnexus/main.nf +++ b/modules/nf-core/glnexus/main.nf @@ -1,6 +1,6 @@ process GLNEXUS { tag "$meta.id" - label 'process_medium' + label 'process_high' conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? @@ -9,6 +9,7 @@ process GLNEXUS { input: tuple val(meta), path(gvcfs) + tuple val(meta2), path(bed) output: tuple val(meta), path("*.bcf"), emit: bcf @@ -20,6 +21,7 @@ process GLNEXUS { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def regions = bed ? "--bed ${bed}" : "" // Make list of GVCFs to merge def input = gvcfs.collect { it.toString() } @@ -33,6 +35,7 @@ process GLNEXUS { glnexus_cli \\ --threads $task.cpus \\ --mem-gbytes $avail_mem \\ + $regions \\ $args \\ ${input.join(' ')} \\ > ${prefix}.bcf diff --git a/modules/nf-core/glnexus/meta.yml b/modules/nf-core/glnexus/meta.yml index a79fc63cff3..8f18bf3f871 100644 --- a/modules/nf-core/glnexus/meta.yml +++ b/modules/nf-core/glnexus/meta.yml @@ -23,6 +23,15 @@ input: type: list description: Input genomic vcf files pattern: "*.{gvcf,gvcf.gz,g.vcf,g.vcf.gz}" + - - meta2: + type: map + description: | + Groovy Map containing regions information + e.g. [ id:'test' ] + - bed: + type: list + description: Input BED file + pattern: "*.bed" output: - bcf: - meta: diff --git a/modules/nf-core/glnexus/tests/main.nf.test b/modules/nf-core/glnexus/tests/main.nf.test new file mode 100644 index 00000000000..79f7adc868d --- /dev/null +++ b/modules/nf-core/glnexus/tests/main.nf.test @@ -0,0 +1,97 @@ +nextflow_process { + + name "Test Process GLNEXUS" + script "../main.nf" + process "GLNEXUS" + + tag "modules" + tag "modules_nfcore" + tag "glnexus" + + test("vcfs, []") { + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test' ], + [ + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test2.genome.vcf.gz', checkIfExists: true), + ] + ]) + input[1] = [[],[]] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("vcfs, bed") { + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test' ], + [ + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test2.genome.vcf.gz', checkIfExists: true), + ] + ]) + input[1] = [ + [ id:'region' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.bed', checkIfExists: true), + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("vcfs, bed - stub") { + + options "-stub" + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test' ], + [ + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test2.genome.vcf.gz', checkIfExists: true), + ] + ]) + input[1] = [ + [ id:'region' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.bed', checkIfExists: true), + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/glnexus/tests/main.nf.test.snap b/modules/nf-core/glnexus/tests/main.nf.test.snap new file mode 100644 index 00000000000..3d2e13f09d9 --- /dev/null +++ b/modules/nf-core/glnexus/tests/main.nf.test.snap @@ -0,0 +1,101 @@ +{ + "vcfs, bed - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.bcf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,dfeeb7f12f37cbef54a798614b83ffb0" + ], + "bcf": [ + [ + { + "id": "test" + }, + "test.bcf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,dfeeb7f12f37cbef54a798614b83ffb0" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-29T12:17:01.253378301" + }, + "vcfs, bed": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.bcf:md5,62b2cea9c1b92ac63645cb031eea46fc" + ] + ], + "1": [ + "versions.yml:md5,dfeeb7f12f37cbef54a798614b83ffb0" + ], + "bcf": [ + [ + { + "id": "test" + }, + "test.bcf:md5,62b2cea9c1b92ac63645cb031eea46fc" + ] + ], + "versions": [ + "versions.yml:md5,dfeeb7f12f37cbef54a798614b83ffb0" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-29T12:16:53.859544065" + }, + "vcfs, []": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.bcf:md5,62b2cea9c1b92ac63645cb031eea46fc" + ] + ], + "1": [ + "versions.yml:md5,dfeeb7f12f37cbef54a798614b83ffb0" + ], + "bcf": [ + [ + { + "id": "test" + }, + "test.bcf:md5,62b2cea9c1b92ac63645cb031eea46fc" + ] + ], + "versions": [ + "versions.yml:md5,dfeeb7f12f37cbef54a798614b83ffb0" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-29T12:13:03.068397129" + } +} \ No newline at end of file diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 0bf3c88fbc6..832f747e594 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -263,9 +263,6 @@ gfastats: gget/gget: - modules/nf-core/gget/gget/** - tests/modules/nf-core/gget/gget/** -glnexus: - - modules/nf-core/glnexus/** - - tests/modules/nf-core/glnexus/** gprofiler2/gost: - modules/nf-core/gprofiler2/gost/** - tests/modules/nf-core/gprofiler2/gost/** diff --git a/tests/modules/nf-core/glnexus/main.nf b/tests/modules/nf-core/glnexus/main.nf deleted file mode 100644 index 86debecc4ab..00000000000 --- a/tests/modules/nf-core/glnexus/main.nf +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { GLNEXUS } from '../../../../modules/nf-core/glnexus/main.nf' - -workflow test_glnexus { - input = [ - [ id:'test' ], // meta map - [ - file(params.test_data['homo_sapiens']['illumina']['test_genome_vcf_gz'], checkIfExists: true), - file(params.test_data['homo_sapiens']['illumina']['test2_genome_vcf_gz'], checkIfExists: true) - ] - ] - - GLNEXUS ( input ) -} diff --git a/tests/modules/nf-core/glnexus/nextflow.config b/tests/modules/nf-core/glnexus/nextflow.config deleted file mode 100644 index 8730f1c4b93..00000000000 --- a/tests/modules/nf-core/glnexus/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/glnexus/test.yml b/tests/modules/nf-core/glnexus/test.yml deleted file mode 100644 index b8ed6751541..00000000000 --- a/tests/modules/nf-core/glnexus/test.yml +++ /dev/null @@ -1,7 +0,0 @@ -- name: glnexus test_glnexus - command: nextflow run ./tests/modules/nf-core/glnexus -entry test_glnexus -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/glnexus/nextflow.config - tags: - - glnexus - files: - - path: output/glnexus/test.bcf - md5sum: 62b2cea9c1b92ac63645cb031eea46fc