Skip to content

Commit

Permalink
Added repeatmodeler/builddatabase (nf-core#5416)
Browse files Browse the repository at this point in the history
* Added repeatmodeler/builddatabase

* Fixed version extraction

* Now doing md5 check on stable db files
  • Loading branch information
GallVp authored Apr 25, 2024
1 parent c971cdb commit 1cbb555
Show file tree
Hide file tree
Showing 6 changed files with 257 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/nf-core/repeatmodeler/builddatabase/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: "repeatmodeler_builddatabase"
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- "bioconda::repeatmodeler=2.0.5"
50 changes: 50 additions & 0 deletions modules/nf-core/repeatmodeler/builddatabase/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
process REPEATMODELER_BUILDDATABASE {
tag "$meta.id"
label 'process_single'

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

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

output:
tuple val(meta), path("${prefix}.*") , emit: db
path "versions.yml" , emit: versions

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

script:
prefix = task.ext.prefix ?: "${meta.id}"
"""
BuildDatabase \\
-name $prefix \\
$fasta
cat <<-END_VERSIONS > versions.yml
"${task.process}":
repeatmodeler: \$(RepeatModeler --version | sed 's/RepeatModeler version //')
END_VERSIONS
"""

stub:
prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.nhr
touch ${prefix}.nin
touch ${prefix}.njs
touch ${prefix}.nnd
touch ${prefix}.nni
touch ${prefix}.nog
touch ${prefix}.nsq
touch ${prefix}.translation
cat <<-END_VERSIONS > versions.yml
"${task.process}":
repeatmodeler: \$(RepeatModeler --version | sed 's/RepeatModeler version //')
END_VERSIONS
"""
}
44 changes: 44 additions & 0 deletions modules/nf-core/repeatmodeler/builddatabase/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "repeatmodeler_builddatabase"
description: Create a database for RepeatModeler
keywords:
- genomics
- fasta
- repeat
tools:
- "repeatmodeler":
description: "RepeatModeler is a de-novo repeat family identification and modeling package."
homepage: "https://github.com/Dfam-consortium/RepeatModeler"
documentation: "https://github.com/Dfam-consortium/RepeatModeler"
tool_dev_url: "https://github.com/Dfam-consortium/RepeatModeler"
licence: ["Open Software License v2.1"]

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- fasta:
type: file
description: Fasta file
pattern: "*.{fasta,fsa,fa}"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- db:
type: file
description: Database files for repeatmodeler
pattern: "`${prefix}.*`"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@GallVp"
maintainers:
- "@GallVp"
60 changes: 60 additions & 0 deletions modules/nf-core/repeatmodeler/builddatabase/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "repeatmodeler"
tag "repeatmodeler/builddatabase"

test("sarscov2-genome_fasta") {

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

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.versions).match("versions") },
{ assert snapshot(process.out.db[0][1].collect { file(it).name }.sort().toString()).match("db") },
{ assert snapshot(process.out.db[0][1].findAll { ! ( "$it"[-3..-1] in [ 'nin', 'njs' ] ) } ).match("stable_md5") }
)
}

}

test("sarscov2-genome_fasta-stub") {

options "-stub"

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

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

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"sarscov2-genome_fasta-stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
[
"test.nhr:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.nin:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.njs:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.nnd:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.nni:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.nog:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.nsq:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.translation:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"1": [
"versions.yml:md5,7944637266bc3e2726899eaad5e46c87"
],
"db": [
[
{
"id": "test"
},
[
"test.nhr:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.nin:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.njs:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.nnd:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.nni:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.nog:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.nsq:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.translation:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"versions": [
"versions.yml:md5,7944637266bc3e2726899eaad5e46c87"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-04-02T12:06:44.261566"
},
"versions": {
"content": [
[
"versions.yml:md5,7944637266bc3e2726899eaad5e46c87"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-01-09T15:14:48.807063"
},
"stable_md5": {
"content": [
[
"test.nhr:md5,1a41cb6d0b00c28f62ad60e75ae2f6fc",
"test.nnd:md5,2002e13acf59079a1a5782c918894579",
"test.nni:md5,26a954ba0fd80983b550d8f6b8b35ff8",
"test.nog:md5,30896f123998e926ea2237b89091e7fe",
"test.nsq:md5,982cbc7d9e38743b9b1037588862b9da",
"test.translation:md5,ccbb119522c09daa976a9015ba999329"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-04-23T10:03:41.669433"
},
"db": {
"content": [
"[test.nhr, test.nin, test.njs, test.nnd, test.nni, test.nog, test.nsq, test.translation]"
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-04-02T12:08:36.94713"
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/repeatmodeler/builddatabase/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
repeatmodeler/builddatabase:
- "modules/nf-core/repeatmodeler/builddatabase/**"

0 comments on commit 1cbb555

Please sign in to comment.