From c5f99c84f7df4fff30033a1cd295c2fb9d6fcc2b Mon Sep 17 00:00:00 2001 From: Usman Rashid Date: Thu, 22 Aug 2024 17:40:46 +1200 Subject: [PATCH 1/2] Added nf-test for verifybamid/verifybamid --- .../verifybamid/verifybamid/environment.yml | 2 +- .../nf-core/verifybamid/verifybamid/meta.yml | 4 +- .../verifybamid/tests/main.nf.test | 37 ++++++ .../verifybamid/tests/main.nf.test.snap | 121 ++++++++++++++++++ .../verifybamid/tests/nextflow.config | 3 + tests/config/pytest_modules.yml | 3 - .../nf-core/verifybamid/verifybamid/main.nf | 17 --- .../verifybamid/verifybamid/nextflow.config | 6 - .../nf-core/verifybamid/verifybamid/test.yml | 17 --- 9 files changed, 164 insertions(+), 46 deletions(-) create mode 100644 modules/nf-core/verifybamid/verifybamid/tests/main.nf.test create mode 100644 modules/nf-core/verifybamid/verifybamid/tests/main.nf.test.snap create mode 100644 modules/nf-core/verifybamid/verifybamid/tests/nextflow.config delete mode 100644 tests/modules/nf-core/verifybamid/verifybamid/main.nf delete mode 100644 tests/modules/nf-core/verifybamid/verifybamid/nextflow.config delete mode 100644 tests/modules/nf-core/verifybamid/verifybamid/test.yml diff --git a/modules/nf-core/verifybamid/verifybamid/environment.yml b/modules/nf-core/verifybamid/verifybamid/environment.yml index 6de2c9603d7..9a887c5ac0b 100644 --- a/modules/nf-core/verifybamid/verifybamid/environment.yml +++ b/modules/nf-core/verifybamid/verifybamid/environment.yml @@ -1,4 +1,4 @@ -name: VERIFYBAMID_VERIFYBAMID +name: verifybamid_verifybamid channels: - conda-forge - bioconda diff --git a/modules/nf-core/verifybamid/verifybamid/meta.yml b/modules/nf-core/verifybamid/verifybamid/meta.yml index 34909146a01..1897edd1529 100644 --- a/modules/nf-core/verifybamid/verifybamid/meta.yml +++ b/modules/nf-core/verifybamid/verifybamid/meta.yml @@ -1,4 +1,4 @@ -name: "VERIFYBAMID_VERIFYBAMID" +name: "verifybamid_verifybamid" description: Detecting and estimating inter-sample DNA contamination became a crucial quality assessment step to ensure high quality sequence reads and reliable downstream analysis. keywords: - qc @@ -11,7 +11,7 @@ tools: documentation: "http://genome.sph.umich.edu/wiki/VerifyBamID" tool_dev_url: "https://github.com/statgen/verifyBamID" doi: "10.1016/j.ajhg.2012.09.004" - licence: "['GPL v3']" + licence: ["GPL v3"] input: - meta: type: map diff --git a/modules/nf-core/verifybamid/verifybamid/tests/main.nf.test b/modules/nf-core/verifybamid/verifybamid/tests/main.nf.test new file mode 100644 index 00000000000..81b599ce4ad --- /dev/null +++ b/modules/nf-core/verifybamid/verifybamid/tests/main.nf.test @@ -0,0 +1,37 @@ + +nextflow_process { + + name "Test Process VERIFYBAMID_VERIFYBAMID" + script "../main.nf" + process "VERIFYBAMID_VERIFYBAMID" + config "./nextflow.config" + + tag "modules" + tag "modules_nfcore" + tag "verifybamid" + tag "verifybamid/verifybamid" + + test("test-verifybamid-verifybamid") { + + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) + ] + input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/genmod.vcf.gz', checkIfExists: true) + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + +} diff --git a/modules/nf-core/verifybamid/verifybamid/tests/main.nf.test.snap b/modules/nf-core/verifybamid/verifybamid/tests/main.nf.test.snap new file mode 100644 index 00000000000..1b7fbe97d77 --- /dev/null +++ b/modules/nf-core/verifybamid/verifybamid/tests/main.nf.test.snap @@ -0,0 +1,121 @@ +{ + "test-verifybamid-verifybamid": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.log:md5,04e3784fb3381c295cb38a0bb15fc943" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.selfSM:md5,5d2808d70f76e2f753b670fc9b2a6d55" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "test.depthSM:md5,4f5367f2be8567b95b57278b2e7372c3" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test.selfRG:md5,3772283d3eaa88683f562a2157b92d55" + ] + ], + "4": [ + [ + { + "id": "test", + "single_end": false + }, + "test.depthRG:md5,2374504c4138c04f3b29210dcb3da96f" + ] + ], + "5": [ + + ], + "6": [ + + ], + "7": [ + "versions.yml:md5,36b44d66ecfdbef7191f47a33f688b7f" + ], + "bestrg": [ + + ], + "bestsm": [ + + ], + "depthrg": [ + [ + { + "id": "test", + "single_end": false + }, + "test.depthRG:md5,2374504c4138c04f3b29210dcb3da96f" + ] + ], + "depthsm": [ + [ + { + "id": "test", + "single_end": false + }, + "test.depthSM:md5,4f5367f2be8567b95b57278b2e7372c3" + ] + ], + "log": [ + [ + { + "id": "test", + "single_end": false + }, + "test.log:md5,04e3784fb3381c295cb38a0bb15fc943" + ] + ], + "selfrg": [ + [ + { + "id": "test", + "single_end": false + }, + "test.selfRG:md5,3772283d3eaa88683f562a2157b92d55" + ] + ], + "selfsm": [ + [ + { + "id": "test", + "single_end": false + }, + "test.selfSM:md5,5d2808d70f76e2f753b670fc9b2a6d55" + ] + ], + "versions": [ + "versions.yml:md5,36b44d66ecfdbef7191f47a33f688b7f" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-08-22T17:36:47.720868" + } +} \ No newline at end of file diff --git a/modules/nf-core/verifybamid/verifybamid/tests/nextflow.config b/modules/nf-core/verifybamid/verifybamid/tests/nextflow.config new file mode 100644 index 00000000000..c2abbe93d68 --- /dev/null +++ b/modules/nf-core/verifybamid/verifybamid/tests/nextflow.config @@ -0,0 +1,3 @@ +process { + ext.args = '--ignoreRG' +} diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index d56754160c9..fb894666bb1 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1641,9 +1641,6 @@ vcflib/vcffilter: vcflib/vcfuniq: - modules/nf-core/vcflib/vcfuniq/** - tests/modules/nf-core/vcflib/vcfuniq/** -verifybamid/verifybamid: - - modules/nf-core/verifybamid/verifybamid/** - - tests/modules/nf-core/verifybamid/verifybamid/** verifybamid/verifybamid2: - modules/nf-core/verifybamid/verifybamid2/** - tests/modules/nf-core/verifybamid/verifybamid2/** diff --git a/tests/modules/nf-core/verifybamid/verifybamid/main.nf b/tests/modules/nf-core/verifybamid/verifybamid/main.nf deleted file mode 100644 index 24ffdd27ae9..00000000000 --- a/tests/modules/nf-core/verifybamid/verifybamid/main.nf +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { VERIFYBAMID_VERIFYBAMID } from '../../../../../modules/nf-core/verifybamid/verifybamid/main.nf' - -workflow test_verifybamid_verifybamid { - - 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) - ] - - refvcf = file(params.test_data['homo_sapiens']['illumina']['genmod_vcf_gz'], checkIfExists: true) - - VERIFYBAMID_VERIFYBAMID ( input, refvcf ) -} diff --git a/tests/modules/nf-core/verifybamid/verifybamid/nextflow.config b/tests/modules/nf-core/verifybamid/verifybamid/nextflow.config deleted file mode 100644 index 715cce59b3f..00000000000 --- a/tests/modules/nf-core/verifybamid/verifybamid/nextflow.config +++ /dev/null @@ -1,6 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - ext.args = '--ignoreRG' - -} diff --git a/tests/modules/nf-core/verifybamid/verifybamid/test.yml b/tests/modules/nf-core/verifybamid/verifybamid/test.yml deleted file mode 100644 index d714032dbf3..00000000000 --- a/tests/modules/nf-core/verifybamid/verifybamid/test.yml +++ /dev/null @@ -1,17 +0,0 @@ -- name: verifybamid verifybamid test_verifybamid_verifybamid - command: nextflow run ./tests/modules/nf-core/verifybamid/verifybamid -entry test_verifybamid_verifybamid -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/verifybamid/verifybamid/nextflow.config - tags: - - verifybamid - - verifybamid/verifybamid - files: - - path: output/verifybamid/test.log - contains: - - "Analysis finished" - - path: output/verifybamid/test.depthRG - md5sum: 2374504c4138c04f3b29210dcb3da96f - - path: output/verifybamid/test.depthSM - md5sum: 4f5367f2be8567b95b57278b2e7372c3 - - path: output/verifybamid/test.selfRG - md5sum: 3772283d3eaa88683f562a2157b92d55 - - path: output/verifybamid/test.selfSM - md5sum: 5d2808d70f76e2f753b670fc9b2a6d55 From 29cd089f9c6d5c197a0e20f488d417835b217591 Mon Sep 17 00:00:00 2001 From: Usman Rashid Date: Thu, 22 Aug 2024 17:54:52 +1200 Subject: [PATCH 2/2] Updated power assertion --- .../verifybamid/tests/main.nf.test | 17 +- .../verifybamid/tests/main.nf.test.snap | 150 +++++------------- 2 files changed, 52 insertions(+), 115 deletions(-) diff --git a/modules/nf-core/verifybamid/verifybamid/tests/main.nf.test b/modules/nf-core/verifybamid/verifybamid/tests/main.nf.test index 81b599ce4ad..c938ce02d67 100644 --- a/modules/nf-core/verifybamid/verifybamid/tests/main.nf.test +++ b/modules/nf-core/verifybamid/verifybamid/tests/main.nf.test @@ -12,13 +12,13 @@ nextflow_process { tag "verifybamid/verifybamid" test("test-verifybamid-verifybamid") { - + when { process { """ input[0] = [ [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) ] input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/genmod.vcf.gz', checkIfExists: true) @@ -29,9 +29,16 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot( + file(process.out.log[0][1]).name, + process.out.depthrg, + process.out.depthsm, + process.out.selfrg, + process.out.selfsm, + process.out.versions, + ).match() } ) } } - + } diff --git a/modules/nf-core/verifybamid/verifybamid/tests/main.nf.test.snap b/modules/nf-core/verifybamid/verifybamid/tests/main.nf.test.snap index 1b7fbe97d77..6e2fee8cf9e 100644 --- a/modules/nf-core/verifybamid/verifybamid/tests/main.nf.test.snap +++ b/modules/nf-core/verifybamid/verifybamid/tests/main.nf.test.snap @@ -1,121 +1,51 @@ { "test-verifybamid-verifybamid": { "content": [ - { - "0": [ - [ - { - "id": "test", - "single_end": false - }, - "test.log:md5,04e3784fb3381c295cb38a0bb15fc943" - ] - ], - "1": [ - [ - { - "id": "test", - "single_end": false - }, - "test.selfSM:md5,5d2808d70f76e2f753b670fc9b2a6d55" - ] - ], - "2": [ - [ - { - "id": "test", - "single_end": false - }, - "test.depthSM:md5,4f5367f2be8567b95b57278b2e7372c3" - ] - ], - "3": [ - [ - { - "id": "test", - "single_end": false - }, - "test.selfRG:md5,3772283d3eaa88683f562a2157b92d55" - ] - ], - "4": [ - [ - { - "id": "test", - "single_end": false - }, - "test.depthRG:md5,2374504c4138c04f3b29210dcb3da96f" - ] - ], - "5": [ - - ], - "6": [ - - ], - "7": [ - "versions.yml:md5,36b44d66ecfdbef7191f47a33f688b7f" - ], - "bestrg": [ - - ], - "bestsm": [ - - ], - "depthrg": [ - [ - { - "id": "test", - "single_end": false - }, - "test.depthRG:md5,2374504c4138c04f3b29210dcb3da96f" - ] - ], - "depthsm": [ - [ - { - "id": "test", - "single_end": false - }, - "test.depthSM:md5,4f5367f2be8567b95b57278b2e7372c3" - ] - ], - "log": [ - [ - { - "id": "test", - "single_end": false - }, - "test.log:md5,04e3784fb3381c295cb38a0bb15fc943" - ] - ], - "selfrg": [ - [ - { - "id": "test", - "single_end": false - }, - "test.selfRG:md5,3772283d3eaa88683f562a2157b92d55" - ] - ], - "selfsm": [ - [ - { - "id": "test", - "single_end": false - }, - "test.selfSM:md5,5d2808d70f76e2f753b670fc9b2a6d55" - ] - ], - "versions": [ - "versions.yml:md5,36b44d66ecfdbef7191f47a33f688b7f" + "test.log", + [ + [ + { + "id": "test", + "single_end": false + }, + "test.depthRG:md5,2374504c4138c04f3b29210dcb3da96f" ] - } + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.depthSM:md5,4f5367f2be8567b95b57278b2e7372c3" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.selfRG:md5,3772283d3eaa88683f562a2157b92d55" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.selfSM:md5,5d2808d70f76e2f753b670fc9b2a6d55" + ] + ], + [ + "versions.yml:md5,36b44d66ecfdbef7191f47a33f688b7f" + ] ], "meta": { "nf-test": "0.8.4", "nextflow": "24.04.4" }, - "timestamp": "2024-08-22T17:36:47.720868" + "timestamp": "2024-08-22T17:54:07.273193" } } \ No newline at end of file