Skip to content

Commit

Permalink
Add prefix to output file for barrnap (#5919)
Browse files Browse the repository at this point in the history
* Add prefix to output file

* Update barrnap to nf-test

* Update tags.yml

* Add missing bracket and run test

* Correct format of license

* Update modules/nf-core/barrnap/tests/main.nf.test

Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com>

* Update modules/nf-core/barrnap/tests/main.nf.test

Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com>

* Review suggestions

* Prettier

* Update meta.yml

* Update tests

---------

Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com>
  • Loading branch information
sofstam and SPPearce authored Jul 11, 2024
1 parent 0dee12b commit c4c7ecb
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 35 deletions.
6 changes: 3 additions & 3 deletions modules/nf-core/barrnap/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ process BARRNAP {
--threads $task.cpus \\
--kingdom $db \\
$input \\
> rrna_${db}.gff
> ${prefix}_${db}.gff
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand All @@ -44,9 +44,9 @@ process BARRNAP {
stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"

db = dbname ? "${dbname}" : 'bac'
"""
touch ${prefix}.gff
touch ${prefix}_${db}.gff
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
5 changes: 4 additions & 1 deletion modules/nf-core/barrnap/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tools:
homepage: "https://github.com/tseemann/barrnap"
documentation: "https://github.com/tseemann/barrnap"
tool_dev_url: "https://github.com/tseemann/barrnap"
licence: "['GPL v3']"
licence: ["GPL v3"]
input:
- meta:
type: map
Expand All @@ -23,6 +23,9 @@ input:
type: file
description: fastq or fasta file nucleotides (it can be amino acids as well)
pattern: "*.{fna,fasta,faa,fastq}"
- dbname:
type: string
description: database to use(bacteria, archaea, eukaryota, metazoan mitochondria)
output:
- meta:
type: map
Expand Down
57 changes: 57 additions & 0 deletions modules/nf-core/barrnap/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
nextflow_process {

name "Test Process BARRNAP"
script "../main.nf"
process "BARRNAP"
tag "modules"
tag "modules_nfcore"
tag "barrnap"

test("barrnap") {

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['contigs_fasta'], checkIfExists: true),
"bac"
]
"""
}
}

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

test("barrnap - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['contigs_fasta'], checkIfExists: true),
"bac"
]
"""
}
}

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


72 changes: 72 additions & 0 deletions modules/nf-core/barrnap/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"barrnap - stub": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test_bac.gff:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,447eafa60f76f6b84d1c41a2f5c2f76b"
],
"gff": [
[
{
"id": "test",
"single_end": false
},
"test_bac.gff:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,447eafa60f76f6b84d1c41a2f5c2f76b"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.04.1"
},
"timestamp": "2024-07-10T11:25:35.085998"
},
"barrnap": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test_bac.gff:md5,df19e1b84ba6f691d20c72b397c88abf"
]
],
"1": [
"versions.yml:md5,447eafa60f76f6b84d1c41a2f5c2f76b"
],
"gff": [
[
{
"id": "test",
"single_end": false
},
"test_bac.gff:md5,df19e1b84ba6f691d20c72b397c88abf"
]
],
"versions": [
"versions.yml:md5,447eafa60f76f6b84d1c41a2f5c2f76b"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.04.1"
},
"timestamp": "2024-07-10T11:25:28.621027"
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/barrnap/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
barrnap:
- "modules/nf-core/barrnap/**"
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ bamutil/trimbam:
bandage/image:
- modules/nf-core/bandage/image/**
- tests/modules/nf-core/bandage/image/**
barrnap:
- modules/nf-core/barrnap/**
- tests/modules/nf-core/barrnap/**
basicpy:
- modules/nf-core/basicpy/**
- tests/modules/nf-core/basicpy/**
Expand Down
15 changes: 0 additions & 15 deletions tests/modules/nf-core/barrnap/main.nf

This file was deleted.

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

This file was deleted.

8 changes: 0 additions & 8 deletions tests/modules/nf-core/barrnap/test.yml

This file was deleted.

0 comments on commit c4c7ecb

Please sign in to comment.