Skip to content

Commit

Permalink
Migrate meryl unionsum nftest (#5404)
Browse files Browse the repository at this point in the history
* Initial migration

* Update tests, add mandatory value, lint

* Bump version

* Update snapshot
  • Loading branch information
mahesh-panchal authored Mar 27, 2024
1 parent a3501bc commit b7f584e
Show file tree
Hide file tree
Showing 10 changed files with 774 additions and 61 deletions.
2 changes: 1 addition & 1 deletion modules/nf-core/meryl/unionsum/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- bioconda
- defaults
dependencies:
- bioconda::meryl=1.3
- bioconda::meryl=1.4.1
18 changes: 16 additions & 2 deletions modules/nf-core/meryl/unionsum/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ process MERYL_UNIONSUM {

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/meryl:1.3--h87f3376_1':
'biocontainers/meryl:1.3--h87f3376_1' }"
'https://depot.galaxyproject.org/singularity/meryl:1.4.1--h4ac6f70_0':
'biocontainers/meryl:1.4.1--h4ac6f70_0' }"

input:
tuple val(meta), path(meryl_dbs)
val kvalue

output:
tuple val(meta), path("*.unionsum.meryldb"), emit: meryl_db
Expand All @@ -22,6 +23,7 @@ process MERYL_UNIONSUM {
def prefix = task.ext.prefix ?: "${meta.id}"
"""
meryl union-sum \\
k=$kvalue \\
threads=$task.cpus \\
$args \\
output ${prefix}.unionsum.meryldb \\
Expand All @@ -32,4 +34,16 @@ process MERYL_UNIONSUM {
meryl: \$( meryl --version |& sed 's/meryl //' )
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.unionsum.meryldb
cat <<-END_VERSIONS > versions.yml
"${task.process}":
meryl: \$( meryl --version |& sed 's/meryl //' )
END_VERSIONS
"""
}
6 changes: 5 additions & 1 deletion modules/nf-core/meryl/unionsum/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ description: A genomic k-mer counter (and sequence utility) with nice features.
keywords:
- k-mer
- unionsum
- reference-free
tools:
- "meryl":
description: "A genomic k-mer counter (and sequence utility) with nice features. "
homepage: "https://github.com/marbl/meryl"
documentation: "https://meryl.readthedocs.io/en/latest/quick-start.html"
tool_dev_url: "https://github.com/marbl/meryl"
licence: "['GPL']"
licence: ["GPL"]
input:
- meta:
type: map
Expand All @@ -19,6 +20,9 @@ input:
- meryl_dbs:
type: directory
description: Meryl k-mer databases
- kvalue:
type: integer
description: An integer value of k to use as the k-mer value.
output:
- meta:
type: map
Expand Down
123 changes: 123 additions & 0 deletions modules/nf-core/meryl/unionsum/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "meryl"
tag "meryl/unionsum"
tag "meryl/count"

test("sarscov2 - fastq - single_end") {

setup {
run('MERYL_COUNT'){
script "../../../../../modules/nf-core/meryl/count/main.nf"
process {
"""
input[0] = Channel.value([
[ 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] = Channel.value(21)
"""
}
}
}

when {
process {
"""
input[0] = MERYL_COUNT.out.meryl_db
input[1] = Channel.value(21)
"""
}
}

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

}

test("sarscov2 - fastq - paired_end") {

setup {
run('MERYL_COUNT'){
script "../../../../../modules/nf-core/meryl/count/main.nf"
process {
"""
input[0] = Channel.value([
[ id: 'test', single_end: false ], // meta map
[
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] = Channel.value(21)
"""
}
}
}

when {
process {
"""
input[0] = MERYL_COUNT.out.meryl_db
input[1] = Channel.value(21)
"""
}
}

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

}

test("sarscov2 - fastq- stub") {

options "-stub"

setup {
run('MERYL_COUNT'){
script "../../../../../modules/nf-core/meryl/count/main.nf"
process {
"""
input[0] = Channel.value([
[ 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] = Channel.value(21)
"""
}
}
}

when {
process {
"""
input[0] = MERYL_COUNT.out.meryl_db
input[1] = Channel.value(21)
"""
}
}

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

}

}
Loading

0 comments on commit b7f584e

Please sign in to comment.