Skip to content

Commit

Permalink
Merge branch 'master' into gzrt
Browse files Browse the repository at this point in the history
  • Loading branch information
mazzalab authored Dec 24, 2024
2 parents 1fd8f74 + 51c2192 commit bc082ab
Show file tree
Hide file tree
Showing 7 changed files with 699 additions and 435 deletions.
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://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- bioconda
- conda-forge
dependencies:
- bioconda::kma=1.4.15
52 changes: 52 additions & 0 deletions modules/nf-core/kma/index/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
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--h577a1d6_1' :
'biocontainers/kma:1.4.15--h577a1d6_1' }"

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

output:
tuple val(meta), path("kmaindex"), emit: index
path "versions.yml", emit: versions

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

script:
def prefix = task.ext.prefix ?: "${fasta.baseName}"
def args = task.ext.args ?: ''
"""
mkdir kmaindex
kma \\
index \\
-i ${fasta} \\
-o kmaindex/${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 ?: "${fasta.baseName}"
"""
mkdir kmaindex
touch kmaindex/${prefix}.comp.b
touch kmaindex/${prefix}.length.b
touch kmaindex/${prefix}.name
touch kmaindex/${prefix}.seq.b
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://raw.githubusercontent.com/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:
- index:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'reference' ]`
- 'kmaindex':
type: directory
description: Directory of KMA index files
pattern: "*.{comp.b,length.b,name,seq.b}"
- 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
},
[
"genome.comp.b:md5,d41d8cd98f00b204e9800998ecf8427e",
"genome.length.b:md5,d41d8cd98f00b204e9800998ecf8427e",
"genome.name:md5,d41d8cd98f00b204e9800998ecf8427e",
"genome.seq.b:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"1": [
"versions.yml:md5,ba9763933bdc811b1e19e466cceae9c8"
],
"index": [
[
{
"id": "MT192765.1",
"single_end": false
},
[
"genome.comp.b:md5,d41d8cd98f00b204e9800998ecf8427e",
"genome.length.b:md5,d41d8cd98f00b204e9800998ecf8427e",
"genome.name:md5,d41d8cd98f00b204e9800998ecf8427e",
"genome.seq.b:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"versions": [
"versions.yml:md5,ba9763933bdc811b1e19e466cceae9c8"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
},
"timestamp": "2024-12-19T17:07:30.875020727"
},
"sarscov2 - fasta": {
"content": [
{
"0": [
[
{
"id": "MT192765.1",
"single_end": false
},
[
"genome.comp.b:md5,2d4075cee26606cfb9b3624f8d7fe260",
"genome.length.b:md5,aaded6f5e19db3f3292e7ff9cd0157ec",
"genome.name:md5,e98cac0e614ac65bb458f77245af7d32",
"genome.seq.b:md5,48647a9697263fe218ddc728c2d01641"
]
]
],
"1": [
"versions.yml:md5,ba9763933bdc811b1e19e466cceae9c8"
],
"index": [
[
{
"id": "MT192765.1",
"single_end": false
},
[
"genome.comp.b:md5,2d4075cee26606cfb9b3624f8d7fe260",
"genome.length.b:md5,aaded6f5e19db3f3292e7ff9cd0157ec",
"genome.name:md5,e98cac0e614ac65bb458f77245af7d32",
"genome.seq.b:md5,48647a9697263fe218ddc728c2d01641"
]
]
],
"versions": [
"versions.yml:md5,ba9763933bdc811b1e19e466cceae9c8"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
},
"timestamp": "2024-12-19T17:07:24.8942212"
}
}
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

0 comments on commit bc082ab

Please sign in to comment.