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/dbimport from readsimulator pipeline #6584

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions modules/nf-core/crabs/dbimport/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: crabs_dbimport
channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::crabs=0.1.1"
56 changes: 56 additions & 0 deletions modules/nf-core/crabs/dbimport/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
process CRABS_DBIMPORT {
tag "$meta.id"
label 'process_medium'

// WARN: Version information not provided by tool on CLI. Please update version string below when bumping container versions.
conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/crabs:0.1.1--pyhb7b1952_0':
'biocontainers/crabs:0.1.1--pyhb7b1952_0' }"

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

output:
tuple val(meta), path("*.fa"), emit: fasta
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}"
def VERSION = '0.1.1' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
def is_compressed = fasta.name.endsWith(".gz")
def fasta_name = fasta.name.replace(".gz", "")
"""
if [ "${is_compressed}" == "true" ]; then
gzip -c -d ${fasta} > ${fasta_name}
fi

crabs db_import \\
--input ${fasta_name} \\
--output ${prefix}.crabsdb.fa \\
$args

rm ${fasta_name}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
crabs: $VERSION
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
def VERSION = '0.1.1' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
"""
touch ${prefix}.fa

cat <<-END_VERSIONS > versions.yml
"${task.process}":
crabs: $VERSION
END_VERSIONS
"""
}
51 changes: 51 additions & 0 deletions modules/nf-core/crabs/dbimport/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: crabs_dbimport
description: In-house generated or curated data can be imported into CRABS.
keywords:
- insilico
- amplicon
- sequencing
- inhouse
tools:
- crabs:
description: |
Crabs (Creating Reference databases for Amplicon-Based Sequencing)
is a program to download and curate reference databases
for eDNA metabarcoding analyses
homepage: https://github.com/gjeunen/reference_database_creator
documentation: https://github.com/gjeunen/reference_database_creator?tab=readme-ov-file#running-crabs
tool_dev_url: https://github.com/gjeunen/reference_database_creator
doi: https://doi.org/10.1111/1755-0998.13741
famosab marked this conversation as resolved.
Show resolved Hide resolved
licence: ["MIT License"]

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- fasta:
type: file
description: In-house sequencing data
pattern: "*.{fa,fasta}"

output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- fasta:
type: file
description: Reverse complemented Sequence
pattern: "*.{fa,fasta}"

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

name "Test Process CRABS_DBIMPORT"
script "../main.nf"
process "CRABS_DBIMPORT"
config "./nextflow.config"

tag "modules"
tag "modules_nfcore"
tag "crabs"
tag "crabs/dbimport"

test("sarscov2 - fasta") {

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

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

}

test("sarscov2 - fasta - stub") {

options "-stub"

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

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

}

}
68 changes: 68 additions & 0 deletions modules/nf-core/crabs/dbimport/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"sarscov2 - fasta - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.fa:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,aa9d175ec56d1dce0a3588883ab1b00a"
],
"fasta": [
[
{
"id": "test"
},
"test.fa:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,aa9d175ec56d1dce0a3588883ab1b00a"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-05T12:42:46.076137"
},
"sarscov2 - fasta": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.crabsdb.fa:md5,f46e9d5dbadcfda9a8d7d01e4bf7dfb2"
]
],
"1": [
"versions.yml:md5,aa9d175ec56d1dce0a3588883ab1b00a"
],
"fasta": [
[
{
"id": "test"
},
"test.crabsdb.fa:md5,f46e9d5dbadcfda9a8d7d01e4bf7dfb2"
]
],
"versions": [
"versions.yml:md5,aa9d175ec56d1dce0a3588883ab1b00a"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-05T12:42:41.421262"
}
}
7 changes: 7 additions & 0 deletions modules/nf-core/crabs/dbimport/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
process {

withName: CRABS_DBIMPORT {
ext.args = "--seq_header species --delim ' '"
}

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