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

New kma module #7251

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d9eb239
initial commit of kma_index
Krannich479 Dec 17, 2024
e82cf63
trying to fix linting for meta.yml
Krannich479 Dec 17, 2024
f0ff8e1
fix linting of meta.yml again
Krannich479 Dec 17, 2024
a555a38
fixing DOI for linting
Krannich479 Dec 17, 2024
45f194b
fixing file type for linting
Krannich479 Dec 17, 2024
7c613db
fix output file name for linting
Krannich479 Dec 17, 2024
92fda87
add snapshot
Krannich479 Dec 18, 2024
6de9795
Merge branch 'master' into kma_index
Krannich479 Dec 18, 2024
ab5eb71
initial commit of kma/kma code
Krannich479 Dec 19, 2024
62705ef
stage commit: nf-test for kma/kma
Krannich479 Dec 19, 2024
f52f84b
update output format
Krannich479 Dec 19, 2024
a7cf40e
Merge branch 'master' into kma_index
Krannich479 Dec 19, 2024
db548f3
output definition in proper Harshil Alignment
Krannich479 Dec 19, 2024
2d0e4ab
upgrade latest container build trying to satisfy docker CI
Krannich479 Dec 19, 2024
cadb172
update stub; update docker container version
Krannich479 Dec 20, 2024
53cb113
Merge pull request #1 from Krannich479/kma_index
Krannich479 Dec 20, 2024
09edd79
stage commit nf-test
Krannich479 Dec 20, 2024
c2464c4
fix gzipped stub files
Krannich479 Jan 14, 2025
b05f496
Merge branch 'master' into kma_kma
Krannich479 Jan 14, 2025
e5ca7a1
Fix execution errors
jfy133 Jan 15, 2025
927ce28
fix licence identifier
Krannich479 Jan 15, 2025
295f8bf
Merge branch 'master' into kma_kma
Krannich479 Jan 15, 2025
e1e5ec8
correct KMA module name in config
Krannich479 Jan 15, 2025
3a53a34
fix stub
Krannich479 Jan 15, 2025
de4e59c
add tests for all vaild file parameter combinations; add snapshot
Krannich479 Jan 15, 2025
ad751ea
Merge branch 'master' into kma_kma
Krannich479 Jan 15, 2025
b75fbf6
use wave container if docker is engine
Krannich479 Jan 20, 2025
a3bd776
Merge pull request #2 from Krannich479/wave4docker
Krannich479 Jan 20, 2025
7087914
Merge branch 'master' into kma_kma
Krannich479 Jan 20, 2025
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
7 changes: 7 additions & 0 deletions modules/nf-core/kma/kma/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:
- kma==1.4.15
66 changes: 66 additions & 0 deletions modules/nf-core/kma/kma/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
process KMA {
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(reads)
tuple val(meta2), path(index)
val interleaved
val mat_format

output:
tuple val(meta), path("*.res"), optional: true, emit: res
tuple val(meta), path("*.fsa"), optional: true, emit: fsa
tuple val(meta), path("*.aln"), optional: true, emit: aln
tuple val(meta), path("*.frag.gz"), optional: true, emit: frag
tuple val(meta), path("*.mat.gz"), optional: true, emit: mat // if mat_format == true
tuple val(meta), path("*.spa"), optional: true, emit: spa // if ext.args contains '-Sparse' (only output in this case)
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}.${meta2.id}.kma"
def input_style = interleaved ? "-int ${reads}" : "-ipe ${reads}"
def create_mat = mat_format ? "-matrix" : ''
"""
INDEX=`find -L ./ -name "*.name" | sed 's/\\.name\$//'`

kma \\
${input_style} \\
-o ${prefix} \\
-t_db \$INDEX \\
${create_mat} \\
$args

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

stub:
def prefix = task.ext.prefix ?: "${meta.id}.${meta2.id}.kma"
def create_mat = mat_format ? "touch ${prefix}.mat.gz" : ''
def create_spa = task.ext.args.contains('-Sparse') ? "touch ${prefix}.spa" : ''
"""
touch ${prefix}.res \\
touch ${prefix}.fsa \\
touch ${prefix}.aln \\
touch ${prefix}.frag.gz \\
${create_mat} \\
${create_spa}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
kma: \$(echo \$(kma -v 2>&1) | sed 's/^KMA-\$//')
END_VERSIONS
"""
}
118 changes: 118 additions & 0 deletions modules/nf-core/kma/kma/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "KMA"
description: Aligning reads to a DB via KMA alignment
keywords:
- fastq
- reads
- alignment
- kma
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"]
Krannich479 marked this conversation as resolved.
Show resolved Hide resolved

input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'sample' ]
- reads:
type: file
description: FASTQ files
pattern: "*.{fastq,fq}"
- - meta2:
type: map
description: |
Groovy Map containing reference index information
e.g. [ id:'reference' ]
- index:
type: file
description: kma database file generated via kma_index
pattern: "*.{comp.b,length.b,name,seq.b}"
- - interleaved:
type: boolean
description: use one interleaved fastq file (true) or two paired fastq files (false)
pattern: "true or false"
- - mat_format:
type: boolean
description: generate additional matrix file (true) or not (false)
pattern: "true or false"

output:
- res:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'reference' ]
- '*.res':
type: file
description: A result overview giving the most common statistics for each mapped template.
pattern: "*.{res}"
- fsa:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'reference' ]
- '*.fsa':
type: file
description: The consensus sequences drawn from the alignments.
pattern: "*.{fsa}"
- aln:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'reference' ]
- '*.aln':
type: file
description: The consensus alignment of the reads against their template.
pattern: "*.{aln}"
- frag:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'reference' ]
- '*.frag.gz':
type: file
description: Mapping information on each mapped read, where the columns are read, number of equally well mapping templates, mapping score, start position, end position (w.r.t. template), the choosen template.
pattern: "*.{frag.gz}"
- mat:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'reference' ]
- '*.mat.gz':
type: file
description: Base counts on each position in each template, (only if -matrix is enabled).
pattern: "*.{mat.gz}"
- spa:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'reference' ]
- '*.spa':
type: file
description: Text file containing the top scoring references.
pattern: "*.{spa}"
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"

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

name "Test Process KMA_KMA"
tag "modules"
tag "modules_nfcore"
tag "kma"
tag "kma/kma"

script "../main.nf"
process "KMA_KMA"

setup {
run("KMA_INDEX") {
script "../../index/main.nf"
mazzalab marked this conversation as resolved.
Show resolved Hide resolved
config "nextflow.config"

process {
"""
input[0] = [
[ id: 'MT192765.1', single_end:false ],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
]
"""
}
}
}

/*
Krannich479 marked this conversation as resolved.
Show resolved Hide resolved
test("sarscov2 - fasta") {

when {
process {
"""
input[0] = [
[ id:'nfcore_testsample', single_end:false ],
[
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true)
]
input[1] = KMA_INDEX.out.db
input[2] = false
input[3] = false
]
Krannich479 marked this conversation as resolved.
Show resolved Hide resolved
"""
}
}

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

}
*/

/*
Krannich479 marked this conversation as resolved.
Show resolved Hide resolved
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() }
)
}

}
*/

}
11 changes: 11 additions & 0 deletions modules/nf-core/kma/kma/tests/nextflow.config
Krannich479 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
process {

withName: 'KMA_INDEX' {
ext.args = '-Sparse'
}

withName: 'KMA' {
ext.args = '-1t1 -Sparse'
}

}
Loading