Skip to content

Commit

Permalink
Add module: GTFSORT (nf-core#5237)
Browse files Browse the repository at this point in the history
* Initial commit

* Fix formatting
  • Loading branch information
georgiakes authored and jennylsmith committed Mar 20, 2024
1 parent 578ebda commit 632ef50
Show file tree
Hide file tree
Showing 6 changed files with 193 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/nf-core/gtfsort/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
name: "gtfsort"
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- "bioconda::gtfsort=0.2.2"
49 changes: 49 additions & 0 deletions modules/nf-core/gtfsort/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
process GTFSORT {
tag "$gtf"
label 'process_low'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/gtfsort:0.2.2--h4ac6f70_0':
'biocontainers/gtfsort:0.2.2--h4ac6f70_0' }"

input:

path gtf

output:
path "*.sorted.gtf", emit: gtf
path "versions.yml", emit: versions

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

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${gtf.baseName}"

"""
gtfsort \\
-i $gtf \\
-o ${prefix}.sorted.gtf \\
-t $task.cpus
cat <<-END_VERSIONS > versions.yml
"${task.process}":
gtfsort: \$(gtfsort --version |& sed 's/gtfsort //')
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${gtf.baseName}"

"""
touch ${prefix}.sorted.gtf
cat <<-END_VERSIONS > versions.yml
"${task.process}":
gtfsort: \$(gtfsort --version |& sed 's/gtfsort //')
END_VERSIONS
"""
}
34 changes: 34 additions & 0 deletions modules/nf-core/gtfsort/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: "gtfsort"
description: Sort GTF files in chr/pos/feature order
keywords:
- sort
- example
- genomics
tools:
- "gtfsort":
description: "A chr/pos/feature GTF sorter that uses a lexicographically-based index ordering algorithm."
homepage: "https://github.com/alejandrogzi/gtfsort"
documentation: "https://github.com/alejandrogzi/gtfsort"
tool_dev_url: "https://github.com/alejandrogzi/gtfsort"
licence: ["MIT"]

input:
- gtf:
type: file
description: Unsorted GTF/GFF file.
pattern: "*.gtf"

output:
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- gtf:
type: file
description: Sorted GTF file
pattern: "*.gtf"
authors:
- "@georgiakes"
maintainers:
- "@georgiakes"
51 changes: 51 additions & 0 deletions modules/nf-core/gtfsort/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "gtfsort"

test("hsapiens - gtf") {

when {
process {
"""
input[0] = file(params.test_data['homo_sapiens']['genome']['genome_gtf'], checkIfExists: true)
"""
}
}

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

}

test("hsapiens - gtf - stub") {

options "-stub"

when {
process {
"""
input[0] = file(params.test_data['homo_sapiens']['genome']['genome_gtf'], checkIfExists: true)
"""
}
}

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

}

}
48 changes: 48 additions & 0 deletions modules/nf-core/gtfsort/tests/main.nf.test.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions modules/nf-core/gtfsort/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gtfsort:
- "modules/nf-core/gtfsort/**"

0 comments on commit 632ef50

Please sign in to comment.