diff --git a/modules/nf-core/picard/createsequencedictionary/main.nf b/modules/nf-core/picard/createsequencedictionary/main.nf index bc925a0dedc..4630a0d51e2 100644 --- a/modules/nf-core/picard/createsequencedictionary/main.nf +++ b/modules/nf-core/picard/createsequencedictionary/main.nf @@ -39,4 +39,16 @@ process PICARD_CREATESEQUENCEDICTIONARY { picard: \$(picard CreateSequenceDictionary --version 2>&1 | grep -o 'Version:.*' | cut -f2- -d:) END_VERSIONS """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.dict + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + picard: \$(echo \$(picard CreateSequenceDictionary --version 2>&1) | grep -o 'Version:.*' | cut -f2- -d:) + END_VERSIONS + """ + } diff --git a/modules/nf-core/picard/createsequencedictionary/tests/main.nf.test b/modules/nf-core/picard/createsequencedictionary/tests/main.nf.test new file mode 100644 index 00000000000..8152be96f31 --- /dev/null +++ b/modules/nf-core/picard/createsequencedictionary/tests/main.nf.test @@ -0,0 +1,61 @@ +nextflow_process { + + name "Test Process PICARD_CREATESEQUENCEDICTIONARY" + script "../main.nf" + process "PICARD_CREATESEQUENCEDICTIONARY" + + tag "modules" + tag "modules_nfcore" + tag "picard" + tag "picard/createsequencedictionary" + + test("sarscov2 - fasta") { + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.reference_dict[0][1]).name, + process.out.versions + ).match() + } + + ) + } + + } + + test("sarscov2 - fasta - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/picard/createsequencedictionary/tests/main.nf.test.snap b/modules/nf-core/picard/createsequencedictionary/tests/main.nf.test.snap new file mode 100644 index 00000000000..3f3f8c8ec90 --- /dev/null +++ b/modules/nf-core/picard/createsequencedictionary/tests/main.nf.test.snap @@ -0,0 +1,48 @@ +{ + "sarscov2 - fasta - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.dict:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,fdb110d8c303ffa0615bb200f9a2c999" + ], + "reference_dict": [ + [ + { + "id": "test" + }, + "test.dict:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,fdb110d8c303ffa0615bb200f9a2c999" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-08-19T07:02:59.686224426" + }, + "sarscov2 - fasta": { + "content": [ + "test.dict", + [ + "versions.yml:md5,fdb110d8c303ffa0615bb200f9a2c999" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-08-16T14:31:34.330709472" + } +} \ No newline at end of file diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 4d690091ec1..96b2515f593 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1121,9 +1121,6 @@ picard/collectrnaseqmetrics: picard/collectwgsmetrics: - modules/nf-core/picard/collectwgsmetrics/** - tests/modules/nf-core/picard/collectwgsmetrics/** -picard/createsequencedictionary: - - modules/nf-core/picard/createsequencedictionary/** - - tests/modules/nf-core/picard/createsequencedictionary/** picard/fastqtosam: - modules/nf-core/picard/fastqtosam/** - tests/modules/nf-core/picard/fastqtosam/** diff --git a/tests/modules/nf-core/picard/createsequencedictionary/main.nf b/tests/modules/nf-core/picard/createsequencedictionary/main.nf deleted file mode 100644 index fcdc50b641d..00000000000 --- a/tests/modules/nf-core/picard/createsequencedictionary/main.nf +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { PICARD_CREATESEQUENCEDICTIONARY } from '../../../../../modules/nf-core/picard/createsequencedictionary/main.nf' - -workflow test_picard_createsequencedictionary { - - input = [ - [ id:'test' ], // meta map - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) - ] - - PICARD_CREATESEQUENCEDICTIONARY ( input ) -} diff --git a/tests/modules/nf-core/picard/createsequencedictionary/nextflow.config b/tests/modules/nf-core/picard/createsequencedictionary/nextflow.config deleted file mode 100644 index 50f50a7a357..00000000000 --- a/tests/modules/nf-core/picard/createsequencedictionary/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/picard/createsequencedictionary/test.yml b/tests/modules/nf-core/picard/createsequencedictionary/test.yml deleted file mode 100644 index ba2f1248264..00000000000 --- a/tests/modules/nf-core/picard/createsequencedictionary/test.yml +++ /dev/null @@ -1,9 +0,0 @@ -- name: picard createsequencedictionary test_picard_createsequencedictionary - command: nextflow run ./tests/modules/nf-core/picard/createsequencedictionary -entry test_picard_createsequencedictionary -c ./tests/config/nextflow.config - tags: - - picard/createsequencedictionary - - picard - files: - - path: output/picard/test.dict - contains: ["SN:MT192765.1"] - - path: output/picard/versions.yml