From 879b9dc046df746b6a6133184fba2cce1f902597 Mon Sep 17 00:00:00 2001 From: "Diego Alvarez S." Date: Tue, 26 Nov 2024 17:09:41 -0300 Subject: [PATCH] Bump GUNC and add gunc/run test (#6920) * Bump GUNC and add gunc/run test * Fix meta, use input_dir * Add snapshots * Change strategy to preserve filenames * Add gunc/mergecheckm test * Update tags * Fix test names * Update snapshots * Add stubs * Add stub snaps * Address review comments * Set args in nextflow.config again * Comment problematic tests * Comment another test --------- Co-authored-by: Edmund Miller <20095261+edmundmiller@users.noreply.github.com> --- .../nf-core/gunc/downloaddb/environment.yml | 3 +- modules/nf-core/gunc/downloaddb/main.nf | 4 +- .../gunc/downloaddb/tests/main.nf.test.snap | 18 +- .../nf-core/gunc/mergecheckm/environment.yml | 3 +- modules/nf-core/gunc/mergecheckm/main.nf | 14 +- .../gunc/mergecheckm/tests/main.nf.test | 175 ++++++++++++++++++ .../gunc/mergecheckm/tests/main.nf.test.snap | 68 +++++++ .../gunc/mergecheckm/tests/nextflow.config | 5 + .../nf-core/gunc/mergecheckm/tests/tags.yml | 6 + modules/nf-core/gunc/run/environment.yml | 3 +- modules/nf-core/gunc/run/main.nf | 19 +- modules/nf-core/gunc/run/meta.yml | 4 +- modules/nf-core/gunc/run/tests/main.nf.test | 96 ++++++++++ .../nf-core/gunc/run/tests/main.nf.test.snap | 90 +++++++++ modules/nf-core/gunc/run/tests/tags.yml | 3 + tests/config/pytest_modules.yml | 6 - 16 files changed, 489 insertions(+), 28 deletions(-) create mode 100644 modules/nf-core/gunc/mergecheckm/tests/main.nf.test create mode 100644 modules/nf-core/gunc/mergecheckm/tests/main.nf.test.snap create mode 100644 modules/nf-core/gunc/mergecheckm/tests/nextflow.config create mode 100644 modules/nf-core/gunc/mergecheckm/tests/tags.yml create mode 100644 modules/nf-core/gunc/run/tests/main.nf.test create mode 100644 modules/nf-core/gunc/run/tests/main.nf.test.snap create mode 100644 modules/nf-core/gunc/run/tests/tags.yml diff --git a/modules/nf-core/gunc/downloaddb/environment.yml b/modules/nf-core/gunc/downloaddb/environment.yml index d7301428db4..3a0264f4371 100644 --- a/modules/nf-core/gunc/downloaddb/environment.yml +++ b/modules/nf-core/gunc/downloaddb/environment.yml @@ -1,5 +1,6 @@ channels: - conda-forge - bioconda + dependencies: - - bioconda::gunc=1.0.5 + - bioconda::gunc=1.0.6 diff --git a/modules/nf-core/gunc/downloaddb/main.nf b/modules/nf-core/gunc/downloaddb/main.nf index be43affaaa8..71cac464951 100644 --- a/modules/nf-core/gunc/downloaddb/main.nf +++ b/modules/nf-core/gunc/downloaddb/main.nf @@ -4,8 +4,8 @@ process GUNC_DOWNLOADDB { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gunc:1.0.5--pyhdfd78af_0' : - 'biocontainers/gunc:1.0.5--pyhdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gunc:1.0.6--pyhdfd78af_0' : + 'biocontainers/gunc:1.0.6--pyhdfd78af_0' }" input: val db_name diff --git a/modules/nf-core/gunc/downloaddb/tests/main.nf.test.snap b/modules/nf-core/gunc/downloaddb/tests/main.nf.test.snap index d2af3a2ee70..eac880d152e 100644 --- a/modules/nf-core/gunc/downloaddb/tests/main.nf.test.snap +++ b/modules/nf-core/gunc/downloaddb/tests/main.nf.test.snap @@ -3,14 +3,14 @@ "content": [ "gunc_db_progenomes2.1.dmnd", [ - "versions.yml:md5,ab391d00f34801f2caa143c4c05eba56" + "versions.yml:md5,5ce1c695848ee48977b982a369b01141" ] ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.4" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-09-06T10:25:14.217951" + "timestamp": "2024-11-01T07:23:05.696265018" }, "test-gunc-downloaddb-stub": { "content": [ @@ -19,20 +19,20 @@ "progenomes.dmnd:md5,d41d8cd98f00b204e9800998ecf8427e" ], "1": [ - "versions.yml:md5,ab391d00f34801f2caa143c4c05eba56" + "versions.yml:md5,5ce1c695848ee48977b982a369b01141" ], "db": [ "progenomes.dmnd:md5,d41d8cd98f00b204e9800998ecf8427e" ], "versions": [ - "versions.yml:md5,ab391d00f34801f2caa143c4c05eba56" + "versions.yml:md5,5ce1c695848ee48977b982a369b01141" ] } ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.4" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-09-06T10:25:20.120206" + "timestamp": "2024-11-01T07:23:16.109775313" } } \ No newline at end of file diff --git a/modules/nf-core/gunc/mergecheckm/environment.yml b/modules/nf-core/gunc/mergecheckm/environment.yml index d7301428db4..3a0264f4371 100644 --- a/modules/nf-core/gunc/mergecheckm/environment.yml +++ b/modules/nf-core/gunc/mergecheckm/environment.yml @@ -1,5 +1,6 @@ channels: - conda-forge - bioconda + dependencies: - - bioconda::gunc=1.0.5 + - bioconda::gunc=1.0.6 diff --git a/modules/nf-core/gunc/mergecheckm/main.nf b/modules/nf-core/gunc/mergecheckm/main.nf index 4a81db95bcc..611f916c2cd 100644 --- a/modules/nf-core/gunc/mergecheckm/main.nf +++ b/modules/nf-core/gunc/mergecheckm/main.nf @@ -4,8 +4,8 @@ process GUNC_MERGECHECKM { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gunc:1.0.5--pyhdfd78af_0' : - 'biocontainers/gunc:1.0.5--pyhdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gunc:1.0.6--pyhdfd78af_0' : + 'biocontainers/gunc:1.0.6--pyhdfd78af_0' }" input: tuple val(meta), path(gunc_file), path(checkm_file) @@ -33,4 +33,14 @@ process GUNC_MERGECHECKM { gunc: \$( gunc --version ) END_VERSIONS """ + + stub: + """ + touch gunc_merge_checkm.tsv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + gunc: \$( gunc --version ) + END_VERSIONS + """ } diff --git a/modules/nf-core/gunc/mergecheckm/tests/main.nf.test b/modules/nf-core/gunc/mergecheckm/tests/main.nf.test new file mode 100644 index 00000000000..dbd67b901d6 --- /dev/null +++ b/modules/nf-core/gunc/mergecheckm/tests/main.nf.test @@ -0,0 +1,175 @@ +nextflow_process { + + name "Test Process GUNC_MERGECHECKM" + script "../main.nf" + process "GUNC_MERGECHECKM" + config "./nextflow.config" + + tag "modules_nfcore" + tag "modules" + tag "gunc" + tag "gunc/mergecheckm" + tag "gunc/run" + tag "gunc/downloaddb" + tag "checkm/lineagewf" + tag "checkm/qa" + + // commented out because GitHub runners are not able to run this test + // test("gunc - mergecheckm") { + + // setup { + // run("CHECKM_LINEAGEWF") { + // script "../../../checkm/lineagewf/main.nf" + // process { + // """ + // input[0] = [ + // [id: 'test'], // meta map + // file( + // params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/contigs.fasta', + // checkIfExists: true + // ) + // ] + // input[1] = 'fasta' + // input[2] = [] // Download CheckM database + // """ + // } + // } + + // run("CHECKM_QA") { + // script "../../../checkm/qa/main.nf" + // process { + // """ + // input[0] = CHECKM_LINEAGEWF.out.checkm_output + // .join(CHECKM_LINEAGEWF.out.marker_file) + // .map { sample_data -> sample_data + [file('NO_FILE')] } + // input[1] = [] + // """ + // } + // } + + // run("GUNC_DOWNLOADDB") { + // script "../../downloaddb/main.nf" + // process { + // """ + // input[0] = 'progenomes' + // """ + // } + // } + + // run("GUNC_RUN") { + // script "../../run/main.nf" + // process { + // """ + // input[0] = [ + // [id: 'test'], + // [file( + // params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/contigs.fasta', + // checkIfExists: true + // )] + // ] + // input[1] = GUNC_DOWNLOADDB.out.db + // """ + // } + // } + // } + + // when { + // params { + // outdir = "${launchDir}/tests/results" + // } + // process { + // """ + // input[0] = GUNC_RUN.out.maxcss_level_tsv.join(CHECKM_QA.out.output) + // """ + // } + // } + + // then { + // assertAll( + // { assert process.success }, + // { assert snapshot(process.out).match() } + // ) + // } + + // } + + test("gunc - mergecheckm - stub") { + + options "-stub" + + setup { + run("CHECKM_LINEAGEWF") { + script "../../../checkm/lineagewf/main.nf" + process { + """ + input[0] = [ + [id: 'test'], // meta map + file( + params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/contigs.fasta', + checkIfExists: true + ) + ] + input[1] = 'fasta' + input[2] = [] // Download CheckM database + """ + } + } + + run("CHECKM_QA") { + script "../../../checkm/qa/main.nf" + process { + """ + input[0] = CHECKM_LINEAGEWF.out.checkm_output + .join(CHECKM_LINEAGEWF.out.marker_file) + .map { v -> v + [file('NO_FILE')] } + input[1] = [] + """ + } + } + + run("GUNC_DOWNLOADDB") { + script "../../downloaddb/main.nf" + process { + """ + input[0] = 'progenomes' + """ + } + } + + run("GUNC_RUN") { + script "../../run/main.nf" + process { + """ + input[0] = [ + [id: 'test'], + [file( + params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/contigs.fasta', + checkIfExists: true + )] + ] + input[1] = GUNC_DOWNLOADDB.out.db + """ + } + } + } + + when { + params { + outdir = "${launchDir}/tests/results" + } + process { + """ + input[0] = GUNC_RUN.out.maxcss_level_tsv.join(CHECKM_QA.out.output) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } +} \ No newline at end of file diff --git a/modules/nf-core/gunc/mergecheckm/tests/main.nf.test.snap b/modules/nf-core/gunc/mergecheckm/tests/main.nf.test.snap new file mode 100644 index 00000000000..807c23f21a5 --- /dev/null +++ b/modules/nf-core/gunc/mergecheckm/tests/main.nf.test.snap @@ -0,0 +1,68 @@ +{ + "gunc - mergecheckm": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "GUNC_checkM.merged.tsv:md5,24cbd3c76a36cb90ac993c83525a2c1b" + ] + ], + "1": [ + "versions.yml:md5,a94747201129170b1cfbce5e59de62b0" + ], + "tsv": [ + [ + { + "id": "test" + }, + "GUNC_checkM.merged.tsv:md5,24cbd3c76a36cb90ac993c83525a2c1b" + ] + ], + "versions": [ + "versions.yml:md5,a94747201129170b1cfbce5e59de62b0" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-22T09:37:48.146410153" + }, + "gunc - mergecheckm - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "gunc_merge_checkm.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,a94747201129170b1cfbce5e59de62b0" + ], + "tsv": [ + [ + { + "id": "test" + }, + "gunc_merge_checkm.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,a94747201129170b1cfbce5e59de62b0" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-21T16:47:06.752273424" + } +} \ No newline at end of file diff --git a/modules/nf-core/gunc/mergecheckm/tests/nextflow.config b/modules/nf-core/gunc/mergecheckm/tests/nextflow.config new file mode 100644 index 00000000000..1e9ba3dcb5d --- /dev/null +++ b/modules/nf-core/gunc/mergecheckm/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: CHECKM_QA { + ext.args = '--tab_table' + } +} diff --git a/modules/nf-core/gunc/mergecheckm/tests/tags.yml b/modules/nf-core/gunc/mergecheckm/tests/tags.yml new file mode 100644 index 00000000000..d05282f2af2 --- /dev/null +++ b/modules/nf-core/gunc/mergecheckm/tests/tags.yml @@ -0,0 +1,6 @@ +gunc/run: + - modules/nf-core/gunc/mergecheckm/** + - modules/nf-core/gunc/run/** + - modules/nf-core/gunc/downloaddb/** + - modules/nf-core/checkm/lineagewf/** + - modules/nf-core/checkm/qa/** diff --git a/modules/nf-core/gunc/run/environment.yml b/modules/nf-core/gunc/run/environment.yml index d7301428db4..3a0264f4371 100644 --- a/modules/nf-core/gunc/run/environment.yml +++ b/modules/nf-core/gunc/run/environment.yml @@ -1,5 +1,6 @@ channels: - conda-forge - bioconda + dependencies: - - bioconda::gunc=1.0.5 + - bioconda::gunc=1.0.6 diff --git a/modules/nf-core/gunc/run/main.nf b/modules/nf-core/gunc/run/main.nf index ab5ec54ba29..9ee614e4c71 100644 --- a/modules/nf-core/gunc/run/main.nf +++ b/modules/nf-core/gunc/run/main.nf @@ -4,11 +4,11 @@ process GUNC_RUN { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gunc:1.0.5--pyhdfd78af_0' : - 'biocontainers/gunc:1.0.5--pyhdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/gunc:1.0.6--pyhdfd78af_0' : + 'biocontainers/gunc:1.0.6--pyhdfd78af_0' }" input: - tuple val(meta), path(fasta) + tuple val(meta), path(fasta_files, stageAs: 'input_files/*') path(db) output: @@ -23,9 +23,10 @@ process GUNC_RUN { def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" """ + ls input_files/* > input_files.txt gunc \\ run \\ - --input_fasta $fasta \\ + --input_file input_files.txt \\ --db_file $db \\ --threads $task.cpus \\ $args @@ -35,4 +36,14 @@ process GUNC_RUN { gunc: \$( gunc --version ) END_VERSIONS """ + + stub: + """ + touch maxCSS_level.tsv all_levels.tsv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + gunc: \$( gunc --version ) + END_VERSIONS + """ } diff --git a/modules/nf-core/gunc/run/meta.yml b/modules/nf-core/gunc/run/meta.yml index 63f437f363b..3ecc0b74daa 100644 --- a/modules/nf-core/gunc/run/meta.yml +++ b/modules/nf-core/gunc/run/meta.yml @@ -22,9 +22,9 @@ input: description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] - - fasta: + - fasta_files: type: file - description: FASTA file containing contig (bins) + description: A list of FASTA files containing contig (bins) pattern: "*.fa" - - db: type: file diff --git a/modules/nf-core/gunc/run/tests/main.nf.test b/modules/nf-core/gunc/run/tests/main.nf.test new file mode 100644 index 00000000000..c1659f0c521 --- /dev/null +++ b/modules/nf-core/gunc/run/tests/main.nf.test @@ -0,0 +1,96 @@ +nextflow_process { + + name "Test Process GUNC_RUN" + script "../main.nf" + process "GUNC_RUN" + + tag "modules_nfcore" + tag "modules" + tag "gunc" + tag "gunc/run" + tag "gunc/downloaddb" + + // commented out because GitHub runners are not able to run this test + // test("gunc - run") { + + // setup { + // run("GUNC_DOWNLOADDB") { + // script "../../downloaddb/main.nf" + // process { + // """ + // input[0] = 'progenomes' + // """ + // } + // } + // } + + // when { + // params { + // outdir = "${launchDir}/tests/results" + // } + // process { + // """ + // input[0] = [ + // [id: 'test'], + // [file( + // params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/contigs.fasta', + // checkIfExists: true + // )] + // ] + // input[1] = GUNC_DOWNLOADDB.out.db + // """ + // } + // } + + // then { + // assertAll( + // { assert process.success }, + // { assert snapshot(process.out).match() } + // ) + // } + + // } + + test("gunc - run - stub") { + + options "-stub" + + setup { + run("GUNC_DOWNLOADDB") { + script "../../downloaddb/main.nf" + process { + """ + input[0] = 'progenomes' + """ + } + } + } + + when { + params { + outdir = "${launchDir}/tests/results" + } + process { + """ + input[0] = [ + [id: 'test'], + [file( + params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/contigs.fasta', + checkIfExists: true + )] + ] + input[1] = GUNC_DOWNLOADDB.out.db + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} \ No newline at end of file diff --git a/modules/nf-core/gunc/run/tests/main.nf.test.snap b/modules/nf-core/gunc/run/tests/main.nf.test.snap new file mode 100644 index 00000000000..516425c8ee0 --- /dev/null +++ b/modules/nf-core/gunc/run/tests/main.nf.test.snap @@ -0,0 +1,90 @@ +{ + "gunc - run - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "maxCSS_level.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "all_levels.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,2ee4942c0187a663aed4b66af3bead6a" + ], + "all_levels_tsv": [ + [ + { + "id": "test" + }, + "all_levels.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "maxcss_level_tsv": [ + [ + { + "id": "test" + }, + "maxCSS_level.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,2ee4942c0187a663aed4b66af3bead6a" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-21T17:29:46.904708749" + }, + "gunc - run": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "GUNC.progenomes_2.1.maxCSS_level.tsv:md5,938826458a44404d0bf2e7cb4edde405" + ] + ], + "1": [ + + ], + "2": [ + "versions.yml:md5,2ee4942c0187a663aed4b66af3bead6a" + ], + "all_levels_tsv": [ + + ], + "maxcss_level_tsv": [ + [ + { + "id": "test" + }, + "GUNC.progenomes_2.1.maxCSS_level.tsv:md5,938826458a44404d0bf2e7cb4edde405" + ] + ], + "versions": [ + "versions.yml:md5,2ee4942c0187a663aed4b66af3bead6a" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-22T10:12:03.813571948" + } +} \ No newline at end of file diff --git a/modules/nf-core/gunc/run/tests/tags.yml b/modules/nf-core/gunc/run/tests/tags.yml new file mode 100644 index 00000000000..0af9644423f --- /dev/null +++ b/modules/nf-core/gunc/run/tests/tags.yml @@ -0,0 +1,3 @@ +gunc/run: + - modules/nf-core/gunc/run/** + - modules/nf-core/gunc/downloaddb/** diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 20271579d05..d399c01c03e 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -236,12 +236,6 @@ gridss/gridssgenerateponbedpe: gsea/gsea: - modules/nf-core/gsea/gsea/** - tests/modules/nf-core/gsea/gsea/** -gunc/mergecheckm: - - modules/nf-core/gunc/mergecheckm/** - - tests/modules/nf-core/gunc/mergecheckm/** -gunc/run: - - modules/nf-core/gunc/run/** - - tests/modules/nf-core/gunc/run/** hicexplorer/hicpca: - modules/nf-core/hicexplorer/hicpca/** - tests/modules/nf-core/hicexplorer/hicpca/**