Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add crabs/downloadtaxonomy as module #7423

Closed
wants to merge 16 commits into from
7 changes: 7 additions & 0 deletions modules/nf-core/crabs/downloadtaxonomy/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::crabs=1.0.7"
53 changes: 53 additions & 0 deletions modules/nf-core/crabs/downloadtaxonomy/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
process CRABS_DOWNLOADTAXONOMY {
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/crabs:1.0.7--pyhdfd78af_0':
'biocontainers/crabs:1.0.7--pyhdfd78af_0' }"

input:
val(meta)

output:
tuple val(meta), path("*/nucl_gb.accession2taxid"), emit: accession2taxid
tuple val(meta), path("*/names.dmp") , emit: names
tuple val(meta), path("*/nodes.dmp") , emit: nodes
tuple val(meta), path("*") , emit: downloadtaxonomy_dir
path "versions.yml" , emit: versions

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

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
mkdir ${prefix}

crabs --download-taxonomy \\
--output ${prefix} \\
$args

cat <<-END_VERSIONS > versions.yml
"${task.process}":
crabs: \$(crabs --help | grep 'CRABS |' | sed 's/.*CRABS | \\(v[0-9.]*\\).*/\\1/')
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
mkdir ${prefix}
touch ${prefix}/nucl_gb.accession2taxid
touch ${prefix}/names.dmp
touch ${prefix}/nodes.dmp

cat <<-END_VERSIONS > versions.yml
"${task.process}":
crabs: \$(crabs --help | grep 'CRABS |' | sed 's/.*CRABS | \\(v[0-9.]*\\).*/\\1/')
END_VERSIONS
"""
}
69 changes: 69 additions & 0 deletions modules/nf-core/crabs/downloadtaxonomy/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "crabs_downloadtaxonomy"
## TODO nf-core: Add a description of the module and list keywords
description: write your description here
keywords:
- sort
- example
- genomics
tools:
- "crabs":
## TODO nf-core: Add a description and other details for the software below
description: "Crabs (Creating Reference databases for Amplicon-Based Sequencing) is a program to download and curate reference databases for eDNA metabarcoding analyses."
homepage: "None"
documentation: "None"
tool_dev_url: "https://github.com/gjeunen/reference_database_creator"
doi: ""
licence: ['MIT']
identifier:

## TODO nf-core: Add a description of all of the variables used as input
input:
# Only when we have meta
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`

## TODO nf-core: Delete / customise this example input
- bam:
type: file
description: Sorted BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"
ontologies:
- edam: "http://edamontology.org/format_25722"
- edam: "http://edamontology.org/format_2573"
- edam: "http://edamontology.org/format_3462"


## TODO nf-core: Add a description of all of the variables used as output
output:
- bam:
#Only when we have meta
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
## TODO nf-core: Delete / customise this example output
- "*.bam":
type: file
description: Sorted BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"
ontologies:
- edam: "http://edamontology.org/format_25722"
- edam: "http://edamontology.org/format_2573"
- edam: "http://edamontology.org/format_3462"

- versions:
- "versions.yml":
type: file
description: File containing software versions
pattern: "versions.yml"

authors:
- "@famosab"
maintainers:
- "@famosab"
58 changes: 58 additions & 0 deletions modules/nf-core/crabs/downloadtaxonomy/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "crabs"
tag "crabs/downloadtaxonomy"

test("download") {

when {
params {
module_args = "--exclude 'acc2taxid,taxdump'"
}
process {
"""
input[0] = [ id:'test' ]
"""
}
}

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

}

test("download - stub") {

options "-stub"

when {
process {
"""
input[0] = [ id:'test' ]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out,
path(process.out.versions[0]).yaml
).match() }
)
}

}

}
137 changes: 137 additions & 0 deletions modules/nf-core/crabs/downloadtaxonomy/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
{
"download": {
"content": [
{
"0": [

],
"1": [

],
"2": [

],
"3": [

],
"accession2taxid": [

],
"names": [

],
"nodes": [

],
"versions": [

]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.4"
},
"timestamp": "2025-02-03T13:56:49.20584"
},
"download - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
"nucl_gb.accession2taxid:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
[
{
"id": "test"
},
"names.dmp:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"2": [
[
{
"id": "test"
},
"nodes.dmp:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"3": [
[
{
"id": "test"
},
[
[
"names.dmp:md5,d41d8cd98f00b204e9800998ecf8427e",
"nodes.dmp:md5,d41d8cd98f00b204e9800998ecf8427e",
"nucl_gb.accession2taxid:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"versions.yml:md5,b98b46449a638f8825d42a6abe7a742e"
]
]
],
"4": [
"versions.yml:md5,b98b46449a638f8825d42a6abe7a742e"
],
"accession2taxid": [
[
{
"id": "test"
},
"nucl_gb.accession2taxid:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"downloadtaxonomy_dir": [
[
{
"id": "test"
},
[
[
"names.dmp:md5,d41d8cd98f00b204e9800998ecf8427e",
"nodes.dmp:md5,d41d8cd98f00b204e9800998ecf8427e",
"nucl_gb.accession2taxid:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"versions.yml:md5,b98b46449a638f8825d42a6abe7a742e"
]
]
],
"names": [
[
{
"id": "test"
},
"names.dmp:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"nodes": [
[
{
"id": "test"
},
"nodes.dmp:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,b98b46449a638f8825d42a6abe7a742e"
]
},
{
"CRABS_DOWNLOADTAXONOMY": {
"crabs": "v1.0.7"
}
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.4"
},
"timestamp": "2025-02-03T14:07:27.923472"
}
}
7 changes: 7 additions & 0 deletions modules/nf-core/crabs/downloadtaxonomy/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
process {

withName: 'CRABS_DOWNLOADTAXONOMY' {
ext.args = params.module_args
}

}
Loading