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

Kaiju version bump- nf-test -add stub #4781

Merged
merged 7 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
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