Skip to content

Commit

Permalink
Kaiju version bump- nf-test -add stub (nf-core#4781)
Browse files Browse the repository at this point in the history
* kaiju modules patch

* add kaiju nf-test and stub

* adding test & stub 4 kaiju2krona

* undo raven change

* kaiju2table & kaijumkfmi

* Add taxonomic profiling as a keyword in meta.yml
  • Loading branch information
Joon-Klaps authored and jennylsmith committed Mar 20, 2024
1 parent 39f0e63 commit d898599
Show file tree
Hide file tree
Showing 36 changed files with 600 additions and 188 deletions.
2 changes: 1 addition & 1 deletion modules/nf-core/kaiju/kaiju/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- bioconda
- defaults
dependencies:
- bioconda::kaiju=1.8.2
- bioconda::kaiju=1.10.0
18 changes: 16 additions & 2 deletions modules/nf-core/kaiju/kaiju/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ process KAIJU_KAIJU {

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/kaiju:1.8.2--h5b5514e_1':
'biocontainers/kaiju:1.8.2--h5b5514e_1' }"
'https://depot.galaxyproject.org/singularity/kaiju:1.10.0--h43eeafb_0':
'biocontainers/kaiju:1.10.0--h43eeafb_0' }"

input:
tuple val(meta), path(reads)
Expand Down Expand Up @@ -38,4 +38,18 @@ process KAIJU_KAIJU {
kaiju: \$(echo \$( kaiju -h 2>&1 | sed -n 1p | sed 's/^.*Kaiju //' ))
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def input = meta.single_end ? "-i ${reads}" : "-i ${reads[0]} -j ${reads[1]}"
"""
touch ${prefix}.tsv
cat <<-END_VERSIONS > versions.yml
"${task.process}":
kaiju: \$(echo \$( kaiju -h 2>&1 | sed -n 1p | sed 's/^.*Kaiju //' ))
END_VERSIONS
"""

}
2 changes: 1 addition & 1 deletion modules/nf-core/kaiju/kaiju/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ input:
respectively.
pattern: "*.{fastq,fq,fasta,fa,fsa,fas,fna,fastq.gz,fq.gz,fasta.gz,fa.gz,fsa.gz,fas.gz,fna.gz}"
- db:
type: files
type: directory
description: |
List containing the database and nodes files for Kaiju
e.g. [ 'database.fmi', 'nodes.dmp' ]
Expand Down
117 changes: 117 additions & 0 deletions modules/nf-core/kaiju/kaiju/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "kaiju"
tag "kaiju/kaiju"
tag "untar"

test("sarscov2 - fastq - single-end") {

setup {
run ("UNTAR"){
script "../../../untar/main.nf"
process {
"""
input[0] = [ [], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/kaiju.tar.gz', checkIfExists: true) ]
"""
}
}
}

when {
process {
"""
input[0] = [
[ id:'test', single_end:true ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)
]
input[1] = UNTAR.out.untar.map{ it[1] }
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert path(process.out.results[0][1]).getText().contains("C\tERR5069949.2257580\t2697049") }
)
}

}

test("sarscov2 - fastq - paired-end") {

setup {
run ("UNTAR"){
script "../../../untar/main.nf"
process {
"""
input[0] = [ [], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/kaiju.tar.gz', checkIfExists: true) ]
"""
}
}
}

when {
process {
"""
input[0] = [
[ id:'test', 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] = UNTAR.out.untar.map{ it[1] }
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert path(process.out.results[0][1]).getText().contains("C\tERR5069949.2257580\t2697049") }
)
}
}

test("sarscov2 - fastq - stub") {

options '-stub'

setup {
run ("UNTAR"){
script "../../../untar/main.nf"
process {
"""
input[0] = [ [], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/kaiju.tar.gz', checkIfExists: true) ]
"""
}
}
}

when {
process {
"""
input[0] = [
[ id:'test', 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] = UNTAR.out.untar.map{ it[1] }
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(file(process.out.results[0][1]).name).match() }
)
}
}

}
8 changes: 8 additions & 0 deletions modules/nf-core/kaiju/kaiju/tests/main.nf.test.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions modules/nf-core/kaiju/kaiju/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
kaiju/kaiju:
- "modules/nf-core/kaiju/kaiju/**"
2 changes: 1 addition & 1 deletion modules/nf-core/kaiju/kaiju2krona/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- bioconda
- defaults
dependencies:
- bioconda::kaiju=1.8.2
- bioconda::kaiju=1.10.0
17 changes: 15 additions & 2 deletions modules/nf-core/kaiju/kaiju2krona/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ process KAIJU_KAIJU2KRONA {

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/kaiju:1.8.2--h5b5514e_1':
'biocontainers/kaiju:1.8.2--h5b5514e_1' }"
'https://depot.galaxyproject.org/singularity/kaiju:1.10.0--h43eeafb_0':
'biocontainers/kaiju:1.10.0--h43eeafb_0' }"

input:
tuple val(meta), path(tsv)
Expand Down Expand Up @@ -36,4 +36,17 @@ process KAIJU_KAIJU2KRONA {
kaiju: \$(echo \$( kaiju -h 2>&1 | sed -n 1p | sed 's/^.*Kaiju //' ))
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
kaiju: \$(echo \$( kaiju -h 2>&1 | sed -n 1p | sed 's/^.*Kaiju //' ))
END_VERSIONS
"""
}

105 changes: 105 additions & 0 deletions modules/nf-core/kaiju/kaiju2krona/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "kaiju"
tag "kaiju/kaiju2krona"
tag "kaiju/kaiju"
tag "untar"

test("sarscov2 - fastq - single-end") {


setup {
run ("UNTAR"){
script "../../../untar/main.nf"
process {
"""
input[0] = [ [], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/kaiju.tar.gz', checkIfExists: true) ]
"""
}
}

run("KAIJU_KAIJU") {
script "../../kaiju/main.nf"
process {
"""
input[0] = [
[ id:'test', single_end:true ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)
]
input[1] = UNTAR.out.untar.map{ it[1] }
"""
}
}
}

when {
process {
"""
input[0] = KAIJU_KAIJU.out.results
input[1] = UNTAR.out.untar.map{ it[1] }
"""
}
}

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

}

test("sarscov2 - fastq - stub") {

options "-stub"

setup {
run ("UNTAR"){
script "../../../untar/main.nf"
process {
"""
input[0] = [ [], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/kaiju.tar.gz', checkIfExists: true) ]
"""
}
}

run("KAIJU_KAIJU") {
script "../../kaiju/main.nf"
process {
"""
input[0] = [
[ id:'test', single_end:true ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)
]
input[1] = UNTAR.out.untar.map{ it[1] }
"""
}
}
}

when {
process {
"""
input[0] = KAIJU_KAIJU.out.results
input[1] = UNTAR.out.untar.map{ it[1] }
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(file(process.out.txt[0][1]).name).match() }
)
}

}

}
39 changes: 39 additions & 0 deletions modules/nf-core/kaiju/kaiju2krona/tests/main.nf.test.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions modules/nf-core/kaiju/kaiju2krona/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
kaiju/kaiju2krona:
- "modules/nf-core/kaiju/kaiju2krona/**"
2 changes: 1 addition & 1 deletion modules/nf-core/kaiju/kaiju2table/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- bioconda
- defaults
dependencies:
- bioconda::kaiju=1.8.2
- bioconda::kaiju=1.10.0
Loading

0 comments on commit d898599

Please sign in to comment.