Skip to content

Commit

Permalink
Meryl count and meryl histogram migration to nf-test (#5401)
Browse files Browse the repository at this point in the history
* migrate to nf-test and update version

* Add stub

Co-authored-by: rodtheo <[email protected]>

* Fix linting

Co-authored-by: rodtheo <[email protected]>

* Update test

* Add kvalue as mandatory input

* Add snapshot

* Lint

* Update GenomeScope2 module to reflect new mandatory parameter

* migrate meryl/histogram to nf-test

* Add mandatory kvalue to input

* Lint

Co-authored-by: rodtheo <[email protected]>

* Add stub

Co-authored-by: rodtheo <[email protected]>

* Update test for meryl/histogram

* Update meryl version

* Remove meryl/histogram config and add input value
to genomescope2

* Fix module path

---------

Co-authored-by: rodtheo <[email protected]>
  • Loading branch information
mahesh-panchal and rodtheo authored Mar 27, 2024
1 parent 9bc4822 commit c95215b
Show file tree
Hide file tree
Showing 21 changed files with 586 additions and 101 deletions.
2 changes: 2 additions & 0 deletions modules/nf-core/genomescope2/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ nextflow_process {
[ id: 'test', single_end: true ], // meta map
file( params.modules_testdata_base_path + "/genomics/prokaryotes/bacteroides_fragilis/illumina/fastq/test1_1.fastq.gz", checkIfExists: true )
])
input[1] = Channel.value(21)
"""
}
}
Expand All @@ -28,6 +29,7 @@ nextflow_process {
process {
"""
input[0] = MERYL_COUNT.out.meryl_db
input[1] = Channel.value(21)
"""
}
}
Expand Down
3 changes: 0 additions & 3 deletions modules/nf-core/genomescope2/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
process {
withName: 'MERYL.*' {
ext.args = 'k=21'
}
withName: 'GENOMESCOPE2' {
ext.args = '-k 21 -p 1 --fitted_hist'
}
Expand Down
2 changes: 1 addition & 1 deletion modules/nf-core/meryl/count/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
20 changes: 18 additions & 2 deletions modules/nf-core/meryl/count/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ process MERYL_COUNT {

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(reads)
val kvalue

output:
tuple val(meta), path("*.meryldb"), emit: meryl_db
Expand All @@ -23,6 +24,7 @@ process MERYL_COUNT {
"""
for READ in $reads; do
meryl count \\
k=$kvalue \\
threads=$task.cpus \\
$args \\
$reads \\
Expand All @@ -34,4 +36,18 @@ process MERYL_COUNT {
meryl: \$( meryl --version |& sed 's/meryl //' )
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
for READ in $reads; do
touch read.\${READ%.f*}.meryldb
done
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/count/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
- count
- 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 @@ -21,6 +22,9 @@ input:
description: |
List of input FastQ files of size 1 and 2 for single-end and paired-end data,
respectively.
- kvalue:
type: integer
description: An integer value of k to use as the k-mer value.
output:
- meta:
type: map
Expand Down
60 changes: 60 additions & 0 deletions modules/nf-core/meryl/count/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
nextflow_process {

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

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

test("bacteroides_fragilis - fastq") {

when {
process {
"""
input[0] = Channel.value([
[ id: 'test', single_end: true ], // meta map
file( params.modules_testdata_base_path + "/genomics/prokaryotes/bacteroides_fragilis/illumina/fastq/test1_1.fastq.gz", checkIfExists: true )
])
input[1] = Channel.value(21)
"""
}
}

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

}

test("bacteroides_fragilis - fastq - stub") {

options "-stub"

when {
process {
"""
input[0] = Channel.value([
[ id: 'test', single_end: true ], // meta map
file( params.modules_testdata_base_path + "/genomics/prokaryotes/bacteroides_fragilis/illumina/fastq/test1_1.fastq.gz", checkIfExists: true )
])
input[1] = Channel.value(21)
"""
}
}

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

}

}
Loading

0 comments on commit c95215b

Please sign in to comment.