Skip to content

Commit

Permalink
Added tirlearner
Browse files Browse the repository at this point in the history
  • Loading branch information
GallVp committed May 2, 2024
1 parent 9825a03 commit b9672b5
Show file tree
Hide file tree
Showing 27 changed files with 941 additions and 1 deletion.
9 changes: 9 additions & 0 deletions modules/edta-components/tirlearner/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: "tirlearner"
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- "bioconda::tir-learner=3.0.1"
64 changes: 64 additions & 0 deletions modules/edta-components/tirlearner/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
process TIRLEARNER {
tag "$meta.id"
label 'process_high'

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

input:
tuple val(meta), path(fasta)
val species

output:
tuple val(meta), path("${prefix}.fa") , emit: fasta
tuple val(meta), path("${prefix}.gff3") , emit: gff
tuple val(meta), path("${prefix}.filtered.fa") , emit: filtered_fasta
tuple val(meta), path("${prefix}.filtered.gff3"), emit: filtered_gff
path "versions.yml" , emit: versions

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

script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
if ( "$fasta" == "${prefix}.fa" ) error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"
"""
TIR-Learner \\
-f $fasta \\
-s $species \\
-t $task.cpus \\
-o $prefix \\
$args
mv "${prefix}/TIR-Learner-Result/TIR-Learner_FinalAnn.fa" "${prefix}.fa"
mv "${prefix}/TIR-Learner-Result/TIR-Learner_FinalAnn.gff3" "${prefix}.gff3"
mv "${prefix}/TIR-Learner-Result/TIR-Learner_FinalAnn_filter.fa" "${prefix}.filtered.fa"
mv "${prefix}/TIR-Learner-Result/TIR-Learner_FinalAnn_filter.gff3" "${prefix}.filtered.gff3"
cat <<-END_VERSIONS > versions.yml
"${task.process}":
TIR-Learner: \$(TIR-Learner -v | head -n 1 | sed 's/TIR-Learner //')
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
if ( "$fasta" == "${prefix}.fa" ) error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"
"""
touch "${prefix}.fa"
touch "${prefix}.gff3"
touch "${prefix}.filtered.fa"
touch "${prefix}.filtered.gff3"
cat <<-END_VERSIONS > versions.yml
"${task.process}":
TIR-Learner: \$(TIR-Learner -v | head -n 1 | sed 's/TIR-Learner //')
END_VERSIONS
"""
}
64 changes: 64 additions & 0 deletions modules/edta-components/tirlearner/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "tirlearner"
description: |
Ensemble Method for TIR Transposable Element Annotation
keywords:
- genomics
- annotation
- repeat
- transposable
tools:
- "TIR-Learner":
description: TIR-Learner
homepage: "https://github.com/lutianyu2001/TIR-Learner"
documentation: "https://github.com/lutianyu2001/TIR-Learner"
tool_dev_url: "https://github.com/lutianyu2001/TIR-Learner"
doi: "10.1016/j.molp.2019.02.008"
licence: ["GPLv3"]
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- fasta:
type: file
description: Genome sequences in fasta format
pattern: "*.{fsa,fa,fasta}"
- species:
type: string
description: |
"maize", "rice" or "others"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- fasta:
type: file
description: Putative TIRs in fasta format
pattern: "*.fa"
- gff:
type: file
description: Putative TIRs in GFF3 format
pattern: "*.gff3"
- filtered_fasta:
type: file
description: Filtered TIRs in fasta format
pattern: "*.fa"
- filtered_gff:
type: file
description: Filtered TIRs in GFF3 format
pattern: "*.gff3"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@jguhlin"
- "@GallVp"
maintainers:
- "@jguhlin"
- "@GallVp"
68 changes: 68 additions & 0 deletions modules/edta-components/tirlearner/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "tirlearner"
tag "gunzip/main"

setup {
run('GUNZIP') {
script "../../../nf-core/gunzip/main"

process {
"""
input[0] = [
[ id:'test' ], // meta map
file(params.test_data['actinidia_chinensis']['genome']['genome_1_fasta_gz'], checkIfExists: true)
]
"""
}
}
}

test("actinidia_chinensis-genome_1_fasta_gz-success") {

when {
process {
"""
input[0] = GUNZIP.out.gunzip
input[1] = 'others'
"""
}
}

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

}

test("stub") {

options "-stub"

when {
process {
"""
input[0] = GUNZIP.out.gunzip
input[1] = 'others'
"""
}
}

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

}
}
164 changes: 164 additions & 0 deletions modules/edta-components/tirlearner/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/edta-components/tirlearner/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tirlearner:
- "modules/edta-components/tirlearner/**"
Loading

0 comments on commit b9672b5

Please sign in to comment.