From 7981a83badb858161a95c969da3358d18c27a3b3 Mon Sep 17 00:00:00 2001 From: Usman Rashid Date: Thu, 5 Sep 2024 21:32:15 +1200 Subject: [PATCH] Added nf-test for hmmer/hmmfetch --- .../nf-core/hmmer/hmmfetch/tests/main.nf.test | 115 ++++++++++++ .../hmmer/hmmfetch/tests/main.nf.test.snap | 166 ++++++++++++++++++ tests/config/pytest_modules.yml | 3 - tests/modules/nf-core/hmmer/hmmfetch/main.nf | 40 ----- .../nf-core/hmmer/hmmfetch/nextflow.config | 5 - tests/modules/nf-core/hmmer/hmmfetch/test.yml | 29 --- 6 files changed, 281 insertions(+), 77 deletions(-) create mode 100644 modules/nf-core/hmmer/hmmfetch/tests/main.nf.test create mode 100644 modules/nf-core/hmmer/hmmfetch/tests/main.nf.test.snap delete mode 100644 tests/modules/nf-core/hmmer/hmmfetch/main.nf delete mode 100644 tests/modules/nf-core/hmmer/hmmfetch/nextflow.config delete mode 100644 tests/modules/nf-core/hmmer/hmmfetch/test.yml diff --git a/modules/nf-core/hmmer/hmmfetch/tests/main.nf.test b/modules/nf-core/hmmer/hmmfetch/tests/main.nf.test new file mode 100644 index 00000000000..46c7b58fcc2 --- /dev/null +++ b/modules/nf-core/hmmer/hmmfetch/tests/main.nf.test @@ -0,0 +1,115 @@ + +nextflow_process { + + name "Test Process HMMER_HMMFETCH" + script "../main.nf" + process "HMMER_HMMFETCH" + + tag "modules" + tag "modules_nfcore" + tag "hmmer" + tag "hmmer/hmmfetch" + + test("test-hmmer-hmmfetch-key") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], + file('https://raw.githubusercontent.com/tseemann/barrnap/master/db/arc.hmm') + ] + input[1] = '16S_rRNA' + input[2] = [] + input[3] = [] + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("test-hmmer-hmmfetch-keyfile") { + + when { + process { + """ + keyfile = Channel.of('16S_rRNA', '23S_rRNA').collectFile(name: 'keys.txt', newLine: true) + + input[0] = [ + [ id:'test', single_end:false ], + file('https://raw.githubusercontent.com/tseemann/barrnap/master/db/arc.hmm') + ] + input[1] = [] + input[2] = keyfile + input[3] = [] + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("test-hmmer-hmmfetch-index") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], + file('https://raw.githubusercontent.com/tseemann/barrnap/master/db/arc.hmm') + ] + input[1] = [] + input[2] = [] + input[3] = [] + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("test-hmmer-hmmfetch-index-stub") { + options '-stub' + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], + file('https://raw.githubusercontent.com/tseemann/barrnap/master/db/arc.hmm') + ] + input[1] = [] + input[2] = [] + input[3] = [] + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + +} diff --git a/modules/nf-core/hmmer/hmmfetch/tests/main.nf.test.snap b/modules/nf-core/hmmer/hmmfetch/tests/main.nf.test.snap new file mode 100644 index 00000000000..d934b779abe --- /dev/null +++ b/modules/nf-core/hmmer/hmmfetch/tests/main.nf.test.snap @@ -0,0 +1,166 @@ +{ + "test-hmmer-hmmfetch-index": { + "content": [ + { + "0": [ + + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "arc.hmm.ssi:md5,17a7bb35662baabb5b1474660d072fb6" + ] + ], + "2": [ + "versions.yml:md5,ca18131840322abff960ba5c09f91a5a" + ], + "hmm": [ + + ], + "index": [ + [ + { + "id": "test", + "single_end": false + }, + "arc.hmm.ssi:md5,17a7bb35662baabb5b1474660d072fb6" + ] + ], + "versions": [ + "versions.yml:md5,ca18131840322abff960ba5c09f91a5a" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-05T21:24:45.824243" + }, + "test-hmmer-hmmfetch-index-stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.hmm:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + + ], + "2": [ + "versions.yml:md5,ca18131840322abff960ba5c09f91a5a" + ], + "hmm": [ + [ + { + "id": "test", + "single_end": false + }, + "test.hmm:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "index": [ + + ], + "versions": [ + "versions.yml:md5,ca18131840322abff960ba5c09f91a5a" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-05T21:24:50.535566" + }, + "test-hmmer-hmmfetch-keyfile": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.hmm:md5,0e5c7e77342ec91bc6fac2a7a0228d08" + ] + ], + "1": [ + + ], + "2": [ + "versions.yml:md5,ca18131840322abff960ba5c09f91a5a" + ], + "hmm": [ + [ + { + "id": "test", + "single_end": false + }, + "test.hmm:md5,0e5c7e77342ec91bc6fac2a7a0228d08" + ] + ], + "index": [ + + ], + "versions": [ + "versions.yml:md5,ca18131840322abff960ba5c09f91a5a" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-05T21:29:44.506723" + }, + "test-hmmer-hmmfetch-key": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.hmm:md5,0328406a7469af6f24e2157b0367705f" + ] + ], + "1": [ + + ], + "2": [ + "versions.yml:md5,ca18131840322abff960ba5c09f91a5a" + ], + "hmm": [ + [ + { + "id": "test", + "single_end": false + }, + "test.hmm:md5,0328406a7469af6f24e2157b0367705f" + ] + ], + "index": [ + + ], + "versions": [ + "versions.yml:md5,ca18131840322abff960ba5c09f91a5a" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-05T21:24:38.347449" + } +} \ No newline at end of file diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index d1027a79093..915171ae640 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -362,9 +362,6 @@ hmmer/hmmalign: hmmer/hmmbuild: - modules/nf-core/hmmer/hmmbuild/** - tests/modules/nf-core/hmmer/hmmbuild/** -hmmer/hmmfetch: - - modules/nf-core/hmmer/hmmfetch/** - - tests/modules/nf-core/hmmer/hmmfetch/** hmtnote/annotate: - modules/nf-core/hmtnote/annotate/** - tests/modules/nf-core/hmtnote/annotate/** diff --git a/tests/modules/nf-core/hmmer/hmmfetch/main.nf b/tests/modules/nf-core/hmmer/hmmfetch/main.nf deleted file mode 100644 index db24e553a4e..00000000000 --- a/tests/modules/nf-core/hmmer/hmmfetch/main.nf +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { HMMER_HMMFETCH } from '../../../../../modules/nf-core/hmmer/hmmfetch/main.nf' - -workflow test_hmmer_hmmfetch_key { - - input = [ - [ id:'test', single_end:false ], - file('https://raw.githubusercontent.com/tseemann/barrnap/master/db/arc.hmm') - ] - - HMMER_HMMFETCH ( input, '16S_rRNA', [], [] ) -} - -workflow test_hmmer_hmmfetch_keyfile { - - input = [ - [ id:'test', single_end:false ], - file('https://raw.githubusercontent.com/tseemann/barrnap/master/db/arc.hmm') - ] - - Channel - .of('16S_rRNA', '23S_rRNA') - .collectFile(name: 'keys.txt', newLine: true) - .set { keyfile } - - HMMER_HMMFETCH ( input, [], keyfile, [] ) -} - -workflow test_hmmer_hmmfetch_index { - - input = [ - [ id:'test', single_end:false ], - file('https://raw.githubusercontent.com/tseemann/barrnap/master/db/arc.hmm') - ] - - HMMER_HMMFETCH ( input, [], [], [] ) -} diff --git a/tests/modules/nf-core/hmmer/hmmfetch/nextflow.config b/tests/modules/nf-core/hmmer/hmmfetch/nextflow.config deleted file mode 100644 index 50f50a7a357..00000000000 --- a/tests/modules/nf-core/hmmer/hmmfetch/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} \ No newline at end of file diff --git a/tests/modules/nf-core/hmmer/hmmfetch/test.yml b/tests/modules/nf-core/hmmer/hmmfetch/test.yml deleted file mode 100644 index f602892a586..00000000000 --- a/tests/modules/nf-core/hmmer/hmmfetch/test.yml +++ /dev/null @@ -1,29 +0,0 @@ -- name: hmmer hmmfetch test_hmmer_hmmfetch_key - command: nextflow run ./tests/modules/nf-core/hmmer/hmmfetch -entry test_hmmer_hmmfetch_key -c ./tests/config/nextflow.config - tags: - - hmmer/hmmfetch - - hmmer - files: - - path: output/hmmer/test.hmm - md5sum: 0328406a7469af6f24e2157b0367705f - - path: output/hmmer/versions.yml - -- name: hmmer hmmfetch test_hmmer_hmmfetch_keyfile - command: nextflow run ./tests/modules/nf-core/hmmer/hmmfetch -entry test_hmmer_hmmfetch_keyfile -c ./tests/config/nextflow.config - tags: - - hmmer/hmmfetch - - hmmer - files: - - path: output/hmmer/test.hmm - md5sum: 0e5c7e77342ec91bc6fac2a7a0228d08 - - path: output/hmmer/versions.yml - -- name: hmmer hmmfetch test_hmmer_hmmfetch_index - command: nextflow run ./tests/modules/nf-core/hmmer/hmmfetch -entry test_hmmer_hmmfetch_index -c ./tests/config/nextflow.config - tags: - - hmmer/hmmfetch - - hmmer - files: - - path: output/hmmer/arc.hmm.ssi - md5sum: 17a7bb35662baabb5b1474660d072fb6 - - path: output/hmmer/versions.yml