From d8985998a2a05f5a0431d4137c0ab9992d91f0e8 Mon Sep 17 00:00:00 2001 From: Joon Klaps <61584065+Joon-Klaps@users.noreply.github.com> Date: Mon, 22 Jan 2024 12:30:37 +0100 Subject: [PATCH] Kaiju version bump- nf-test -add stub (#4781) * kaiju modules patch * add kaiju nf-test and stub * adding test & stub 4 kaiju2krona * undo raven change * kaiju2table & kaijumkfmi * Add taxonomic profiling as a keyword in meta.yml --- modules/nf-core/kaiju/kaiju/environment.yml | 2 +- modules/nf-core/kaiju/kaiju/main.nf | 18 ++- modules/nf-core/kaiju/kaiju/meta.yml | 2 +- .../nf-core/kaiju/kaiju/tests/main.nf.test | 117 ++++++++++++++++++ .../kaiju/kaiju/tests/main.nf.test.snap | 8 ++ modules/nf-core/kaiju/kaiju/tests/tags.yml | 2 + .../nf-core/kaiju/kaiju2krona/environment.yml | 2 +- modules/nf-core/kaiju/kaiju2krona/main.nf | 17 ++- .../kaiju/kaiju2krona/tests/main.nf.test | 105 ++++++++++++++++ .../kaiju/kaiju2krona/tests/main.nf.test.snap | 39 ++++++ .../nf-core/kaiju/kaiju2krona/tests/tags.yml | 2 + .../nf-core/kaiju/kaiju2table/environment.yml | 2 +- modules/nf-core/kaiju/kaiju2table/main.nf | 24 +++- modules/nf-core/kaiju/kaiju2table/meta.yml | 1 + .../kaiju/kaiju2table/tests/main.nf.test | 106 ++++++++++++++++ .../kaiju/kaiju2table/tests/main.nf.test.snap | 39 ++++++ .../nf-core/kaiju/kaiju2table/tests/tags.yml | 2 + modules/nf-core/kaiju/mkfmi/environment.yml | 7 ++ modules/nf-core/kaiju/mkfmi/main.nf | 18 ++- .../nf-core/kaiju/mkfmi/tests/main.nf.test | 58 +++++++++ .../kaiju/mkfmi/tests/main.nf.test.snap | 39 ++++++ .../nf-core/kaiju/mkfmi/tests/nextflow.config | 5 + modules/nf-core/kaiju/mkfmi/tests/tags.yml | 2 + tests/config/pytest_modules.yml | 12 -- tests/modules/nf-core/kaiju/kaiju/main.nf | 32 ----- .../nf-core/kaiju/kaiju/nextflow.config | 5 - tests/modules/nf-core/kaiju/kaiju/test.yml | 21 ---- .../modules/nf-core/kaiju/kaiju2krona/main.nf | 20 --- .../nf-core/kaiju/kaiju2krona/nextflow.config | 5 - .../nf-core/kaiju/kaiju2krona/test.yml | 8 -- .../modules/nf-core/kaiju/kaiju2table/main.nf | 21 ---- .../nf-core/kaiju/kaiju2table/nextflow.config | 5 - .../nf-core/kaiju/kaiju2table/test.yml | 9 -- tests/modules/nf-core/kaiju/mkfmi/main.nf | 15 --- .../nf-core/kaiju/mkfmi/nextflow.config | 9 -- tests/modules/nf-core/kaiju/mkfmi/test.yml | 9 -- 36 files changed, 600 insertions(+), 188 deletions(-) create mode 100644 modules/nf-core/kaiju/kaiju/tests/main.nf.test create mode 100644 modules/nf-core/kaiju/kaiju/tests/main.nf.test.snap create mode 100644 modules/nf-core/kaiju/kaiju/tests/tags.yml create mode 100644 modules/nf-core/kaiju/kaiju2krona/tests/main.nf.test create mode 100644 modules/nf-core/kaiju/kaiju2krona/tests/main.nf.test.snap create mode 100644 modules/nf-core/kaiju/kaiju2krona/tests/tags.yml create mode 100644 modules/nf-core/kaiju/kaiju2table/tests/main.nf.test create mode 100644 modules/nf-core/kaiju/kaiju2table/tests/main.nf.test.snap create mode 100644 modules/nf-core/kaiju/kaiju2table/tests/tags.yml create mode 100644 modules/nf-core/kaiju/mkfmi/environment.yml create mode 100644 modules/nf-core/kaiju/mkfmi/tests/main.nf.test create mode 100644 modules/nf-core/kaiju/mkfmi/tests/main.nf.test.snap create mode 100644 modules/nf-core/kaiju/mkfmi/tests/nextflow.config create mode 100644 modules/nf-core/kaiju/mkfmi/tests/tags.yml delete mode 100644 tests/modules/nf-core/kaiju/kaiju/main.nf delete mode 100644 tests/modules/nf-core/kaiju/kaiju/nextflow.config delete mode 100644 tests/modules/nf-core/kaiju/kaiju/test.yml delete mode 100644 tests/modules/nf-core/kaiju/kaiju2krona/main.nf delete mode 100644 tests/modules/nf-core/kaiju/kaiju2krona/nextflow.config delete mode 100644 tests/modules/nf-core/kaiju/kaiju2krona/test.yml delete mode 100644 tests/modules/nf-core/kaiju/kaiju2table/main.nf delete mode 100644 tests/modules/nf-core/kaiju/kaiju2table/nextflow.config delete mode 100644 tests/modules/nf-core/kaiju/kaiju2table/test.yml delete mode 100644 tests/modules/nf-core/kaiju/mkfmi/main.nf delete mode 100644 tests/modules/nf-core/kaiju/mkfmi/nextflow.config delete mode 100644 tests/modules/nf-core/kaiju/mkfmi/test.yml diff --git a/modules/nf-core/kaiju/kaiju/environment.yml b/modules/nf-core/kaiju/kaiju/environment.yml index dd491adb36be..baac450b265f 100644 --- a/modules/nf-core/kaiju/kaiju/environment.yml +++ b/modules/nf-core/kaiju/kaiju/environment.yml @@ -4,4 +4,4 @@ channels: - bioconda - defaults dependencies: - - bioconda::kaiju=1.8.2 + - bioconda::kaiju=1.10.0 diff --git a/modules/nf-core/kaiju/kaiju/main.nf b/modules/nf-core/kaiju/kaiju/main.nf index 308048a86e85..2f5f6e7d8c9d 100644 --- a/modules/nf-core/kaiju/kaiju/main.nf +++ b/modules/nf-core/kaiju/kaiju/main.nf @@ -4,8 +4,8 @@ process KAIJU_KAIJU { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/kaiju:1.8.2--h5b5514e_1': - 'biocontainers/kaiju:1.8.2--h5b5514e_1' }" + 'https://depot.galaxyproject.org/singularity/kaiju:1.10.0--h43eeafb_0': + 'biocontainers/kaiju:1.10.0--h43eeafb_0' }" input: tuple val(meta), path(reads) @@ -38,4 +38,18 @@ process KAIJU_KAIJU { kaiju: \$(echo \$( kaiju -h 2>&1 | sed -n 1p | sed 's/^.*Kaiju //' )) END_VERSIONS """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def input = meta.single_end ? "-i ${reads}" : "-i ${reads[0]} -j ${reads[1]}" + """ + touch ${prefix}.tsv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + kaiju: \$(echo \$( kaiju -h 2>&1 | sed -n 1p | sed 's/^.*Kaiju //' )) + END_VERSIONS + """ + } diff --git a/modules/nf-core/kaiju/kaiju/meta.yml b/modules/nf-core/kaiju/kaiju/meta.yml index 7a6840fedede..33c85690757f 100644 --- a/modules/nf-core/kaiju/kaiju/meta.yml +++ b/modules/nf-core/kaiju/kaiju/meta.yml @@ -26,7 +26,7 @@ input: respectively. pattern: "*.{fastq,fq,fasta,fa,fsa,fas,fna,fastq.gz,fq.gz,fasta.gz,fa.gz,fsa.gz,fas.gz,fna.gz}" - db: - type: files + type: directory description: | List containing the database and nodes files for Kaiju e.g. [ 'database.fmi', 'nodes.dmp' ] diff --git a/modules/nf-core/kaiju/kaiju/tests/main.nf.test b/modules/nf-core/kaiju/kaiju/tests/main.nf.test new file mode 100644 index 000000000000..ede2f9525219 --- /dev/null +++ b/modules/nf-core/kaiju/kaiju/tests/main.nf.test @@ -0,0 +1,117 @@ +nextflow_process { + + name "Test Process KAIJU_KAIJU" + script "../main.nf" + process "KAIJU_KAIJU" + + tag "modules" + tag "modules_nfcore" + tag "kaiju" + tag "kaiju/kaiju" + tag "untar" + + test("sarscov2 - fastq - single-end") { + + setup { + run ("UNTAR"){ + script "../../../untar/main.nf" + process { + """ + input[0] = [ [], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/kaiju.tar.gz', checkIfExists: true) ] + """ + } + } + } + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:true ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) + ] + input[1] = UNTAR.out.untar.map{ it[1] } + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.results[0][1]).getText().contains("C\tERR5069949.2257580\t2697049") } + ) + } + + } + + test("sarscov2 - fastq - paired-end") { + + setup { + run ("UNTAR"){ + script "../../../untar/main.nf" + process { + """ + input[0] = [ [], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/kaiju.tar.gz', checkIfExists: true) ] + """ + } + } + } + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], + [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true)] + ] + input[1] = UNTAR.out.untar.map{ it[1] } + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.results[0][1]).getText().contains("C\tERR5069949.2257580\t2697049") } + ) + } + } + + test("sarscov2 - fastq - stub") { + + options '-stub' + + setup { + run ("UNTAR"){ + script "../../../untar/main.nf" + process { + """ + input[0] = [ [], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/kaiju.tar.gz', checkIfExists: true) ] + """ + } + } + } + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], + [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true)] + ] + input[1] = UNTAR.out.untar.map{ it[1] } + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(file(process.out.results[0][1]).name).match() } + ) + } + } + +} diff --git a/modules/nf-core/kaiju/kaiju/tests/main.nf.test.snap b/modules/nf-core/kaiju/kaiju/tests/main.nf.test.snap new file mode 100644 index 000000000000..08735f477b64 --- /dev/null +++ b/modules/nf-core/kaiju/kaiju/tests/main.nf.test.snap @@ -0,0 +1,8 @@ +{ + "sarscov2 - fastq - stub": { + "content": [ + "test.tsv" + ], + "timestamp": "2024-01-20T14:44:57.116024519" + } +} \ No newline at end of file diff --git a/modules/nf-core/kaiju/kaiju/tests/tags.yml b/modules/nf-core/kaiju/kaiju/tests/tags.yml new file mode 100644 index 000000000000..c73d4df5cb28 --- /dev/null +++ b/modules/nf-core/kaiju/kaiju/tests/tags.yml @@ -0,0 +1,2 @@ +kaiju/kaiju: + - "modules/nf-core/kaiju/kaiju/**" diff --git a/modules/nf-core/kaiju/kaiju2krona/environment.yml b/modules/nf-core/kaiju/kaiju2krona/environment.yml index f3d27c307b0d..2905be97f692 100644 --- a/modules/nf-core/kaiju/kaiju2krona/environment.yml +++ b/modules/nf-core/kaiju/kaiju2krona/environment.yml @@ -4,4 +4,4 @@ channels: - bioconda - defaults dependencies: - - bioconda::kaiju=1.8.2 + - bioconda::kaiju=1.10.0 diff --git a/modules/nf-core/kaiju/kaiju2krona/main.nf b/modules/nf-core/kaiju/kaiju2krona/main.nf index 86d596de68b9..85d2dfd2a7bc 100644 --- a/modules/nf-core/kaiju/kaiju2krona/main.nf +++ b/modules/nf-core/kaiju/kaiju2krona/main.nf @@ -4,8 +4,8 @@ process KAIJU_KAIJU2KRONA { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/kaiju:1.8.2--h5b5514e_1': - 'biocontainers/kaiju:1.8.2--h5b5514e_1' }" + 'https://depot.galaxyproject.org/singularity/kaiju:1.10.0--h43eeafb_0': + 'biocontainers/kaiju:1.10.0--h43eeafb_0' }" input: tuple val(meta), path(tsv) @@ -36,4 +36,17 @@ process KAIJU_KAIJU2KRONA { kaiju: \$(echo \$( kaiju -h 2>&1 | sed -n 1p | sed 's/^.*Kaiju //' )) END_VERSIONS """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.txt + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + kaiju: \$(echo \$( kaiju -h 2>&1 | sed -n 1p | sed 's/^.*Kaiju //' )) + END_VERSIONS + """ } + diff --git a/modules/nf-core/kaiju/kaiju2krona/tests/main.nf.test b/modules/nf-core/kaiju/kaiju2krona/tests/main.nf.test new file mode 100644 index 000000000000..cf522cd0fa28 --- /dev/null +++ b/modules/nf-core/kaiju/kaiju2krona/tests/main.nf.test @@ -0,0 +1,105 @@ +nextflow_process { + + name "Test Process KAIJU_KAIJU2KRONA" + script "../main.nf" + process "KAIJU_KAIJU2KRONA" + + tag "modules" + tag "modules_nfcore" + tag "kaiju" + tag "kaiju/kaiju2krona" + tag "kaiju/kaiju" + tag "untar" + + test("sarscov2 - fastq - single-end") { + + + setup { + run ("UNTAR"){ + script "../../../untar/main.nf" + process { + """ + input[0] = [ [], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/kaiju.tar.gz', checkIfExists: true) ] + """ + } + } + + run("KAIJU_KAIJU") { + script "../../kaiju/main.nf" + process { + """ + input[0] = [ + [ id:'test', single_end:true ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) + ] + input[1] = UNTAR.out.untar.map{ it[1] } + """ + } + } + } + + when { + process { + """ + input[0] = KAIJU_KAIJU.out.results + input[1] = UNTAR.out.untar.map{ it[1] } + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("sarscov2 - fastq - stub") { + + options "-stub" + + setup { + run ("UNTAR"){ + script "../../../untar/main.nf" + process { + """ + input[0] = [ [], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/kaiju.tar.gz', checkIfExists: true) ] + """ + } + } + + run("KAIJU_KAIJU") { + script "../../kaiju/main.nf" + process { + """ + input[0] = [ + [ id:'test', single_end:true ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) + ] + input[1] = UNTAR.out.untar.map{ it[1] } + """ + } + } + } + + when { + process { + """ + input[0] = KAIJU_KAIJU.out.results + input[1] = UNTAR.out.untar.map{ it[1] } + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(file(process.out.txt[0][1]).name).match() } + ) + } + + } + +} diff --git a/modules/nf-core/kaiju/kaiju2krona/tests/main.nf.test.snap b/modules/nf-core/kaiju/kaiju2krona/tests/main.nf.test.snap new file mode 100644 index 000000000000..5532a6948cab --- /dev/null +++ b/modules/nf-core/kaiju/kaiju2krona/tests/main.nf.test.snap @@ -0,0 +1,39 @@ +{ + "sarscov2 - fastq - stub": { + "content": [ + "test.txt" + ], + "timestamp": "2024-01-20T15:06:32.789121011" + }, + "sarscov2 - fastq - single-end": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test.txt:md5,68b2309d37767e444193fa6cea7c0494" + ] + ], + "1": [ + "versions.yml:md5,f75aa349971d581981d3a0399450b395" + ], + "txt": [ + [ + { + "id": "test", + "single_end": true + }, + "test.txt:md5,68b2309d37767e444193fa6cea7c0494" + ] + ], + "versions": [ + "versions.yml:md5,f75aa349971d581981d3a0399450b395" + ] + } + ], + "timestamp": "2024-01-20T15:06:08.840865115" + } +} \ No newline at end of file diff --git a/modules/nf-core/kaiju/kaiju2krona/tests/tags.yml b/modules/nf-core/kaiju/kaiju2krona/tests/tags.yml new file mode 100644 index 000000000000..661fe924da1d --- /dev/null +++ b/modules/nf-core/kaiju/kaiju2krona/tests/tags.yml @@ -0,0 +1,2 @@ +kaiju/kaiju2krona: + - "modules/nf-core/kaiju/kaiju2krona/**" diff --git a/modules/nf-core/kaiju/kaiju2table/environment.yml b/modules/nf-core/kaiju/kaiju2table/environment.yml index 81a6ca0bc0d2..18685f415760 100644 --- a/modules/nf-core/kaiju/kaiju2table/environment.yml +++ b/modules/nf-core/kaiju/kaiju2table/environment.yml @@ -4,4 +4,4 @@ channels: - bioconda - defaults dependencies: - - bioconda::kaiju=1.8.2 + - bioconda::kaiju=1.10.0 diff --git a/modules/nf-core/kaiju/kaiju2table/main.nf b/modules/nf-core/kaiju/kaiju2table/main.nf index 173e2bb12ed5..44049744ada6 100644 --- a/modules/nf-core/kaiju/kaiju2table/main.nf +++ b/modules/nf-core/kaiju/kaiju2table/main.nf @@ -4,11 +4,11 @@ process KAIJU_KAIJU2TABLE { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/kaiju:1.8.2--h5b5514e_1': - 'biocontainers/kaiju:1.8.2--h2e03b76_0' }" + 'https://depot.galaxyproject.org/singularity/kaiju:1.10.0--h43eeafb_0': + 'biocontainers/kaiju:1.10.0--h43eeafb_0' }" input: - tuple val(meta), path(results) + tuple val(meta), path(input) path db val taxon_rank @@ -24,13 +24,25 @@ process KAIJU_KAIJU2TABLE { def prefix = task.ext.prefix ?: "${meta.id}" """ dbnodes=`find -L ${db} -name "*nodes.dmp"` - dbname=`find -L ${db} -name "*.fmi" -not -name "._*"` + dbnames=`find -L ${db} -name "*names.dmp"` kaiju2table $args \\ -t \$dbnodes \\ - -n \$dbname \\ + -n \$dbnames \\ -r ${taxon_rank} \\ -o ${prefix}.txt \\ - ${results} + ${input} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + kaiju: \$(echo \$( kaiju -h 2>&1 | sed -n 1p | sed 's/^.*Kaiju //' )) + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.txt cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/kaiju/kaiju2table/meta.yml b/modules/nf-core/kaiju/kaiju2table/meta.yml index 077e82de6e8d..0f62374e8c5c 100644 --- a/modules/nf-core/kaiju/kaiju2table/meta.yml +++ b/modules/nf-core/kaiju/kaiju2table/meta.yml @@ -3,6 +3,7 @@ description: write your description here keywords: - classify - metagenomics + - taxonomic profiling tools: - kaiju: description: Fast and sensitive taxonomic classification for metagenomics diff --git a/modules/nf-core/kaiju/kaiju2table/tests/main.nf.test b/modules/nf-core/kaiju/kaiju2table/tests/main.nf.test new file mode 100644 index 000000000000..d93fb31ac414 --- /dev/null +++ b/modules/nf-core/kaiju/kaiju2table/tests/main.nf.test @@ -0,0 +1,106 @@ +nextflow_process { + + name "Test Process KAIJU_KAIJU2TABLE" + script "../main.nf" + process "KAIJU_KAIJU2TABLE" + + tag "modules" + tag "modules_nfcore" + tag "kaiju" + tag "kaiju/kaiju2table" + tag "kaiju/kaiju" + tag "untar" + + test("sarscov2 - fastq - single-end") { + + + setup { + run ("UNTAR"){ + script "../../../untar/main.nf" + process { + """ + input[0] = [ [], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/kaiju.tar.gz', checkIfExists: true) ] + """ + } + } + + run("KAIJU_KAIJU") { + script "../../kaiju/main.nf" + process { + """ + input[0] = [ + [ id:'test', single_end:true ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) + ] + input[1] = UNTAR.out.untar.map{ it[1] } + """ + } + } + } + + when { + process { + """ + input[0] = KAIJU_KAIJU.out.results + input[1] = UNTAR.out.untar.map{ it[1] } + input[2] = 'species' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("sarscov2 - fastq - stub") { + + options "-stub" + + setup { + run ("UNTAR"){ + script "../../../untar/main.nf" + process { + """ + input[0] = [ [], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/kaiju.tar.gz', checkIfExists: true) ] + """ + } + } + + run("KAIJU_KAIJU") { + script "../../kaiju/main.nf" + process { + """ + input[0] = [ + [ id:'test', single_end:true ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) + ] + input[1] = UNTAR.out.untar.map{ it[1] } + """ + } + } + } + + when { + process { + """ + input[0] = KAIJU_KAIJU.out.results + input[1] = UNTAR.out.untar.map{ it[1] } + input[2] = 'species' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(file(process.out.summary[0][1]).name).match() } + ) + } + + } +} diff --git a/modules/nf-core/kaiju/kaiju2table/tests/main.nf.test.snap b/modules/nf-core/kaiju/kaiju2table/tests/main.nf.test.snap new file mode 100644 index 000000000000..e97eb8b88040 --- /dev/null +++ b/modules/nf-core/kaiju/kaiju2table/tests/main.nf.test.snap @@ -0,0 +1,39 @@ +{ + "sarscov2 - fastq - stub": { + "content": [ + "test.txt" + ], + "timestamp": "2024-01-20T16:10:49.521322767" + }, + "sarscov2 - fastq - single-end": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test.txt:md5,0d9f8fd36fcf2888296ae12632c5f0a8" + ] + ], + "1": [ + "versions.yml:md5,2b2b98cb635a611e5eb964e5a77f6248" + ], + "summary": [ + [ + { + "id": "test", + "single_end": true + }, + "test.txt:md5,0d9f8fd36fcf2888296ae12632c5f0a8" + ] + ], + "versions": [ + "versions.yml:md5,2b2b98cb635a611e5eb964e5a77f6248" + ] + } + ], + "timestamp": "2024-01-20T16:08:47.644443775" + } +} diff --git a/modules/nf-core/kaiju/kaiju2table/tests/tags.yml b/modules/nf-core/kaiju/kaiju2table/tests/tags.yml new file mode 100644 index 000000000000..0fa6b81e7368 --- /dev/null +++ b/modules/nf-core/kaiju/kaiju2table/tests/tags.yml @@ -0,0 +1,2 @@ +kaiju/kaiju2table: + - "modules/nf-core/kaiju/kaiju2table/**" diff --git a/modules/nf-core/kaiju/mkfmi/environment.yml b/modules/nf-core/kaiju/mkfmi/environment.yml new file mode 100644 index 000000000000..9b66ea1eaa1f --- /dev/null +++ b/modules/nf-core/kaiju/mkfmi/environment.yml @@ -0,0 +1,7 @@ +name: kaiju_mkfmi +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::kaiju=1.10.0 diff --git a/modules/nf-core/kaiju/mkfmi/main.nf b/modules/nf-core/kaiju/mkfmi/main.nf index bd9bad6abaa2..d08be63bb5e7 100644 --- a/modules/nf-core/kaiju/mkfmi/main.nf +++ b/modules/nf-core/kaiju/mkfmi/main.nf @@ -2,10 +2,10 @@ process KAIJU_MKFMI { tag "$meta.id" label 'process_high' - conda "bioconda::kaiju=1.9.2" + conda "bioconda::kaiju=1.10.0" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/kaiju:1.9.2--h5b5514e_0': - 'biocontainers/kaiju:1.9.2--h5b5514e_0' }" + 'https://depot.galaxyproject.org/singularity/kaiju:1.10.0--h43eeafb_0': + 'biocontainers/kaiju:1.10.0--h43eeafb_0' }" input: tuple val(meta), path(fasta) @@ -33,4 +33,16 @@ process KAIJU_MKFMI { kaiju: \$(echo \$( kaiju -h 2>&1 | sed -n 1p | sed 's/^.*Kaiju //' )) END_VERSIONS """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.fmi + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + kaiju: \$(echo \$( kaiju -h 2>&1 | sed -n 1p | sed 's/^.*Kaiju //' )) + END_VERSIONS + """ } diff --git a/modules/nf-core/kaiju/mkfmi/tests/main.nf.test b/modules/nf-core/kaiju/mkfmi/tests/main.nf.test new file mode 100644 index 000000000000..d8062b0b9f92 --- /dev/null +++ b/modules/nf-core/kaiju/mkfmi/tests/main.nf.test @@ -0,0 +1,58 @@ +nextflow_process { + + name "Test Process KAIJU_MKFMI" + script "../main.nf" + process "KAIJU_MKFMI" + + tag "modules" + tag "modules_nfcore" + tag "kaiju" + tag "kaiju/mkfmi" + + test("sarscov2 - proteome - fasta") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:true ], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("sarscov2 - fasta - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:true ], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(file(process.out.fmi[0][1]).name).match() } + ) + } + + } + +} diff --git a/modules/nf-core/kaiju/mkfmi/tests/main.nf.test.snap b/modules/nf-core/kaiju/mkfmi/tests/main.nf.test.snap new file mode 100644 index 000000000000..9120a164e4f3 --- /dev/null +++ b/modules/nf-core/kaiju/mkfmi/tests/main.nf.test.snap @@ -0,0 +1,39 @@ +{ + "sarscov2 - fasta - stub": { + "content": [ + "test.fmi" + ], + "timestamp": "2024-01-20T16:27:00.670884904" + }, + "sarscov2 - proteome - fasta": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fmi:md5,54fd89f5e4eab61af30175e8aa389598" + ] + ], + "1": [ + "versions.yml:md5,3cbd427d0187ffee188347830d33dc12" + ], + "fmi": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fmi:md5,54fd89f5e4eab61af30175e8aa389598" + ] + ], + "versions": [ + "versions.yml:md5,3cbd427d0187ffee188347830d33dc12" + ] + } + ], + "timestamp": "2024-01-20T16:26:48.062489887" + } +} \ No newline at end of file diff --git a/modules/nf-core/kaiju/mkfmi/tests/nextflow.config b/modules/nf-core/kaiju/mkfmi/tests/nextflow.config new file mode 100644 index 000000000000..ae99671ff4b3 --- /dev/null +++ b/modules/nf-core/kaiju/mkfmi/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: KAIJU_MKFMI { + ext.args = '-a ACDEFGHIKLMNPQRSTVWY' + } +} \ No newline at end of file diff --git a/modules/nf-core/kaiju/mkfmi/tests/tags.yml b/modules/nf-core/kaiju/mkfmi/tests/tags.yml new file mode 100644 index 000000000000..ee1305f23f1c --- /dev/null +++ b/modules/nf-core/kaiju/mkfmi/tests/tags.yml @@ -0,0 +1,2 @@ +kaiju/mkfmi: + - "modules/nf-core/kaiju/mkfmi/**" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 0dbe8e17ab45..36554980c9ab 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1245,18 +1245,6 @@ jasminesv: jupyternotebook: - modules/nf-core/jupyternotebook/** - tests/modules/nf-core/jupyternotebook/** -kaiju/kaiju: - - modules/nf-core/kaiju/kaiju/** - - tests/modules/nf-core/kaiju/kaiju/** -kaiju/kaiju2krona: - - modules/nf-core/kaiju/kaiju2krona/** - - tests/modules/nf-core/kaiju/kaiju2krona/** -kaiju/kaiju2table: - - modules/nf-core/kaiju/kaiju2table/** - - tests/modules/nf-core/kaiju/kaiju2table/** -kaiju/mkfmi: - - modules/nf-core/kaiju/mkfmi/** - - tests/modules/nf-core/kaiju/mkfmi/** kallistobustools/count: - modules/nf-core/kallistobustools/count/** - tests/modules/nf-core/kallistobustools/count/** diff --git a/tests/modules/nf-core/kaiju/kaiju/main.nf b/tests/modules/nf-core/kaiju/kaiju/main.nf deleted file mode 100644 index c2b1d60e7121..000000000000 --- a/tests/modules/nf-core/kaiju/kaiju/main.nf +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { UNTAR } from '../../../../../modules/nf-core/untar/main.nf' -include { KAIJU_KAIJU } from '../../../../../modules/nf-core/kaiju/kaiju/main.nf' - -workflow test_kaiju_kaiju_single_end { - - input = [ - [ id:'test', single_end:true ], // meta map - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) - ] - db = [ [], file(params.test_data['sarscov2']['genome']['kaiju_tar_gz'], checkIfExists: true) ] - - UNTAR ( db ) - KAIJU_KAIJU ( input, UNTAR.out.untar.map{ it[1] } ) -} - -workflow test_kaiju_kaiju_paired_end { - - input = [ - [ id:'test', single_end:false ], // meta map - [ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) ] - ] - db = [ [], file(params.test_data['sarscov2']['genome']['kaiju_tar_gz'], checkIfExists: true) ] - - UNTAR ( db ) - KAIJU_KAIJU ( input, UNTAR.out.untar.map{ it[1] } ) - -} diff --git a/tests/modules/nf-core/kaiju/kaiju/nextflow.config b/tests/modules/nf-core/kaiju/kaiju/nextflow.config deleted file mode 100644 index 50f50a7a3579..000000000000 --- a/tests/modules/nf-core/kaiju/kaiju/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/kaiju/kaiju/test.yml b/tests/modules/nf-core/kaiju/kaiju/test.yml deleted file mode 100644 index 9e495ede0b05..000000000000 --- a/tests/modules/nf-core/kaiju/kaiju/test.yml +++ /dev/null @@ -1,21 +0,0 @@ -- name: kaiju kaiju test_kaiju_kaiju_single_end - command: nextflow run ./tests/modules/nf-core/kaiju/kaiju -entry test_kaiju_kaiju_single_end -c ./tests/config/nextflow.config - tags: - - kaiju/kaiju - - kaiju - files: - - path: output/kaiju/test.tsv - contains: ["C\tERR5069949.2257580\t2697049"] - - path: output/kaiju/versions.yml - md5sum: 7e218c0ea00a71dd3a5ec5aaf28804f4 - -- name: kaiju kaiju test_kaiju_kaiju_paired_end - command: nextflow run ./tests/modules/nf-core/kaiju/kaiju -entry test_kaiju_kaiju_paired_end -c ./tests/config/nextflow.config - tags: - - kaiju/kaiju - - kaiju - files: - - path: output/kaiju/test.tsv - contains: ["C\tERR5069949.2257580\t2697049"] - - path: output/kaiju/versions.yml - md5sum: a74215f6f69979ae046fb1d65c56ac67 diff --git a/tests/modules/nf-core/kaiju/kaiju2krona/main.nf b/tests/modules/nf-core/kaiju/kaiju2krona/main.nf deleted file mode 100644 index 62adf390caf5..000000000000 --- a/tests/modules/nf-core/kaiju/kaiju2krona/main.nf +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { UNTAR } from '../../../../../modules/nf-core/untar/main.nf' -include { KAIJU_KAIJU } from '../../../../../modules/nf-core/kaiju/kaiju/main.nf' -include { KAIJU_KAIJU2KRONA } from '../../../../../modules/nf-core/kaiju/kaiju2krona/main.nf' - -workflow test_kaiju_kaiju2krona { - - input = [ - [ id:'test', single_end:true ], // meta map - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) - ] - db = [ [], file(params.test_data['sarscov2']['genome']['kaiju_tar_gz'], checkIfExists: true) ] - - UNTAR ( db ) - KAIJU_KAIJU ( input, UNTAR.out.untar.map{ it[1] } ) - KAIJU_KAIJU2KRONA ( KAIJU_KAIJU.out.results , UNTAR.out.untar.map{ it[1] } ) -} diff --git a/tests/modules/nf-core/kaiju/kaiju2krona/nextflow.config b/tests/modules/nf-core/kaiju/kaiju2krona/nextflow.config deleted file mode 100644 index 50f50a7a3579..000000000000 --- a/tests/modules/nf-core/kaiju/kaiju2krona/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/kaiju/kaiju2krona/test.yml b/tests/modules/nf-core/kaiju/kaiju2krona/test.yml deleted file mode 100644 index 1dcf0565645d..000000000000 --- a/tests/modules/nf-core/kaiju/kaiju2krona/test.yml +++ /dev/null @@ -1,8 +0,0 @@ -- name: kaiju kaiju2krona test_kaiju_kaiju2krona - command: nextflow run ./tests/modules/nf-core/kaiju/kaiju2krona -entry test_kaiju_kaiju2krona -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/kaiju/kaiju2krona/nextflow.config - tags: - - kaiju/kaiju2krona - - kaiju - files: - - path: output/kaiju/test.txt - md5sum: 68b2309d37767e444193fa6cea7c0494 diff --git a/tests/modules/nf-core/kaiju/kaiju2table/main.nf b/tests/modules/nf-core/kaiju/kaiju2table/main.nf deleted file mode 100644 index 413a7b39a930..000000000000 --- a/tests/modules/nf-core/kaiju/kaiju2table/main.nf +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { UNTAR } from '../../../../../modules/nf-core/untar/main.nf' -include { KAIJU_KAIJU } from '../../../../../modules/nf-core/kaiju/kaiju/main.nf' -include { KAIJU_KAIJU2TABLE } from '../../../../../modules/nf-core/kaiju/kaiju2table/main.nf' - -workflow test_kaiju_kaiju_single_end { - - input = [ - [ id:'test', single_end:true ], // meta map - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) - ] - db = [ [], file(params.test_data['sarscov2']['genome']['kaiju_tar_gz'], checkIfExists: true) ] - taxon_rank = "species" - - ch_db = UNTAR ( db ) - KAIJU_KAIJU ( input, ch_db.untar.map{ it[1] } ) - KAIJU_KAIJU2TABLE ( KAIJU_KAIJU.out.results, ch_db.untar.map{ it[1] }, taxon_rank ) -} diff --git a/tests/modules/nf-core/kaiju/kaiju2table/nextflow.config b/tests/modules/nf-core/kaiju/kaiju2table/nextflow.config deleted file mode 100644 index 50f50a7a3579..000000000000 --- a/tests/modules/nf-core/kaiju/kaiju2table/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/kaiju/kaiju2table/test.yml b/tests/modules/nf-core/kaiju/kaiju2table/test.yml deleted file mode 100644 index aeb1fd57d753..000000000000 --- a/tests/modules/nf-core/kaiju/kaiju2table/test.yml +++ /dev/null @@ -1,9 +0,0 @@ -- name: kaiju kaiju2table test_kaiju_kaiju_single_end - command: nextflow run ./tests/modules/nf-core/kaiju/kaiju2table -entry test_kaiju_kaiju_single_end -c ./tests/config/nextflow.config - tags: - - kaiju - - kaiju/kaiju2table - files: - - path: output/kaiju/test.txt - md5sum: 0d9f8fd36fcf2888296ae12632c5f0a8 - - path: output/kaiju/versions.yml diff --git a/tests/modules/nf-core/kaiju/mkfmi/main.nf b/tests/modules/nf-core/kaiju/mkfmi/main.nf deleted file mode 100644 index 488268969c1f..000000000000 --- a/tests/modules/nf-core/kaiju/mkfmi/main.nf +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { KAIJU_MKFMI } from '../../../../../modules/nf-core/kaiju/mkfmi/main.nf' - -workflow test_kaiju_mkfmi { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['genome']['proteome_fasta'], checkIfExists: true) - ] - - KAIJU_MKFMI ( input ) -} diff --git a/tests/modules/nf-core/kaiju/mkfmi/nextflow.config b/tests/modules/nf-core/kaiju/mkfmi/nextflow.config deleted file mode 100644 index cfcf98872bc6..000000000000 --- a/tests/modules/nf-core/kaiju/mkfmi/nextflow.config +++ /dev/null @@ -1,9 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: KAIJU_MKFMI { - ext.args = '-a ACDEFGHIKLMNPQRSTVWY' - } - -} \ No newline at end of file diff --git a/tests/modules/nf-core/kaiju/mkfmi/test.yml b/tests/modules/nf-core/kaiju/mkfmi/test.yml deleted file mode 100644 index 8c44efce1af0..000000000000 --- a/tests/modules/nf-core/kaiju/mkfmi/test.yml +++ /dev/null @@ -1,9 +0,0 @@ -- name: kaiju mkfmi test_kaiju_mkfmi - command: nextflow run ./tests/modules/nf-core/kaiju/mkfmi -entry test_kaiju_mkfmi -c ./tests/config/nextflow.config - tags: - - kaiju/mkfmi - - kaiju - files: - - path: output/kaiju/test.fmi - md5sum: 05615794180a9c2e739a9bf1c24c99d5 - - path: output/kaiju/versions.yml