From d9b442905188d37bffd8abaf440cbb1a56dadd51 Mon Sep 17 00:00:00 2001 From: Usman Rashid Date: Fri, 6 Sep 2024 09:42:37 +1200 Subject: [PATCH 1/3] Added nf-test for gubbins --- modules/nf-core/gubbins/environment.yml | 1 - modules/nf-core/gubbins/meta.yml | 1 + modules/nf-core/gubbins/tests/main.nf.test | 43 +++++++++++++++++++ .../nf-core/gubbins/tests/main.nf.test.snap | 40 +++++++++++++++++ tests/config/pytest_modules.yml | 3 -- tests/modules/nf-core/gubbins/main.nf | 11 ----- tests/modules/nf-core/gubbins/nextflow.config | 5 --- tests/modules/nf-core/gubbins/test.yml | 23 ---------- 8 files changed, 84 insertions(+), 43 deletions(-) create mode 100644 modules/nf-core/gubbins/tests/main.nf.test create mode 100644 modules/nf-core/gubbins/tests/main.nf.test.snap delete mode 100644 tests/modules/nf-core/gubbins/main.nf delete mode 100644 tests/modules/nf-core/gubbins/nextflow.config delete mode 100644 tests/modules/nf-core/gubbins/test.yml diff --git a/modules/nf-core/gubbins/environment.yml b/modules/nf-core/gubbins/environment.yml index 91537822360..1d349650ccb 100644 --- a/modules/nf-core/gubbins/environment.yml +++ b/modules/nf-core/gubbins/environment.yml @@ -2,6 +2,5 @@ name: gubbins channels: - conda-forge - bioconda - - defaults dependencies: - bioconda::gubbins=3.0.0 diff --git a/modules/nf-core/gubbins/meta.yml b/modules/nf-core/gubbins/meta.yml index 30f6bd7f432..191660b82ae 100644 --- a/modules/nf-core/gubbins/meta.yml +++ b/modules/nf-core/gubbins/meta.yml @@ -4,6 +4,7 @@ licence: ["GPL-2.0-only"] keywords: - recombination - alignment + - phylogeny tools: - gubbins: description: Rapid phylogenetic analysis of large samples of recombinant bacterial whole genome sequences using Gubbins. diff --git a/modules/nf-core/gubbins/tests/main.nf.test b/modules/nf-core/gubbins/tests/main.nf.test new file mode 100644 index 00000000000..5f2a4de80ca --- /dev/null +++ b/modules/nf-core/gubbins/tests/main.nf.test @@ -0,0 +1,43 @@ + +nextflow_process { + + name "Test Process GUBBINS" + script "../main.nf" + process "GUBBINS" + + tag "modules" + tag "modules_nfcore" + tag "gubbins" + + test("test-gubbins") { + + when { + process { + """ + input[0] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/alignment/all_sites.fas', checkIfExists: true) + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.fasta, + process.out.gff, + path(process.out.vcf[0]).vcf.variantsMD5, + process.out.stats, + process.out.phylip, + file(process.out.embl_predicted[0]).name, // empty + process.out.embl_branch, + process.out.tree, + process.out.tree_labelled, + process.out.versions + ).match() + } + ) + } + } + +} diff --git a/modules/nf-core/gubbins/tests/main.nf.test.snap b/modules/nf-core/gubbins/tests/main.nf.test.snap new file mode 100644 index 00000000000..0cb60e6c14f --- /dev/null +++ b/modules/nf-core/gubbins/tests/main.nf.test.snap @@ -0,0 +1,40 @@ +{ + "test-gubbins": { + "content": [ + [ + "all_sites.filtered_polymorphic_sites.fasta:md5,4cbfd93868d8ed7d4d8b099eba137134" + ], + [ + "all_sites.recombination_predictions.gff:md5,f95871e79968340cb82532e2c9b0c92b" + ], + "6e9a63f667f7facae3f3d3556618a9f6", + [ + "all_sites.per_branch_statistics.csv:md5,25e4fdb6681c3709a9add1d5632bbf3e" + ], + [ + "all_sites.filtered_polymorphic_sites.phylip:md5,0a77f397a7797c5c3386832745b0c97a" + ], + "all_sites.recombination_predictions.embl", + [ + "all_sites.branch_base_reconstruction.embl:md5,9e051646d630f528fff58f1f73286006" + ], + [ + [ + "all_sites.final_tree.tre:md5,095689c565948a634c654fa4f28542d9", + "all_sites.node_labelled.final_tree.tre:md5,c16333d8b1c0502a7cd09e6531459f9f" + ] + ], + [ + "all_sites.node_labelled.final_tree.tre:md5,c16333d8b1c0502a7cd09e6531459f9f" + ], + [ + "versions.yml:md5,5b1fc0a22fc6b4c4460858b2f478c937" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-06T08:59:35.386435" + } +} \ No newline at end of file diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 5866c9d4e29..41a01d0afde 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -308,9 +308,6 @@ gridss/gridssgenerateponbedpe: gsea/gsea: - modules/nf-core/gsea/gsea/** - tests/modules/nf-core/gsea/gsea/** -gubbins: - - modules/nf-core/gubbins/** - - tests/modules/nf-core/gubbins/** gunc/downloaddb: - modules/nf-core/gunc/downloaddb/** - tests/modules/nf-core/gunc/downloaddb/** diff --git a/tests/modules/nf-core/gubbins/main.nf b/tests/modules/nf-core/gubbins/main.nf deleted file mode 100644 index f65460d821e..00000000000 --- a/tests/modules/nf-core/gubbins/main.nf +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { GUBBINS } from '../../../../modules/nf-core/gubbins/main.nf' - -workflow test_gubbins { - input = file(params.test_data['sarscov2']['genome']['all_sites_fas'], checkIfExists: true) - - GUBBINS ( input ) -} diff --git a/tests/modules/nf-core/gubbins/nextflow.config b/tests/modules/nf-core/gubbins/nextflow.config deleted file mode 100644 index 8730f1c4b93..00000000000 --- a/tests/modules/nf-core/gubbins/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} diff --git a/tests/modules/nf-core/gubbins/test.yml b/tests/modules/nf-core/gubbins/test.yml deleted file mode 100644 index 39b9d738cf2..00000000000 --- a/tests/modules/nf-core/gubbins/test.yml +++ /dev/null @@ -1,23 +0,0 @@ -- name: gubbins - command: nextflow run ./tests/modules/nf-core/gubbins -entry test_gubbins -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/gubbins/nextflow.config - tags: - - gubbins - files: - - path: output/gubbins/all_sites.filtered_polymorphic_sites.fasta - md5sum: 4cbfd93868d8ed7d4d8b099eba137134 - - path: output/gubbins/all_sites.recombination_predictions.embl - md5sum: d41d8cd98f00b204e9800998ecf8427e - - path: output/gubbins/all_sites.recombination_predictions.gff - md5sum: f95871e79968340cb82532e2c9b0c92b - - path: output/gubbins/all_sites.branch_base_reconstruction.embl - md5sum: 9e051646d630f528fff58f1f73286006 - - path: output/gubbins/all_sites.summary_of_snp_distribution.vcf - md5sum: 276e62e888ea811577c8ffb2da0b3aff - - path: output/gubbins/all_sites.per_branch_statistics.csv - md5sum: 25e4fdb6681c3709a9add1d5632bbf3e - - path: output/gubbins/all_sites.filtered_polymorphic_sites.phylip - md5sum: 0a77f397a7797c5c3386832745b0c97a - - path: output/gubbins/all_sites.final_tree.tre - md5sum: 6cb251b58307aab11cb4b48792d6cda1 - - path: output/gubbins/all_sites.node_labelled.final_tree.tre - md5sum: e01f965a15924b4f97603b8011c8d3f7 From fe3aa927b3d7a9c2baa18fc0fad9aad9e28c2a4f Mon Sep 17 00:00:00 2001 From: Usman Rashid Date: Fri, 6 Sep 2024 14:21:41 +1200 Subject: [PATCH 2/3] Version bump --- modules/nf-core/gubbins/environment.yml | 2 +- modules/nf-core/gubbins/main.nf | 29 ++++- modules/nf-core/gubbins/tests/main.nf.test | 24 +++- .../nf-core/gubbins/tests/main.nf.test.snap | 103 +++++++++++++++--- 4 files changed, 138 insertions(+), 20 deletions(-) diff --git a/modules/nf-core/gubbins/environment.yml b/modules/nf-core/gubbins/environment.yml index 1d349650ccb..0e8285b41c2 100644 --- a/modules/nf-core/gubbins/environment.yml +++ b/modules/nf-core/gubbins/environment.yml @@ -3,4 +3,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::gubbins=3.0.0 + - bioconda::gubbins=3.3.5 diff --git a/modules/nf-core/gubbins/main.nf b/modules/nf-core/gubbins/main.nf index a934f1dd629..2d91dfc0009 100644 --- a/modules/nf-core/gubbins/main.nf +++ b/modules/nf-core/gubbins/main.nf @@ -3,8 +3,8 @@ process GUBBINS { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/gubbins:3.0.0--py39h5bf99c6_0' : - 'biocontainers/gubbins:3.0.0--py39h5bf99c6_0' }" + 'https://depot.galaxyproject.org/singularity/gubbins:3.3.5--py39pl5321he4a0461_0' : + 'biocontainers/gubbins:3.3.5--py39pl5321he4a0461_0' }" input: path alignment @@ -27,6 +27,9 @@ process GUBBINS { script: def args = task.ext.args ?: '' """ + mkdir numba_cache_dir + export NUMBA_CACHE_DIR='./numba_cache_dir' + run_gubbins.py \\ --threads $task.cpus \\ $args \\ @@ -36,4 +39,26 @@ process GUBBINS { gubbins: \$(run_gubbins.py --version 2>&1) END_VERSIONS """ + + stub: + def args = task.ext.args ?: '' + """ + mkdir numba_cache_dir + export NUMBA_CACHE_DIR='./numba_cache_dir' + + touch ${alignment.baseName}.fasta + touch ${alignment.baseName}.gff + touch ${alignment.baseName}.vcf + touch ${alignment.baseName}.csv + touch ${alignment.baseName}.phylip + touch ${alignment.baseName}.recombination_predictions.embl + touch ${alignment.baseName}.branch_base_reconstruction.embl + touch ${alignment.baseName}.final_tree.tre + touch ${alignment.baseName}.node_labelled.final_tree.tre + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + gubbins: \$(run_gubbins.py --version 2>&1) + END_VERSIONS + """ } diff --git a/modules/nf-core/gubbins/tests/main.nf.test b/modules/nf-core/gubbins/tests/main.nf.test index 5f2a4de80ca..a96eb671a3d 100644 --- a/modules/nf-core/gubbins/tests/main.nf.test +++ b/modules/nf-core/gubbins/tests/main.nf.test @@ -31,8 +31,8 @@ nextflow_process { process.out.phylip, file(process.out.embl_predicted[0]).name, // empty process.out.embl_branch, - process.out.tree, - process.out.tree_labelled, + process.out.tree[0].collect { file(it).name }, // unstable + file(process.out.tree_labelled[0]).name, // unstable process.out.versions ).match() } @@ -40,4 +40,24 @@ nextflow_process { } } + test("test-gubbins-stub") { + options '-stub' + + when { + process { + """ + input[0] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/alignment/all_sites.fas', checkIfExists: true) + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + } diff --git a/modules/nf-core/gubbins/tests/main.nf.test.snap b/modules/nf-core/gubbins/tests/main.nf.test.snap index 0cb60e6c14f..200d7fabcef 100644 --- a/modules/nf-core/gubbins/tests/main.nf.test.snap +++ b/modules/nf-core/gubbins/tests/main.nf.test.snap @@ -1,40 +1,113 @@ { + "test-gubbins-stub": { + "content": [ + { + "0": [ + "all_sites.fasta:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "1": [ + "all_sites.gff:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "2": [ + "all_sites.vcf:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "3": [ + "all_sites.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "4": [ + "all_sites.phylip:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "5": [ + "all_sites.recombination_predictions.embl:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "6": [ + "all_sites.branch_base_reconstruction.embl:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "7": [ + [ + "all_sites.final_tree.tre:md5,d41d8cd98f00b204e9800998ecf8427e", + "all_sites.node_labelled.final_tree.tre:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "8": [ + "all_sites.node_labelled.final_tree.tre:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "9": [ + "versions.yml:md5,42d794e45e0374e029afdbfbc585cc76" + ], + "embl_branch": [ + "all_sites.branch_base_reconstruction.embl:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "embl_predicted": [ + "all_sites.recombination_predictions.embl:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "fasta": [ + "all_sites.fasta:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "gff": [ + "all_sites.gff:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "phylip": [ + "all_sites.phylip:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "stats": [ + "all_sites.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "tree": [ + [ + "all_sites.final_tree.tre:md5,d41d8cd98f00b204e9800998ecf8427e", + "all_sites.node_labelled.final_tree.tre:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "tree_labelled": [ + "all_sites.node_labelled.final_tree.tre:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "vcf": [ + "all_sites.vcf:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "versions": [ + "versions.yml:md5,42d794e45e0374e029afdbfbc585cc76" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-06T14:20:39.212181" + }, "test-gubbins": { "content": [ [ - "all_sites.filtered_polymorphic_sites.fasta:md5,4cbfd93868d8ed7d4d8b099eba137134" + "all_sites.filtered_polymorphic_sites.fasta:md5,0f945512f071fd1599bb7455492e31bc" ], [ - "all_sites.recombination_predictions.gff:md5,f95871e79968340cb82532e2c9b0c92b" + "all_sites.recombination_predictions.gff:md5,7605a21ad8812866adbdb5cada8a59d4" ], - "6e9a63f667f7facae3f3d3556618a9f6", + "d314daa06c635c0b31b132a1092ee4e3", [ - "all_sites.per_branch_statistics.csv:md5,25e4fdb6681c3709a9add1d5632bbf3e" + "all_sites.per_branch_statistics.csv:md5,8012a76a2486a8b3dfe78d6902b56ed4" ], [ - "all_sites.filtered_polymorphic_sites.phylip:md5,0a77f397a7797c5c3386832745b0c97a" + "all_sites.filtered_polymorphic_sites.phylip:md5,d28da2dd14d08bbb996756064516aee1" ], "all_sites.recombination_predictions.embl", [ - "all_sites.branch_base_reconstruction.embl:md5,9e051646d630f528fff58f1f73286006" - ], - [ - [ - "all_sites.final_tree.tre:md5,095689c565948a634c654fa4f28542d9", - "all_sites.node_labelled.final_tree.tre:md5,c16333d8b1c0502a7cd09e6531459f9f" - ] + "all_sites.branch_base_reconstruction.embl:md5,9dfd7e411404360ce4a7938aab8db701" ], [ - "all_sites.node_labelled.final_tree.tre:md5,c16333d8b1c0502a7cd09e6531459f9f" + "all_sites.final_tree.tre", + "all_sites.node_labelled.final_tree.tre" ], + "all_sites.node_labelled.final_tree.tre", [ - "versions.yml:md5,5b1fc0a22fc6b4c4460858b2f478c937" + "versions.yml:md5,42d794e45e0374e029afdbfbc585cc76" ] ], "meta": { "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-09-06T08:59:35.386435" + "timestamp": "2024-09-06T14:16:35.669362" } } \ No newline at end of file From 689c881f13aeed9bd80f6ed9f30a9cbcb84a7eee Mon Sep 17 00:00:00 2001 From: Usman Rashid Date: Fri, 6 Sep 2024 15:48:26 +1200 Subject: [PATCH 3/3] Updated test names --- modules/nf-core/gubbins/tests/main.nf.test | 4 ++-- modules/nf-core/gubbins/tests/main.nf.test.snap | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/nf-core/gubbins/tests/main.nf.test b/modules/nf-core/gubbins/tests/main.nf.test index a96eb671a3d..357d3d71d06 100644 --- a/modules/nf-core/gubbins/tests/main.nf.test +++ b/modules/nf-core/gubbins/tests/main.nf.test @@ -9,7 +9,7 @@ nextflow_process { tag "modules_nfcore" tag "gubbins" - test("test-gubbins") { + test("sarscov2-alignment") { when { process { @@ -40,7 +40,7 @@ nextflow_process { } } - test("test-gubbins-stub") { + test("sarscov2-alignment-stub") { options '-stub' when { diff --git a/modules/nf-core/gubbins/tests/main.nf.test.snap b/modules/nf-core/gubbins/tests/main.nf.test.snap index 200d7fabcef..33f66d8c941 100644 --- a/modules/nf-core/gubbins/tests/main.nf.test.snap +++ b/modules/nf-core/gubbins/tests/main.nf.test.snap @@ -1,5 +1,5 @@ { - "test-gubbins-stub": { + "sarscov2-alignment-stub": { "content": [ { "0": [ @@ -76,7 +76,7 @@ }, "timestamp": "2024-09-06T14:20:39.212181" }, - "test-gubbins": { + "sarscov2-alignment": { "content": [ [ "all_sites.filtered_polymorphic_sites.fasta:md5,0f945512f071fd1599bb7455492e31bc"