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

Swap transdecoder predict to nf-test #7296

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
10 changes: 4 additions & 6 deletions modules/nf-core/transdecoder/longorf/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,15 @@ process TRANSDECODER_LONGORF {
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def fasta_no_gz = fasta.toString() - '.gz'
output_dir_name = "${meta.id}/${fasta_no_gz}.transdecoder_dir"
"""
mkdir -p $output_dir_name

touch $output_dir_name/longest_orfs.pep
touch $output_dir_name/longest_orfs.gff3
touch $output_dir_name/longest_orfs.cds
touch $output_dir_name/base_freqs.dat
touch ${output_dir_name}/longest_orfs.pep
touch ${output_dir_name}/longest_orfs.gff3
touch ${output_dir_name}/longest_orfs.cds
touch ${output_dir_name}/base_freqs.dat

cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
2 changes: 1 addition & 1 deletion modules/nf-core/transdecoder/predict/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ channels:
- conda-forge
- bioconda
dependencies:
- bioconda::transdecoder=5.5.0
- bioconda::transdecoder=5.7.1
20 changes: 16 additions & 4 deletions modules/nf-core/transdecoder/predict/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ process TRANSDECODER_PREDICT {
conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/transdecoder:5.5.0--pl5262hdfd78af_4':
Copy link
Contributor

Choose a reason for hiding this comment

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

Your Singularity image is still at version 5.5.0, causing the tests to fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aah, thanks!

SPPearce marked this conversation as resolved.
Show resolved Hide resolved
'quay.io/comp-bio-aging/transdecoder' }"
'biocontainers/transdecoder:5.7.1--pl5321hdfd78af_0' }"

input:
tuple val(meta), path(fasta)
Expand All @@ -23,12 +23,10 @@ process TRANSDECODER_PREDICT {

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

"""
TransDecoder.Predict \\
$args \\
-O ${prefix} \\
-O . \\
-t \\
$fasta

Expand All @@ -37,4 +35,18 @@ process TRANSDECODER_PREDICT {
transdecoder: \$(echo \$(TransDecoder.Predict --version) | sed -e "s/TransDecoder.Predict //g")
END_VERSIONS
"""

stub:
def fasta_no_gz = fasta.toString() - '.gz'
"""
touch ${fasta_no_gz}.transdecoder.pep
touch ${fasta_no_gz}.transdecoder.gff3
touch ${fasta_no_gz}.transdecoder.cds
touch ${fasta_no_gz}.transdecoder.bed

cat <<-END_VERSIONS > versions.yml
"${task.process}":
transdecoder: \$(echo \$(TransDecoder.Predict --version) | sed -e "s/TransDecoder.Predict //g")
END_VERSIONS
"""
}
140 changes: 140 additions & 0 deletions modules/nf-core/transdecoder/predict/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "transdecoder"
tag "transdecoder/longorf"
tag "transdecoder/predict"

test("sarscov2 - uncompressed") {

setup {
run("TRANSDECODER_LONGORF") {
script "../../longorf/main.nf"
process {
"""
input[0] = [
[id: 'test'],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
]
"""
}
}
}

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
]
input[1] = TRANSDECODER_LONGORF.out.folder
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
// orfs are output in a random order; can't be easily sorted either.
path(process.out.bed[0][1] ).getText().contains("ID=GENE.MT192765.1~~MT192765.1.p7"),
path(process.out.cds[0][1] ).getText().contains("ID=GENE.MT192765.1~~MT192765.1.p7"),
path(process.out.gff3[0][1]).getText().contains("ID=GENE.MT192765.1~~MT192765.1.p7"),
path(process.out.pep[0][1] ).getText().contains("ID=GENE.MT192765.1~~MT192765.1.p7"),
process.out.versions
).match() }
)
}

}

test("sarscov2 - compressed") {

setup {
run("TRANSDECODER_LONGORF") {
script "../../longorf/main.nf"
process {
"""
input[0] = [
[id: 'test'],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.gz', checkIfExists: true)
]
"""
}
}
}

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.gz', checkIfExists: true)
]
input[1] = TRANSDECODER_LONGORF.out.folder
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
// orfs are output in a random order; can't be easily sorted either.
path(process.out.bed[0][1] ).getText().contains("ID=GENE.MT192765.1~~MT192765.1.p7"),
path(process.out.cds[0][1] ).getText().contains("ID=GENE.MT192765.1~~MT192765.1.p7"),
path(process.out.gff3[0][1]).getText().contains("ID=GENE.MT192765.1~~MT192765.1.p7"),
path(process.out.pep[0][1] ).getText().contains("ID=GENE.MT192765.1~~MT192765.1.p7"),
process.out.versions
).match() }
)
}

}

test("sarscov2 - uncompressed - stub") {

options "-stub"

setup {
run("TRANSDECODER_LONGORF") {
script "../../longorf/main.nf"
process {
"""
input[0] = [
[id: 'test'],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
]
"""
}
}
}

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
]
input[1] = TRANSDECODER_LONGORF.out.folder
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

}
123 changes: 123 additions & 0 deletions modules/nf-core/transdecoder/predict/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"sarscov2 - uncompressed - stub": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"genome.fasta.transdecoder.pep:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
[
{
"id": "test",
"single_end": false
},
"genome.fasta.transdecoder.gff3:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"2": [
[
{
"id": "test",
"single_end": false
},
"genome.fasta.transdecoder.cds:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"3": [
[
{
"id": "test",
"single_end": false
},
"genome.fasta.transdecoder.bed:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"4": [
"versions.yml:md5,d68aca63cf424e1cc9f544b5b3aa9c99"
],
"bed": [
[
{
"id": "test",
"single_end": false
},
"genome.fasta.transdecoder.bed:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"cds": [
[
{
"id": "test",
"single_end": false
},
"genome.fasta.transdecoder.cds:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"gff3": [
[
{
"id": "test",
"single_end": false
},
"genome.fasta.transdecoder.gff3:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"pep": [
[
{
"id": "test",
"single_end": false
},
"genome.fasta.transdecoder.pep:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,d68aca63cf424e1cc9f544b5b3aa9c99"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
},
"timestamp": "2025-01-13T19:14:55.271439958"
},
"sarscov2 - uncompressed": {
"content": [
false,
false,
true,
false,
[
"versions.yml:md5,d68aca63cf424e1cc9f544b5b3aa9c99"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
},
"timestamp": "2025-01-14T17:04:13.113096174"
},
"sarscov2 - compressed": {
"content": [
false,
false,
true,
false,
[
"versions.yml:md5,d68aca63cf424e1cc9f544b5b3aa9c99"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
},
"timestamp": "2025-01-14T17:00:33.707348893"
}
}
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -585,9 +585,6 @@ svtk/vcf2bed:
topas/gencons:
- modules/nf-core/topas/gencons/**
- tests/modules/nf-core/topas/gencons/**
transdecoder/predict:
- modules/nf-core/transdecoder/predict/**
- tests/modules/nf-core/transdecoder/predict/**
truvari/bench:
- modules/nf-core/truvari/bench/**
- tests/modules/nf-core/truvari/bench/**
Expand Down
28 changes: 0 additions & 28 deletions tests/modules/nf-core/transdecoder/predict/main.nf

This file was deleted.

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

This file was deleted.

Loading
Loading