Skip to content

stub and nf-test created for raxmlng #8161

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

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
33 changes: 28 additions & 5 deletions modules/nf-core/raxmlng/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,51 @@ process RAXMLNG {
'biocontainers/raxml-ng:1.0.3--h32fcf60_0' }"

input:
path alignment
tuple val(meta), path(alignment), val(model)

output:
path "*.raxml.bestTree", emit: phylogeny
path "*.raxml.support" , optional:true, emit: phylogeny_bootstrapped
path "versions.yml" , emit: versions
tuple val(meta), path("*.raxml.bestTree") , emit: phylogeny
tuple val(meta), path("*.raxml.support"), optional:true, emit: phylogeny_bootstrapped
path "versions.yml" , emit: versions
Comment on lines +13 to +15
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you put the emit: first, then the optional:, so it lines up better.


when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"

"""
raxml-ng \\
$args \\
--msa $alignment \\
--model $model \\
--threads $task.cpus \\
--prefix output
--prefix ${prefix}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
raxmlng: \$(echo \$(raxml-ng --version 2>&1) | sed 's/^.*RAxML-NG v. //; s/released.*\$//')
END_VERSIONS
"""

stub:
def args = task.ext.args ?: params.raxmlng_args ?: ''
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def args = task.ext.args ?: params.raxmlng_args ?: ''
def args = task.ext.args ?: ''

def prefix = task.ext.prefix ?: meta.id
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def prefix = task.ext.prefix ?: meta.id
def prefix = task.ext.prefix ?: "${meta.id}"

if (!meta.id) {
error "Input meta map does not contain 'id'. Received: ${meta}"
}
// Use a dedicated param for stub testing the bootstrap output scenario
Comment on lines +41 to +44
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (!meta.id) {
error "Input meta map does not contain 'id'. Received: ${meta}"
}
// Use a dedicated param for stub testing the bootstrap output scenario

def touch_support = args.contains('--bootstrap') || args.contains('--bs-trees') ? "touch ${prefix}.raxml.support" : ""
"""
# Create stub output files
touch ${prefix}.raxml.bestTree
${touch_support}

# Create versions.yml
cat <<-END_VERSIONS > versions.yml
"${task.process}":
raxmlng: stub_version
END_VERSIONS
"""
}
29 changes: 23 additions & 6 deletions modules/nf-core/raxmlng/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,41 @@ tools:
documentation: https://github.com/amkozlov/raxml-ng/wiki
tool_dev_url: https://github.com/amkozlov/raxml-ng
doi: 10.1093/bioinformatics/btz305
licence: ["GPL v2-or-later"]
license: ["GPL v2-or-later"]
identifier: ""
input:
- - alignment:
- - meta:
type: map
description: Groovy Map containing sample information (e.g. [ id:'sample1' ])
- alignment:
type: file
description: A FASTA format multiple sequence alignment file
pattern: "*.{fasta,fas,fa,mfa}"
- model:
type: string
description: The substitution model to use for the phylogenetic inference

output:
- phylogeny:
- meta:
type: map
description: Groovy Map containing sample information
pattern: "*.{raxml.bestTree}"
- "*.raxml.bestTree":
type: file
description: A phylogeny in Newick format
type: map
description: Groovy Map containing sample information
Comment on lines +37 to +38
Copy link
Contributor

Choose a reason for hiding this comment

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

This should still be the previous description and type:

pattern: "*.{raxml.bestTree}"
- phylogeny_bootstrapped:
- meta:
type: map
description: Groovy Map containing sample information
pattern: "*.{raxml.support}"
optional: true
- "*.raxml.support":
type: file
description: A phylogeny in Newick format with bootstrap values
type: map
Copy link
Contributor

Choose a reason for hiding this comment

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

This should still be the previous description and type

