Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
31 changes: 17 additions & 14 deletions modules/nf-core/gt/gff3/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ process GT_GFF3 {
tuple val(meta), path(gff3)

output:
tuple val(meta), path("*.gt.gff3") , emit: gt_gff3 , optional: true
tuple val(meta), path("*.error.log"), emit: error_log , optional: true
path "versions.yml" , emit: versions
tuple val(meta), path("*.gt.gff3") , emit: gt_gff3 , optional: true
tuple val(meta), path("*.error.log"), emit: error_log, optional: true
tuple val("${task.process}"), val('genometools'), eval("gt --version | sed '1!d;s/gt (GenomeTools) //'"), emit: versions_gt, topic: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -24,28 +24,31 @@ process GT_GFF3 {
"""
gt \\
gff3 \\
$args \\
"$gff3" \\
${args} \\
${gff3} \\
> "${prefix}.gt.gff3" \\
2>| >(tee "${prefix}.error.log" >&2) \\
|| echo "Errors from gt-gff3 printed to ${prefix}.error.log"

if grep -q "gt gff3: error:" "${prefix}.error.log"; then
echo "gt-gff3 failed to parse $gff3"
echo "gt-gff3 failed to parse ${gff3}"

rm \\
"${prefix}.gt.gff3"
rm ${prefix}.gt.gff3
else
echo "gt-gff3 successfully parsed $gff3"
echo "gt-gff3 successfully parsed ${gff3}"

mv \\
"${prefix}.error.log" \\
${prefix}.error.log \\
gt_gff3.stderr
fi
"""

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

cat <<-END_VERSIONS > versions.yml
"${task.process}":
genometools: \$(gt --version | head -1 | sed 's/gt (GenomeTools) //')
END_VERSIONS
"""
touch ${prefix}.gt.gff3
touch ${prefix}.error.log
touch gt_gff3.stderr
"""
}
30 changes: 22 additions & 8 deletions modules/nf-core/gt/gff3/meta.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "gt_gff3"
description: "GenomeTools gt-gff3 utility to parse, possibly transform, and output
GFF3 files"
Expand All @@ -13,7 +12,8 @@ tools:
documentation: "https://genometools.org/documentation.html"
tool_dev_url: "https://github.com/genometools/genometools"
doi: "10.1109/TCBB.2013.68"
licence: ["ISC"]
licence:
- "ISC"
identifier: ""
input:
- - meta:
Expand Down Expand Up @@ -49,13 +49,27 @@ output:
description: Error log if gt-gff3 failed to parse the input gff3 file
pattern: "*.error.log"
ontologies: []
versions_gt:
- - ${task.process}:
type: string
description: The name of the process
- genometools:
type: string
description: The name of the tool
- gt --version | sed '1!d;s/gt (GenomeTools) //':
type: eval
description: The expression to obtain the version of the tool
topics:
versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
ontologies:
- edam: http://edamontology.org/format_3750 # YAML
- - ${task.process}:
type: string
description: The name of the process
- genometools:
type: string
description: The name of the tool
- gt --version | sed '1!d;s/gt (GenomeTools) //':
type: eval
description: The expression to obtain the version of the tool
authors:
- "@gallvp"
maintainers:
Expand Down
43 changes: 34 additions & 9 deletions modules/nf-core/gt/gff3/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ nextflow_process {

test("sarscov2-gff3-valid") {
when {
params {
module_args = '-tidy -retainids'
}
process {
"""
input[0] = [
[ id:'test' ], // meta map
[ id:'test' ],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.gff3', checkIfExists: true)
]
"""
Expand All @@ -25,19 +28,19 @@ nextflow_process {
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() },
{ assert process.out.gt_gff3 != null },
{ assert process.out.error_log == [] }
{ assert snapshot(sanitizeOutput(process.out)).match() }
)
}

}

test("sarscov2-gff3-invalid") {
when {
params {
module_args = '-tidy -retainids'
}
process {
"""
input[0] = Channel.of(
input[0] = channel.of(
'##gff-version 3',
'chr22\tID=gene:ENSG00000233995;Name=AP000547.1'
)
Expand All @@ -50,12 +53,34 @@ nextflow_process {
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() },
{ assert process.out.gt_gff3 == [] },
{ assert process.out.error_log != null },
{ assert snapshot(sanitizeOutput(process.out)).match() },
{ assert path(process.out.error_log.get(0).get(1)).getText().contains("gt gff3: error:") }
)
}
}

test("sarscov2-gff3-valid -- stub") {
options "-stub"
when {
params {
module_args = ''
}
process {
"""
input[0] = [
[ id:'test' ],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.gff3', checkIfExists: true)
]
"""
}
}

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

}
80 changes: 51 additions & 29 deletions modules/nf-core/gt/gff3/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,6 @@
"sarscov2-gff3-invalid": {
"content": [
{
"0": [

],
"1": [
[
{
"id": "test"
},
"test.error.log:md5,31e6117c516f936ec403f792c732bc76"
]
],
"2": [
"versions.yml:md5,9753770dd19a2a306dcf16d4aaf049eb"
],
"error_log": [
[
{
Expand All @@ -27,46 +13,82 @@
"gt_gff3": [

],
"versions": [
"versions.yml:md5,9753770dd19a2a306dcf16d4aaf049eb"
"versions_gt": [
[
"GT_GFF3",
"genometools",
"1.6.5"
]
]
}
],
"timestamp": "2023-11-29T10:42:11.408352"
"timestamp": "2026-05-12T11:50:29.085339901",
"meta": {
"nf-test": "0.9.5",
"nextflow": "26.03.2"
}
},
"sarscov2-gff3-valid": {
"content": [
{
"0": [
"error_log": [

],
"gt_gff3": [
[
{
"id": "test"
},
"test.gt.gff3:md5,2ae900237ace415557b8735fac088b85"
]
],
"1": [

],
"2": [
"versions.yml:md5,9753770dd19a2a306dcf16d4aaf049eb"
],
"versions_gt": [
[
"GT_GFF3",
"genometools",
"1.6.5"
]
]
}
],
"timestamp": "2026-05-12T11:51:30.87179653",
"meta": {
"nf-test": "0.9.5",
"nextflow": "26.03.2"
}
},
"sarscov2-gff3-valid -- stub": {
"content": [
{
"error_log": [

[
{
"id": "test"
},
"test.error.log:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"gt_gff3": [
[
{
"id": "test"
},
"test.gt.gff3:md5,2ae900237ace415557b8735fac088b85"
"test.gt.gff3:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,9753770dd19a2a306dcf16d4aaf049eb"
"versions_gt": [
[
"GT_GFF3",
"genometools",
"1.6.5"
]
]
}
],
"timestamp": "2023-11-29T10:42:07.817894"
"timestamp": "2026-05-12T11:46:28.575720785",
"meta": {
"nf-test": "0.9.5",
"nextflow": "26.03.2"
}
}
}
4 changes: 3 additions & 1 deletion modules/nf-core/gt/gff3/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
process {
ext.args = '-tidy -retainids'
withName: 'GT_GFF3' {
ext.args = params.module_args
}
}
27 changes: 9 additions & 18 deletions modules/nf-core/gt/gff3validator/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ process GT_GFF3VALIDATOR {
output:
tuple val(meta), path('*.success.log') , emit: success_log , optional: true
tuple val(meta), path('*.error.log') , emit: error_log , optional: true
path "versions.yml" , emit: versions
tuple val("${task.process}"), val('genometools'), eval("gt --version | sed '1!d;s/gt (GenomeTools) //'"), emit: versions_gt, topic: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -23,39 +23,30 @@ process GT_GFF3VALIDATOR {
"""
gt \\
gff3validator \\
"$gff3" \\
> "${prefix}.stdout" \\
${gff3} \\
> ${prefix}.stdout \\
2>| >(tee "${prefix}.stderr" >&2) \\
|| echo "Errors from gt-gff3validator printed to ${prefix}.error.log"

if grep -q "input is valid GFF3" "${prefix}.stdout"; then
echo "Validation successful..."
# emit stdout to the success output channel
mv \\
"${prefix}.stdout" \\
"${prefix}.success.log"
${prefix}.stdout \\
${prefix}.success.log
else
echo "Validation failed..."
# emit stderr to the error output channel
mv \\
"${prefix}.stderr" \\
"${prefix}.error.log"
${prefix}.stderr \\
${prefix}.error.log
fi

cat <<-END_VERSIONS > versions.yml
"${task.process}":
genometools: \$(gt --version | head -1 | sed 's/gt (GenomeTools) //')
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch "${prefix}.success.log"

cat <<-END_VERSIONS > versions.yml
"${task.process}":
genometools: \$(gt --version | head -1 | sed 's/gt (GenomeTools) //')
END_VERSIONS
touch ${prefix}.success.log
touch ${prefix}.error.log
"""
}
Loading
Loading