From 874e8c530a49745de91133094237f0ec101f66d5 Mon Sep 17 00:00:00 2001 From: Simon Pearce <24893913+SPPearce@users.noreply.github.com> Date: Tue, 22 Oct 2024 13:12:23 +0000 Subject: [PATCH 1/3] Swap verifybamid2 to nf-test --- .../verifybamid2/tests/main.nf.test | 100 ++++++++++++++++++ .../verifybamid2/tests/main.nf.test.snap | 45 ++++++++ .../verifybamid2/tests/nextflow.config | 5 + tests/config/pytest_modules.yml | 3 - .../nf-core/verifybamid/verifybamid2/main.nf | 59 ----------- .../verifybamid/verifybamid2/nextflow.config | 34 ------ .../nf-core/verifybamid/verifybamid2/test.yml | 31 ------ 7 files changed, 150 insertions(+), 127 deletions(-) create mode 100644 modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test create mode 100644 modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test.snap create mode 100644 modules/nf-core/verifybamid/verifybamid2/tests/nextflow.config delete mode 100644 tests/modules/nf-core/verifybamid/verifybamid2/main.nf delete mode 100644 tests/modules/nf-core/verifybamid/verifybamid2/nextflow.config delete mode 100644 tests/modules/nf-core/verifybamid/verifybamid2/test.yml diff --git a/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test b/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test new file mode 100644 index 00000000000..3fe531fe65b --- /dev/null +++ b/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test @@ -0,0 +1,100 @@ +nextflow_process { + + name "Test Process VERIFYBAMID_VERIFYBAMID2" + script "../main.nf" + process "VERIFYBAMID_VERIFYBAMID2" + + tag "modules" + tag "modules_nfcore" + tag "verifybamid" + tag "verifybamid/verifybamid2" + + test("Should run with SVD input") { + config "./nextflow.config" + + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam'), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai') ] + input[1] = [ file(params.modules_testdata_base_path + 'delete_me/verifybamid/test.genome.vcf.UD'), + file(params.modules_testdata_base_path + 'delete_me/verifybamid/test.genome.vcf.mu'), + file(params.modules_testdata_base_path + 'delete_me/verifybamid/test.genome.vcf.bed') ] + input[2] = [] + input[3] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta') + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.log[0][1]).name, + file(process.out.ancestry[0][1]).name, + file(process.out.self_sm[0][1]).name, + process.out.versions + ).match() } + ) + } + } + + test("Should run with RefVCF input") { + config "./nextflow.config" + + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam'), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai') ] + input[1] = [ [], [], [] ] + input[2] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf') + input[3] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta') + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.log[0][1]).name, + file(process.out.bed[0][1]).name, + file(process.out.mu[0][1]).name, + process.out.versions + ).match() } + ) + } + } + + test("Should run with panel input") { + config "./nextflow.config" + + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam'), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai') ] + input[1] = [ file(params.modules_testdata_base_path + 'delete_me/verifybamid/test.genome.vcf.UD'), + file(params.modules_testdata_base_path + 'delete_me/verifybamid/test.genome.vcf.mu'), + file(params.modules_testdata_base_path + 'delete_me/verifybamid/test.genome.vcf.bed') ] + input[2] = [] + input[3] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta') + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.log[0][1]).name, + process.out.versions + ).match() } + ) + } + } +} \ No newline at end of file diff --git a/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test.snap b/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test.snap new file mode 100644 index 00000000000..635c15059a6 --- /dev/null +++ b/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test.snap @@ -0,0 +1,45 @@ +{ + "Should run with panel input": { + "content": [ + "test.log", + [ + "versions.yml:md5,199f2e02b570926d6a249055c917c6b1" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-22T13:02:25.962766167" + }, + "Should run with SVD input": { + "content": [ + "test.log", + "result.Ancestry", + "result.selfSM", + [ + "versions.yml:md5,199f2e02b570926d6a249055c917c6b1" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-22T13:01:46.137012519" + }, + "Should run with RefVCF input": { + "content": [ + "test.log", + "test.genome.vcf.bed", + "test.genome.vcf.mu", + [ + "versions.yml:md5,199f2e02b570926d6a249055c917c6b1" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-22T12:52:22.110967848" + } +} \ No newline at end of file diff --git a/modules/nf-core/verifybamid/verifybamid2/tests/nextflow.config b/modules/nf-core/verifybamid/verifybamid2/tests/nextflow.config new file mode 100644 index 00000000000..85682eaa220 --- /dev/null +++ b/modules/nf-core/verifybamid/verifybamid2/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: 'VERIFYBAMID_VERIFYBAMID2' { + ext.args = '--DisableSanityCheck' + } +} diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index babb50ac4c9..c06f6de17ff 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -786,9 +786,6 @@ varlociraptor/preprocess: vcflib/vcfbreakmulti: - modules/nf-core/vcflib/vcfbreakmulti/** - tests/modules/nf-core/vcflib/vcfbreakmulti/** -verifybamid/verifybamid2: - - modules/nf-core/verifybamid/verifybamid2/** - - tests/modules/nf-core/verifybamid/verifybamid2/** vrhyme/extractunbinned: - modules/nf-core/vrhyme/extractunbinned/** - tests/modules/nf-core/vrhyme/extractunbinned/** diff --git a/tests/modules/nf-core/verifybamid/verifybamid2/main.nf b/tests/modules/nf-core/verifybamid/verifybamid2/main.nf deleted file mode 100644 index 9312da1bf66..00000000000 --- a/tests/modules/nf-core/verifybamid/verifybamid2/main.nf +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { VERIFYBAMID_VERIFYBAMID2 as VERIFYBAMID_VERIFYBAMID2_SVD } from '../../../../../modules/nf-core/verifybamid/verifybamid2/main.nf' -include { VERIFYBAMID_VERIFYBAMID2 as VERIFYBAMID_VERIFYBAMID2_REFVCF } from '../../../../../modules/nf-core/verifybamid/verifybamid2/main.nf' -include { VERIFYBAMID_VERIFYBAMID2 as VERIFYBAMID_VERIFYBAMID2_PANEL } from '../../../../../modules/nf-core/verifybamid/verifybamid2/main.nf' - -workflow test_verifybamid_verifybamid2_svd { - - input = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) - ] - - svd_prefix = [ file(params.niche_test['test_genome']['test_genome_ud'], checkIfExists: true), - file(params.niche_test['test_genome']['test_genome_mu'], checkIfExists: true), - file(params.niche_test['test_genome']['test_genome_bed'], checkIfExists: true) - ] - - references = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true) - - VERIFYBAMID_VERIFYBAMID2_SVD ( input, svd_prefix, [], references ) -} - -workflow test_verifybamid_verifybamid2_panel { - - input = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) - ] - - svd_prefix = [ file(params.niche_test['test_genome']['test_genome_ud'], checkIfExists: true), - file(params.niche_test['test_genome']['test_genome_mu'], checkIfExists: true), - file(params.niche_test['test_genome']['test_genome_bed'], checkIfExists: true) - ] - - references = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true) - - VERIFYBAMID_VERIFYBAMID2_PANEL ( input, svd_prefix, [], references ) -} - -workflow test_verifybamid_verifybamid2_refvcf { - input = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) - ] - - svd_prefix = [ file(params.niche_test['test_genome']['test_genome_ud'], checkIfExists: true), - file(params.niche_test['test_genome']['test_genome_mu'], checkIfExists: true), - file(params.niche_test['test_genome']['test_genome_bed'], checkIfExists: true) - ] - - refvcf = file(params.test_data['homo_sapiens']['illumina']['test_genome_vcf'], checkIfExists: true) - - references = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true) - - VERIFYBAMID_VERIFYBAMID2_REFVCF ( input, [[],[],[]], refvcf, references ) -} diff --git a/tests/modules/nf-core/verifybamid/verifybamid2/nextflow.config b/tests/modules/nf-core/verifybamid/verifybamid2/nextflow.config deleted file mode 100644 index 0351bad61a9..00000000000 --- a/tests/modules/nf-core/verifybamid/verifybamid2/nextflow.config +++ /dev/null @@ -1,34 +0,0 @@ -// Including niche test data -def test_niche_data_dir = "https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me" -params { - niche_test { - 'verifybamid' { - verifybamid2_test_1000g_ud = "${test_niche_data_dir}/verifybamid/1000g.phase3.10k.b38.vcf.gz.dat.UD" - verifybamid2_test_1000g_mu = "${test_niche_data_dir}/verifybamid/1000g.phase3.10k.b38.vcf.gz.dat.mu" - verifybamid2_test_1000g_bed = "${test_niche_data_dir}/verifybamid/1000g.phase3.10k.b38.vcf.gz.dat.bed" - } - 'test_genome' { - test_genome_ud = "${test_niche_data_dir}/verifybamid/test.genome.vcf.UD" - test_genome_mu = "${test_niche_data_dir}/verifybamid/test.genome.vcf.mu" - test_genome_bed = "${test_niche_data_dir}/verifybamid/test.genome.vcf.bed" - } - } -} - -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: VERIFYBAMID_VERIFYBAMID2_SVD { - ext.args = '--Output vb_aux --DisableSanityCheck' - } - - withName: VERIFYBAMID_VERIFYBAMID2_REFVCF { - ext.args = '--DisableSanityCheck' - } - - withName: VERIFYBAMID_VERIFYBAMID2_PANEL { - ext.args = '--DisableSanityCheck' - } - -} diff --git a/tests/modules/nf-core/verifybamid/verifybamid2/test.yml b/tests/modules/nf-core/verifybamid/verifybamid2/test.yml deleted file mode 100644 index 8c108c9b0aa..00000000000 --- a/tests/modules/nf-core/verifybamid/verifybamid2/test.yml +++ /dev/null @@ -1,31 +0,0 @@ -- name: verifybamid verifybamid2 test_verifybamid_verifybamid2_panel - command: nextflow run ./tests/modules/nf-core/verifybamid/verifybamid2 -entry test_verifybamid_verifybamid2_panel -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/verifybamid/verifybamid2/nextflow.config - tags: - - verifybamid/verifybamid2 - - verifybamid - files: - - path: output/verifybamid/test.log - -- name: verifybamid verifybamid2 test_verifybamid_verifybamid2_refvcf - command: nextflow run ./tests/modules/nf-core/verifybamid/verifybamid2 -entry test_verifybamid_verifybamid2_refvcf -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/verifybamid/verifybamid2/nextflow.config - tags: - - verifybamid/verifybamid2 - - verifybamid - files: - - path: output/verifybamid/test.log - - path: output/verifybamid/test.genome.vcf.bed - md5sum: 47106c764019ee359b1936410e2efa1e - - path: output/verifybamid/test.genome.vcf.mu - md5sum: 0810db02af2a176fa5ddc0f404911b66 - -- name: verifybamid verifybamid2 test_verifybamid_verifybamid2_svd - command: nextflow run ./tests/modules/nf-core/verifybamid/verifybamid2 -entry test_verifybamid_verifybamid2_svd -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/verifybamid/verifybamid2/nextflow.config - tags: - - verifybamid/verifybamid2 - - verifybamid - files: - - path: output/verifybamid/test.log - - path: output/verifybamid/vb_aux.Ancestry - md5sum: fe39ad1aced7cbb1eb21a74332389ad2 - - path: output/verifybamid/vb_aux.selfSM - md5sum: 9a10860a7e79e393c773aa801ec9f84a From 9d985b70c67235ced71c43453c3dfd85cd0d6c50 Mon Sep 17 00:00:00 2001 From: Simon Pearce <24893913+SPPearce@users.noreply.github.com> Date: Tue, 5 Nov 2024 21:00:57 +0000 Subject: [PATCH 2/3] Update snapshots --- .../verifybamid2/tests/main.nf.test | 20 ++- .../verifybamid2/tests/main.nf.test.snap | 137 ++++++++++++++++-- 2 files changed, 130 insertions(+), 27 deletions(-) diff --git a/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test b/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test index 3fe531fe65b..8dbd18c6f0c 100644 --- a/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test +++ b/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test @@ -30,12 +30,7 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot( - file(process.out.log[0][1]).name, - file(process.out.ancestry[0][1]).name, - file(process.out.self_sm[0][1]).name, - process.out.versions - ).match() } + { assert snapshot(process.out).match() } ) } } @@ -60,11 +55,14 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot( - file(process.out.log[0][1]).name, - file(process.out.bed[0][1]).name, - file(process.out.mu[0][1]).name, - process.out.versions - ).match() } + process.out.log, + process.out.bed, + process.out.mu, + process.out.self_sm, + process.out.ancestry, + process.out.versions, + file(process.out.ud[0][1]).name + ).match() } ) } } diff --git a/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test.snap b/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test.snap index 635c15059a6..579bbfac105 100644 --- a/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test.snap +++ b/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test.snap @@ -14,32 +14,137 @@ }, "Should run with SVD input": { "content": [ - "test.log", - "result.Ancestry", - "result.selfSM", - [ - "versions.yml:md5,199f2e02b570926d6a249055c917c6b1" - ] + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.log:md5,32a9811d143450f9f5b99c21b6ecff61" + ] + ], + "1": [ + + ], + "2": [ + + ], + "3": [ + + ], + "4": [ + [ + { + "id": "test", + "single_end": false + }, + "result.selfSM:md5,9a10860a7e79e393c773aa801ec9f84a" + ] + ], + "5": [ + [ + { + "id": "test", + "single_end": false + }, + "result.Ancestry:md5,fe39ad1aced7cbb1eb21a74332389ad2" + ] + ], + "6": [ + "versions.yml:md5,199f2e02b570926d6a249055c917c6b1" + ], + "ancestry": [ + [ + { + "id": "test", + "single_end": false + }, + "result.Ancestry:md5,fe39ad1aced7cbb1eb21a74332389ad2" + ] + ], + "bed": [ + + ], + "log": [ + [ + { + "id": "test", + "single_end": false + }, + "test.log:md5,32a9811d143450f9f5b99c21b6ecff61" + ] + ], + "mu": [ + + ], + "self_sm": [ + [ + { + "id": "test", + "single_end": false + }, + "result.selfSM:md5,9a10860a7e79e393c773aa801ec9f84a" + ] + ], + "ud": [ + + ], + "versions": [ + "versions.yml:md5,199f2e02b570926d6a249055c917c6b1" + ] + } ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.4" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-10-22T13:01:46.137012519" + "timestamp": "2024-11-05T20:51:39.853534509" }, "Should run with RefVCF input": { "content": [ - "test.log", - "test.genome.vcf.bed", - "test.genome.vcf.mu", + [ + [ + { + "id": "test", + "single_end": false + }, + "test.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.genome.vcf.bed:md5,47106c764019ee359b1936410e2efa1e" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.genome.vcf.mu:md5,0810db02af2a176fa5ddc0f404911b66" + ] + ], + [ + + ], + [ + + ], [ "versions.yml:md5,199f2e02b570926d6a249055c917c6b1" - ] + ], + "test.genome.vcf.UD" ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.4" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-10-22T12:52:22.110967848" + "timestamp": "2024-11-05T20:59:00.085284488" } } \ No newline at end of file From 50d932aa2f0f0b85ea8c010e02cf3ab30bc36e87 Mon Sep 17 00:00:00 2001 From: Simon Pearce <24893913+SPPearce@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:44:45 +0000 Subject: [PATCH 3/3] Remove empty md5sum --- .../verifybamid/verifybamid2/tests/main.nf.test | 2 +- .../verifybamid2/tests/main.nf.test.snap | 16 ++++------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test b/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test index 8dbd18c6f0c..87d7878434f 100644 --- a/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test +++ b/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test @@ -55,7 +55,7 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot( - process.out.log, + file(process.out.log[0][1]).name, process.out.bed, process.out.mu, process.out.self_sm, diff --git a/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test.snap b/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test.snap index 579bbfac105..1ef1420d2b3 100644 --- a/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test.snap +++ b/modules/nf-core/verifybamid/verifybamid2/tests/main.nf.test.snap @@ -103,15 +103,7 @@ }, "Should run with RefVCF input": { "content": [ - [ - [ - { - "id": "test", - "single_end": false - }, - "test.log:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], + "test.log", [ [ { @@ -142,9 +134,9 @@ "test.genome.vcf.UD" ], "meta": { - "nf-test": "0.9.1", - "nextflow": "24.10.0" + "nf-test": "0.9.2", + "nextflow": "24.10.1" }, - "timestamp": "2024-11-05T20:59:00.085284488" + "timestamp": "2024-11-20T13:43:20.984216864" } } \ No newline at end of file