description: Groovy Map containing sample information
pattern: "*.{raxml.support}"
optional: true
- versions:
- versions.yml:
type: file
Expand Down
93 changes: 93 additions & 0 deletions modules/nf-core/raxmlng/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
nextflow_process {
name "Test Process RAXMLNG"
script "../main.nf"
process "RAXMLNG"
tag "modules"
tag "modules_nfcore"
tag "raxmlng"

test("raxmlng - main") {
when {
process {
"""
// alignment fasta file is required
input[0] = [
[ id:'test' ], // meta map with id
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/alignment/informative_sites.fas', checkIfExists: true), // alignment fasta
'GTR+G' // model
]
"""
}

}

then {
assertAll (
{ assert process.success },
// Check phylogeny output (tuple: meta, path)
{ assert process.out.phylogeny.size() == 1 },
{ assert process.out.phylogeny[0][0].id == 'test' }, // Check meta.id passed through
{ assert process.out.phylogeny[0][1].toString().endsWith(".raxml.bestTree") },
{ assert process.out.phylogeny[0][1].toString().contains("test") }, // Check if prefix 'test' was used
// Check optional bootstrapped output (should be empty)
{ assert process.out.phylogeny_bootstrapped.isEmpty() },
// Check versions
{ assert process.out.versions.size() == 1 },
{ assert process.out.versions[0].toString().endsWith("versions.yml") },
{ assert snapshot(process.out.versions[0]).match("versions_yml") } // Snapshot specific file
)
}
}


test("raxmlng - stub - no bootstrap") {
options "-stub"

when {
process {
"""
input[0] = [
[ id:'test_stub' ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/alignment/informative_sites.fas', checkIfExists: true), // alignment file path
'GTR+G' // model string
]
"""
}
}

then {
assertAll (
{ assert process.success },
// This will show phylogeny and versions, but not phylogeny_bootstrapped
{ assert snapshot(process.out).match() }
)
}
}


test("raxmlng - stub - with bootstrap") {
options "-stub"
when {
params.test_stub_bootstrap = true
params {
// Set the bootstrap parameter to true
test_stub_bootstrap = true
}
process {
"""
input[0] = [
[ id:'test_bootstrap' ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/alignment/informative_sites.fas', checkIfExists: true), // alignment file path
'GTR+G' // model string
]
"""
}
}
then {
assertAll (
{ assert process.success },
{ assert snapshot(process.out).match("stub_with_bootstrap") }
)
}
}
}
100 changes: 100 additions & 0 deletions modules/nf-core/raxmlng/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"versions_yml": {
"content": [
"versions.yml:md5,e5a855c4c9bcde2084ec9e34861379f0"
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.5"
},
"timestamp": "2025-03-31T17:18:00.904972153"
},
"stub_with_bootstrap": {
"content": [
{
"0": [
[
{
"id": "test_bootstrap"
},
"test_bootstrap.raxml.bestTree:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
[
{
"id": "test_bootstrap"
},
"test_bootstrap.raxml.support:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"2": [
"versions.yml:md5,e7caecc35f1746920b7e0991adc59b4c"
],
"phylogeny": [
[
{
"id": "test_bootstrap"
},
"test_bootstrap.raxml.bestTree:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"phylogeny_bootstrapped": [
[
{
"id": "test_bootstrap"
},
"test_bootstrap.raxml.support:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,e7caecc35f1746920b7e0991adc59b4c"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.5"
},
"timestamp": "2025-03-31T17:55:18.655533044"
},
"stub_no_bootstrap": {
"content": [
{
"0": [
[
{
"id": "test_stub"
},
"test_stub.raxml.bestTree:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [

],
"2": [
"versions.yml:md5,e7caecc35f1746920b7e0991adc59b4c"
],
"phylogeny": [
[
{
"id": "test_stub"
},
"test_stub.raxml.bestTree:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"phylogeny_bootstrapped": [

],
"versions": [
"versions.yml:md5,e7caecc35f1746920b7e0991adc59b4c"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.5"
},
"timestamp": "2025-03-31T17:55:15.617725178"
}
}
6 changes: 0 additions & 6 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,9 @@ purgedups/purgedups:
pydamage/filter:
- modules/nf-core/pydamage/filter/**
- tests/modules/nf-core/pydamage/filter/**
raxmlng:
- modules/nf-core/raxmlng/**
- tests/modules/nf-core/raxmlng/**
rhocall/annotate:
- modules/nf-core/rhocall/annotate/**
- tests/modules/nf-core/rhocall/annotate/**
roary:
- modules/nf-core/roary/**
- tests/modules/nf-core/roary/**
scramble/clusteranalysis:
- modules/nf-core/scramble/clusteranalysis/**
- tests/modules/nf-core/scramble/clusteranalysis/**
Expand Down
26 changes: 0 additions & 26 deletions tests/modules/nf-core/raxmlng/main.nf

This file was deleted.

13 changes: 0 additions & 13 deletions tests/modules/nf-core/raxmlng/nextflow.config

This file was deleted.

31 changes: 0 additions & 31 deletions tests/modules/nf-core/raxmlng/test.yml

This file was deleted.

Loading
Loading