From c1c2a770cfb0bfbf093a2434a27f091ebbc65987 Mon Sep 17 00:00:00 2001 From: Usman Rashid Date: Fri, 23 Aug 2024 21:57:27 +1200 Subject: [PATCH] Added nf-test for rtgtools/pedfilter (#6278) * Added nf-test for rtgtools/pedfilter * Updated power assertions --- modules/nf-core/rtgtools/pedfilter/meta.yml | 2 +- .../rtgtools/pedfilter/tests/main.nf.test | 85 +++++++++++++++++ .../pedfilter/tests/main.nf.test.snap | 91 +++++++++++++++++++ .../rtgtools/pedfilter/tests/nextflow.config | 5 + tests/config/pytest_modules.yml | 3 - .../nf-core/rtgtools/pedfilter/main.nf | 35 ------- .../rtgtools/pedfilter/nextflow.config | 8 -- .../nf-core/rtgtools/pedfilter/test.yml | 29 ------ 8 files changed, 182 insertions(+), 76 deletions(-) create mode 100644 modules/nf-core/rtgtools/pedfilter/tests/main.nf.test create mode 100644 modules/nf-core/rtgtools/pedfilter/tests/main.nf.test.snap create mode 100644 modules/nf-core/rtgtools/pedfilter/tests/nextflow.config delete mode 100644 tests/modules/nf-core/rtgtools/pedfilter/main.nf delete mode 100644 tests/modules/nf-core/rtgtools/pedfilter/nextflow.config delete mode 100644 tests/modules/nf-core/rtgtools/pedfilter/test.yml diff --git a/modules/nf-core/rtgtools/pedfilter/meta.yml b/modules/nf-core/rtgtools/pedfilter/meta.yml index 785ac99040a..4e90fd7bf98 100644 --- a/modules/nf-core/rtgtools/pedfilter/meta.yml +++ b/modules/nf-core/rtgtools/pedfilter/meta.yml @@ -11,7 +11,7 @@ tools: homepage: "https://www.realtimegenomics.com/products/rtg-tools" documentation: "https://github.com/RealTimeGenomics/rtg-tools" tool_dev_url: "https://github.com/RealTimeGenomics/rtg-tools" - licence: "['BSD']" + licence: ["BSD"] input: - meta: type: map diff --git a/modules/nf-core/rtgtools/pedfilter/tests/main.nf.test b/modules/nf-core/rtgtools/pedfilter/tests/main.nf.test new file mode 100644 index 00000000000..0ddcebdbaf7 --- /dev/null +++ b/modules/nf-core/rtgtools/pedfilter/tests/main.nf.test @@ -0,0 +1,85 @@ + +nextflow_process { + + name "Test Process RTGTOOLS_PEDFILTER" + script "../main.nf" + process "RTGTOOLS_PEDFILTER" + + tag "modules" + tag "modules_nfcore" + tag "rtgtools" + tag "rtgtools/pedfilter" + + test("test-rtgtools-pedfilter-ped") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/ped/justhusky.ped', checkIfExists: true) + ] + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("test-rtgtools-pedfilter-vcf") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test_haplotcaller.cnn.vcf.gz', checkIfExists: true) + ] + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("test-rtgtools-pedfilter-vcf-output") { + + config "./nextflow.config" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/ped/justhusky.ped', checkIfExists: true) + ] + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + path(process.out.output[0][1]).linesGzip[3..7], + process.out.versions + ).match() + } + ) + } + } + +} diff --git a/modules/nf-core/rtgtools/pedfilter/tests/main.nf.test.snap b/modules/nf-core/rtgtools/pedfilter/tests/main.nf.test.snap new file mode 100644 index 00000000000..7475fa8b1dd --- /dev/null +++ b/modules/nf-core/rtgtools/pedfilter/tests/main.nf.test.snap @@ -0,0 +1,91 @@ +{ + "test-rtgtools-pedfilter-vcf": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.ped:md5,342135c8bf22e573367b75ef5e1c5e6b" + ] + ], + "1": [ + "versions.yml:md5,036d97d5be26fce2e7d956034b9dc86d" + ], + "output": [ + [ + { + "id": "test", + "single_end": false + }, + "test.ped:md5,342135c8bf22e573367b75ef5e1c5e6b" + ] + ], + "versions": [ + "versions.yml:md5,036d97d5be26fce2e7d956034b9dc86d" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-08-23T16:11:01.797205" + }, + "test-rtgtools-pedfilter-vcf-output": { + "content": [ + [ + "##CL=pedfilter --vcf justhusky.ped", + "##diseased=hugelymodelbat", + "##SAMPLE=", + "##SAMPLE=", + "##SAMPLE=" + ], + [ + "versions.yml:md5,036d97d5be26fce2e7d956034b9dc86d" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-08-23T20:46:00.069224" + }, + "test-rtgtools-pedfilter-ped": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.ped:md5,a8b8f6538e1738d6e06fddfe15d36f09" + ] + ], + "1": [ + "versions.yml:md5,036d97d5be26fce2e7d956034b9dc86d" + ], + "output": [ + [ + { + "id": "test", + "single_end": false + }, + "test.ped:md5,a8b8f6538e1738d6e06fddfe15d36f09" + ] + ], + "versions": [ + "versions.yml:md5,036d97d5be26fce2e7d956034b9dc86d" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-08-23T16:10:53.473351" + } +} \ No newline at end of file diff --git a/modules/nf-core/rtgtools/pedfilter/tests/nextflow.config b/modules/nf-core/rtgtools/pedfilter/tests/nextflow.config new file mode 100644 index 00000000000..a8a3ec54b25 --- /dev/null +++ b/modules/nf-core/rtgtools/pedfilter/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: 'RTGTOOLS_PEDFILTER' { + ext.args = "--vcf" + } +} diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 8aa151c1079..81683a4a8f1 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1241,9 +1241,6 @@ roary: rtgtools/format: - modules/nf-core/rtgtools/format/** - tests/modules/nf-core/rtgtools/format/** -rtgtools/pedfilter: - - modules/nf-core/rtgtools/pedfilter/** - - tests/modules/nf-core/rtgtools/pedfilter/** rtgtools/vcfeval: - modules/nf-core/rtgtools/vcfeval/** - tests/modules/nf-core/rtgtools/vcfeval/** diff --git a/tests/modules/nf-core/rtgtools/pedfilter/main.nf b/tests/modules/nf-core/rtgtools/pedfilter/main.nf deleted file mode 100644 index 81717e832fa..00000000000 --- a/tests/modules/nf-core/rtgtools/pedfilter/main.nf +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { RTGTOOLS_PEDFILTER } from '../../../../../modules/nf-core/rtgtools/pedfilter/main.nf' - -workflow test_rtgtools_pedfilter_ped { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['homo_sapiens']['genome']['justhusky_ped'], checkIfExists: true) - ] - - RTGTOOLS_PEDFILTER ( input ) -} - -workflow test_rtgtools_pedfilter_vcf { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['homo_sapiens']['illumina']['test_haplotc_cnn_vcf_gz'], checkIfExists: true) - ] - - RTGTOOLS_PEDFILTER ( input ) -} - -workflow test_rtgtools_pedfilter_vcf_output { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['homo_sapiens']['genome']['justhusky_ped'], checkIfExists: true) - ] - - RTGTOOLS_PEDFILTER ( input ) -} diff --git a/tests/modules/nf-core/rtgtools/pedfilter/nextflow.config b/tests/modules/nf-core/rtgtools/pedfilter/nextflow.config deleted file mode 100644 index 168fba78e3f..00000000000 --- a/tests/modules/nf-core/rtgtools/pedfilter/nextflow.config +++ /dev/null @@ -1,8 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: "test_rtgtools_pedfilter_vcf_output:RTGTOOLS_PEDFILTER" { - ext.args = "--vcf" - } -} diff --git a/tests/modules/nf-core/rtgtools/pedfilter/test.yml b/tests/modules/nf-core/rtgtools/pedfilter/test.yml deleted file mode 100644 index 197c3b9e067..00000000000 --- a/tests/modules/nf-core/rtgtools/pedfilter/test.yml +++ /dev/null @@ -1,29 +0,0 @@ -- name: rtgtools pedfilter test_rtgtools_pedfilter_ped - command: nextflow run ./tests/modules/nf-core/rtgtools/pedfilter -entry test_rtgtools_pedfilter_ped -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/rtgtools/pedfilter/nextflow.config - tags: - - rtgtools - - rtgtools/pedfilter - files: - - path: output/rtgtools/test.ped - md5sum: a8b8f6538e1738d6e06fddfe15d36f09 - - path: output/rtgtools/versions.yml - -- name: rtgtools pedfilter test_rtgtools_pedfilter_vcf - command: nextflow run ./tests/modules/nf-core/rtgtools/pedfilter -entry test_rtgtools_pedfilter_vcf -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/rtgtools/pedfilter/nextflow.config - tags: - - rtgtools - - rtgtools/pedfilter - files: - - path: output/rtgtools/test.ped - md5sum: 342135c8bf22e573367b75ef5e1c5e6b - - path: output/rtgtools/versions.yml - -- name: rtgtools pedfilter test_rtgtools_pedfilter_vcf_output - command: nextflow run ./tests/modules/nf-core/rtgtools/pedfilter -entry test_rtgtools_pedfilter_vcf_output -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/rtgtools/pedfilter/nextflow.config - tags: - - rtgtools - - rtgtools/pedfilter - files: - - path: output/rtgtools/test.vcf.gz - md5sum: 87116db6265b7ee7214dcc64dcf5a248 - - path: output/rtgtools/versions.yml