Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added nf-test for gubbins #6598

Merged
merged 3 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions modules/nf-core/gubbins/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ name: gubbins
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- bioconda::gubbins=3.0.0
- bioconda::gubbins=3.3.5
29 changes: 27 additions & 2 deletions modules/nf-core/gubbins/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 \\
Expand All @@ -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
"""
}
1 change: 1 addition & 0 deletions modules/nf-core/gubbins/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
63 changes: 63 additions & 0 deletions modules/nf-core/gubbins/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

nextflow_process {

name "Test Process GUBBINS"
script "../main.nf"
process "GUBBINS"

tag "modules"
tag "modules_nfcore"
tag "gubbins"

test("test-gubbins") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test name test-gubbins is obvious so, better to have the name of the test contain details of the test-data being used.

Thoughts ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. I have updated the names now!


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[0].collect { file(it).name }, // unstable
file(process.out.tree_labelled[0]).name, // unstable
process.out.versions
).match()
}
)
}
}

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() }
)
}
}

}
113 changes: 113 additions & 0 deletions modules/nf-core/gubbins/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +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,0f945512f071fd1599bb7455492e31bc"
],
[
"all_sites.recombination_predictions.gff:md5,7605a21ad8812866adbdb5cada8a59d4"
],
"d314daa06c635c0b31b132a1092ee4e3",
[
"all_sites.per_branch_statistics.csv:md5,8012a76a2486a8b3dfe78d6902b56ed4"
],
[
"all_sites.filtered_polymorphic_sites.phylip:md5,d28da2dd14d08bbb996756064516aee1"
],
"all_sites.recombination_predictions.embl",
[
"all_sites.branch_base_reconstruction.embl:md5,9dfd7e411404360ce4a7938aab8db701"
],
[
"all_sites.final_tree.tre",
"all_sites.node_labelled.final_tree.tre"
],
"all_sites.node_labelled.final_tree.tre",
[
"versions.yml:md5,42d794e45e0374e029afdbfbc585cc76"
]
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-06T14:16:35.669362"
}
}
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/**
Expand Down
11 changes: 0 additions & 11 deletions tests/modules/nf-core/gubbins/main.nf

This file was deleted.

5 changes: 0 additions & 5 deletions tests/modules/nf-core/gubbins/nextflow.config

This file was deleted.

23 changes: 0 additions & 23 deletions tests/modules/nf-core/gubbins/test.yml

This file was deleted.

Loading