From fa12139827a18b324bd63fce654818586a8e9cc7 Mon Sep 17 00:00:00 2001 From: Louis LE NEZET <58640615+LouisLeNezet@users.noreply.github.com> Date: Wed, 13 Mar 2024 15:12:15 +0100 Subject: [PATCH] Glimpse2 splitreference: Change python test to nf-test (#5076) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Glimpse2 splitreference: Change python test to nf-test * Update modules/nf-core/glimpse2/splitreference/tests/main.nf.test Co-authored-by: Maxime U Garcia * Update modules/nf-core/glimpse2/splitreference/tests/main.nf.test Co-authored-by: Maxime U Garcia * Update modules/nf-core/glimpse2/splitreference/tests/main.nf.test Co-authored-by: Maxime U Garcia * Update main.nf.test * Update modules/nf-core/glimpse2/splitreference/tests/nextflow.config Co-authored-by: Maxime U Garcia * Update modules/nf-core/glimpse2/splitreference/tests/main.nf.test Co-authored-by: Maxime U Garcia * Update modules/nf-core/glimpse2/splitreference/tests/main.nf.test Co-authored-by: Maxime U Garcia * Update modules/nf-core/glimpse2/splitreference/meta.yml Co-authored-by: Matthias Hörtenhuber * Update snapshot with version file --------- Co-authored-by: LouisLeNezet Co-authored-by: Maxime U Garcia Co-authored-by: Matthias Hörtenhuber --- .../nf-core/glimpse2/splitreference/meta.yml | 8 ++- .../splitreference/tests/main.nf.test | 70 +++++++++++++++++++ .../splitreference/tests/main.nf.test.snap | 18 +++++ .../splitreference/tests}/nextflow.config | 2 - .../glimpse2/splitreference/tests/tags.yml | 2 + tests/config/pytest_modules.yml | 3 - .../nf-core/glimpse2/splitreference/main.nf | 26 ------- .../nf-core/glimpse2/splitreference/test.yml | 17 ----- 8 files changed, 97 insertions(+), 49 deletions(-) create mode 100644 modules/nf-core/glimpse2/splitreference/tests/main.nf.test create mode 100644 modules/nf-core/glimpse2/splitreference/tests/main.nf.test.snap rename {tests/modules/nf-core/glimpse2/splitreference => modules/nf-core/glimpse2/splitreference/tests}/nextflow.config (65%) create mode 100644 modules/nf-core/glimpse2/splitreference/tests/tags.yml delete mode 100644 tests/modules/nf-core/glimpse2/splitreference/main.nf delete mode 100644 tests/modules/nf-core/glimpse2/splitreference/test.yml diff --git a/modules/nf-core/glimpse2/splitreference/meta.yml b/modules/nf-core/glimpse2/splitreference/meta.yml index d70f3505874..c70ec024f76 100644 --- a/modules/nf-core/glimpse2/splitreference/meta.yml +++ b/modules/nf-core/glimpse2/splitreference/meta.yml @@ -4,6 +4,7 @@ keywords: - split - reference - phasing + - imputation tools: - "glimpse2": description: "GLIMPSE2 is a phasing and imputation method for large-scale low-coverage sequencing studies." @@ -11,7 +12,7 @@ tools: documentation: "https://odelaneau.github.io/GLIMPSE/commands.html" tool_dev_url: "https://github.com/odelaneau/GLIMPSE" doi: "10.1038/s41588-020-00756-0" - licence: "['MIT']" + licence: ["MIT"] requirements: - AVX2 input: @@ -36,6 +37,11 @@ input: type: string description: Target imputed region, excluding left and right buffers (e.g. chr20:1000000-2000000). pattern: "chrXX:leftBufferPosition-rightBufferPosition" + - meta2: + type: map + description: | + Groovy Map containing genomic map information + e.g. `[ map:'GRCh38' ]` - map: type: file description: File containing the genetic map. diff --git a/modules/nf-core/glimpse2/splitreference/tests/main.nf.test b/modules/nf-core/glimpse2/splitreference/tests/main.nf.test new file mode 100644 index 00000000000..be55b4c762c --- /dev/null +++ b/modules/nf-core/glimpse2/splitreference/tests/main.nf.test @@ -0,0 +1,70 @@ +nextflow_process { + + name "Test Process GLIMPSE2_SPLITREFERENCE" + script "../main.nf" + config "./nextflow.config" + + process "GLIMPSE2_SPLITREFERENCE" + + tag "modules_nfcore" + tag "modules" + tag "glimpse2" + tag "glimpse2/splitreference" + + test("Should run without map") { + + when { + process { + """ + input[0] = [ + [ id:'ref1000GP', single_end:false ], // meta map + file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), + file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true), + "chr21:16600000-16800000", + "chr21:16600000-16800000" + ] + input[1]= [[ id:'map'],[]] + """ + } + } + + then { + assertAll( + { assert process.success }, + // File has a timestamp in it and is in binary format, so we can only check the name + { assert file(process.out.bin_ref[0][1]).name == "ref1000GP_chr21_16600000_16800000.bin" }, + { assert snapshot(process.out.version).match()} + ) + } + + } + + test("Should run with map") { + + when { + process { + """ + input[0] = [ + [ id:'ref1000GP', single_end:false ], // meta map + file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), + file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true), + "chr21:16600000-16800000", + "chr21:16600000-16800000" + ] + input[1]= [[ id:'map'], file(params.modules_testdata_base_path + "delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true)] + """ + } + } + + then { + assertAll( + { assert process.success }, + // File has a timestamp in it and is in binary format, so we can only check the name + { assert file(process.out.bin_ref[0][1]).name == "ref1000GP_chr21_16600000_16800000.bin" }, + { assert snapshot(process.out.version).match()} + ) + } + + } + +} diff --git a/modules/nf-core/glimpse2/splitreference/tests/main.nf.test.snap b/modules/nf-core/glimpse2/splitreference/tests/main.nf.test.snap new file mode 100644 index 00000000000..6e6d64ca2b0 --- /dev/null +++ b/modules/nf-core/glimpse2/splitreference/tests/main.nf.test.snap @@ -0,0 +1,18 @@ +{ + "Should run without map": { + "content": null, + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-13T14:52:00.115502" + }, + "Should run with map": { + "content": null, + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-13T14:52:08.29561" + } +} \ No newline at end of file diff --git a/tests/modules/nf-core/glimpse2/splitreference/nextflow.config b/modules/nf-core/glimpse2/splitreference/tests/nextflow.config similarity index 65% rename from tests/modules/nf-core/glimpse2/splitreference/nextflow.config rename to modules/nf-core/glimpse2/splitreference/tests/nextflow.config index 58daabf6ab2..4d6152a8123 100644 --- a/tests/modules/nf-core/glimpse2/splitreference/nextflow.config +++ b/modules/nf-core/glimpse2/splitreference/tests/nextflow.config @@ -6,6 +6,4 @@ process { ].join(' ') ext.prefix = { "${meta.id}" } } - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - } \ No newline at end of file diff --git a/modules/nf-core/glimpse2/splitreference/tests/tags.yml b/modules/nf-core/glimpse2/splitreference/tests/tags.yml new file mode 100644 index 00000000000..ce5545c5388 --- /dev/null +++ b/modules/nf-core/glimpse2/splitreference/tests/tags.yml @@ -0,0 +1,2 @@ +glimpse2/splitreference: + - modules/nf-core/glimpse2/splitreference/** diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index be652c8c37a..b943c65f695 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -914,9 +914,6 @@ glimpse2/concordance: glimpse2/ligate: - modules/nf-core/glimpse2/ligate/** - tests/modules/nf-core/glimpse2/ligate/** -glimpse2/splitreference: - - modules/nf-core/glimpse2/splitreference/** - - tests/modules/nf-core/glimpse2/splitreference/** glnexus: - modules/nf-core/glnexus/** - tests/modules/nf-core/glnexus/** diff --git a/tests/modules/nf-core/glimpse2/splitreference/main.nf b/tests/modules/nf-core/glimpse2/splitreference/main.nf deleted file mode 100644 index 86bdcba94a7..00000000000 --- a/tests/modules/nf-core/glimpse2/splitreference/main.nf +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { GLIMPSE2_SPLITREFERENCE } from '../../../../../modules/nf-core/glimpse2/splitreference/main.nf' - -workflow test_glimpse2_splitreference_without_map { - input = [ - [ id:'ref1000GP', single_end:false ], // meta map - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true), - "chr21:16600000-16800000", - "chr21:16600000-16800000"] - GLIMPSE2_SPLITREFERENCE (input, [[],[]]) -} -workflow test_glimpse2_splitreference_with_map { - input = [ - [ id:'ref1000GP', single_end:false ], // meta map - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true), - "chr21:16600000-16800000", - "chr21:16600000-16800000"] - map = [[ id:'map'], - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true)] - GLIMPSE2_SPLITREFERENCE (input, map) -} \ No newline at end of file diff --git a/tests/modules/nf-core/glimpse2/splitreference/test.yml b/tests/modules/nf-core/glimpse2/splitreference/test.yml deleted file mode 100644 index 2f76676bfa7..00000000000 --- a/tests/modules/nf-core/glimpse2/splitreference/test.yml +++ /dev/null @@ -1,17 +0,0 @@ -- name: glimpse2 splitreference test_glimpse2_splitreference_without_map - command: nextflow run ./tests/modules/nf-core/glimpse2/splitreference -entry test_glimpse2_splitreference_without_map -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/glimpse2/splitreference/nextflow.config - tags: - - glimpse2/splitreference - - glimpse2 - files: - - path: output/glimpse2/ref1000GP_chr21_16600000_16800000.bin - - path: output/glimpse2/versions.yml - -- name: glimpse2 splitreference test_glimpse2_splitreference_with_map - command: nextflow run ./tests/modules/nf-core/glimpse2/splitreference -entry test_glimpse2_splitreference_with_map -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/glimpse2/splitreference/nextflow.config - tags: - - glimpse2/splitreference - - glimpse2 - files: - - path: output/glimpse2/ref1000GP_chr21_16600000_16800000.bin - - path: output/glimpse2/versions.yml