From dbbabc3464af532e7891064fb59c07f564ec9780 Mon Sep 17 00:00:00 2001 From: Usman Rashid Date: Mon, 26 Aug 2024 23:33:34 +1200 Subject: [PATCH] Added nf-test for bedtools/jaccard (#6330) --- .../bedtools/jaccard/tests/main.nf.test | 66 +++++++++++++++++ .../bedtools/jaccard/tests/main.nf.test.snap | 72 +++++++++++++++++++ .../bedtools/jaccard/tests/nextflow.config | 5 ++ tests/config/pytest_modules.yml | 3 - .../modules/nf-core/bedtools/jaccard/main.nf | 32 --------- .../nf-core/bedtools/jaccard/nextflow.config | 9 --- .../modules/nf-core/bedtools/jaccard/test.yml | 19 ----- 7 files changed, 143 insertions(+), 63 deletions(-) create mode 100644 modules/nf-core/bedtools/jaccard/tests/main.nf.test create mode 100644 modules/nf-core/bedtools/jaccard/tests/main.nf.test.snap create mode 100644 modules/nf-core/bedtools/jaccard/tests/nextflow.config delete mode 100644 tests/modules/nf-core/bedtools/jaccard/main.nf delete mode 100644 tests/modules/nf-core/bedtools/jaccard/nextflow.config delete mode 100644 tests/modules/nf-core/bedtools/jaccard/test.yml diff --git a/modules/nf-core/bedtools/jaccard/tests/main.nf.test b/modules/nf-core/bedtools/jaccard/tests/main.nf.test new file mode 100644 index 00000000000..839266b5fcc --- /dev/null +++ b/modules/nf-core/bedtools/jaccard/tests/main.nf.test @@ -0,0 +1,66 @@ + +nextflow_process { + + name "Test Process BEDTOOLS_JACCARD" + script "../main.nf" + process "BEDTOOLS_JACCARD" + + tag "modules" + tag "modules_nfcore" + tag "bedtools" + tag "bedtools/jaccard" + + test("test-bedtools-jaccard") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz', checkIfExists: true) + ] + input[1] = [[],[]] + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("test-bedtools-jaccard-genome") { + + config "./nextflow.config" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz', checkIfExists: true) + ] + input[1] = [ + [ id:'genome' ], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.fai', checkIfExists: true) + ] + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + +} diff --git a/modules/nf-core/bedtools/jaccard/tests/main.nf.test.snap b/modules/nf-core/bedtools/jaccard/tests/main.nf.test.snap new file mode 100644 index 00000000000..4783d48960f --- /dev/null +++ b/modules/nf-core/bedtools/jaccard/tests/main.nf.test.snap @@ -0,0 +1,72 @@ +{ + "test-bedtools-jaccard-genome": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv:md5,b737742026a3b512a494f3aa7935fded" + ] + ], + "1": [ + "versions.yml:md5,4d8267abd99c41fb6056d5162b380d23" + ], + "tsv": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv:md5,b737742026a3b512a494f3aa7935fded" + ] + ], + "versions": [ + "versions.yml:md5,4d8267abd99c41fb6056d5162b380d23" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-08-26T14:08:36.70775" + }, + "test-bedtools-jaccard": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv:md5,b737742026a3b512a494f3aa7935fded" + ] + ], + "1": [ + "versions.yml:md5,4d8267abd99c41fb6056d5162b380d23" + ], + "tsv": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv:md5,b737742026a3b512a494f3aa7935fded" + ] + ], + "versions": [ + "versions.yml:md5,4d8267abd99c41fb6056d5162b380d23" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-08-26T14:08:32.019101" + } +} \ No newline at end of file diff --git a/modules/nf-core/bedtools/jaccard/tests/nextflow.config b/modules/nf-core/bedtools/jaccard/tests/nextflow.config new file mode 100644 index 00000000000..5208fee9b6a --- /dev/null +++ b/modules/nf-core/bedtools/jaccard/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: "BEDTOOLS_JACCARD" { + ext.args = "-sorted" + } +} diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 59735518afd..7e2a0c1078f 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -67,9 +67,6 @@ beagle5/beagle: bedtools/intersect: - modules/nf-core/bedtools/intersect/** - tests/modules/nf-core/bedtools/intersect/** -bedtools/jaccard: - - modules/nf-core/bedtools/jaccard/** - - tests/modules/nf-core/bedtools/jaccard/** bedtools/makewindows: - modules/nf-core/bedtools/makewindows/** - tests/modules/nf-core/bedtools/makewindows/** diff --git a/tests/modules/nf-core/bedtools/jaccard/main.nf b/tests/modules/nf-core/bedtools/jaccard/main.nf deleted file mode 100644 index 97823041cc3..00000000000 --- a/tests/modules/nf-core/bedtools/jaccard/main.nf +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { BEDTOOLS_JACCARD } from '../../../../../modules/nf-core/bedtools/jaccard/main.nf' - -workflow test_bedtools_jaccard { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_vcf_gz'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test2_vcf_gz'], checkIfExists: true) - ] - - BEDTOOLS_JACCARD ( input, [[],[]] ) -} - -workflow test_bedtools_jaccard_genome { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_vcf_gz'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test2_vcf_gz'], checkIfExists: true) - ] - - genome = [ - [ id:'genome' ], - file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true) - ] - - BEDTOOLS_JACCARD ( input, genome ) -} diff --git a/tests/modules/nf-core/bedtools/jaccard/nextflow.config b/tests/modules/nf-core/bedtools/jaccard/nextflow.config deleted file mode 100644 index 499fa9974b3..00000000000 --- a/tests/modules/nf-core/bedtools/jaccard/nextflow.config +++ /dev/null @@ -1,9 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: "test_bedtools_jaccard_genome:BEDTOOLS_JACCARD" { - ext.args = "-sorted" - } - -} \ No newline at end of file diff --git a/tests/modules/nf-core/bedtools/jaccard/test.yml b/tests/modules/nf-core/bedtools/jaccard/test.yml deleted file mode 100644 index 0368fc92217..00000000000 --- a/tests/modules/nf-core/bedtools/jaccard/test.yml +++ /dev/null @@ -1,19 +0,0 @@ -- name: bedtools jaccard test_bedtools_jaccard - command: nextflow run ./tests/modules/nf-core/bedtools/jaccard -entry test_bedtools_jaccard -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/bedtools/jaccard/nextflow.config - tags: - - bedtools/jaccard - - bedtools - files: - - path: output/bedtools/test.tsv - md5sum: b737742026a3b512a494f3aa7935fded - - path: output/bedtools/versions.yml - -- name: bedtools jaccard test_bedtools_jaccard_genome - command: nextflow run ./tests/modules/nf-core/bedtools/jaccard -entry test_bedtools_jaccard_genome -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/bedtools/jaccard/nextflow.config - tags: - - bedtools/jaccard - - bedtools - files: - - path: output/bedtools/test.tsv - md5sum: b737742026a3b512a494f3aa7935fded - - path: output/bedtools/versions.yml