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

Update genomescope2 module and add nf-tests #5399

Merged
merged 10 commits into from
Mar 26, 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
42 changes: 33 additions & 9 deletions modules/nf-core/genomescope2/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@ process GENOMESCOPE2 {

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/genomescope2:2.0--py310r41hdfd78af_5':
'biocontainers/genomescope2:2.0--py310r41hdfd78af_5' }"
'https://depot.galaxyproject.org/singularity/genomescope2:2.0--py311r42hdfd78af_6':
'biocontainers/genomescope2:2.0--py311r42hdfd78af_6' }"

input:
tuple val(meta), path(histogram)

output:
tuple val(meta), path("*_linear_plot.png") , emit: linear_plot_png
tuple val(meta), path("*_transformed_linear_plot.png"), emit: transformed_linear_plot_png
tuple val(meta), path("*_log_plot.png") , emit: log_plot_png
tuple val(meta), path("*_transformed_log_plot.png") , emit: transformed_log_plot_png
tuple val(meta), path("*_model.txt") , emit: model
tuple val(meta), path("*_summary.txt") , emit: summary
path "versions.yml" , emit: versions
tuple val(meta), path("${prefix}_linear_plot.png") , emit: linear_plot_png
tuple val(meta), path("${prefix}_transformed_linear_plot.png"), emit: transformed_linear_plot_png
tuple val(meta), path("${prefix}_log_plot.png") , emit: log_plot_png
tuple val(meta), path("${prefix}_transformed_log_plot.png") , emit: transformed_log_plot_png
tuple val(meta), path("${prefix}_model.txt") , emit: model
tuple val(meta), path("${prefix}_summary.txt") , emit: summary
tuple val(meta), path("${prefix}_lookup_table.txt") , emit: lookup_table, optional: true
tuple val(meta), path("${prefix}_fitted_hist.png") , emit: fitted_histogram_png, optional: true
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -32,6 +34,28 @@ process GENOMESCOPE2 {
--output . \\
--name_prefix $prefix

test -f "fitted_hist.png" && mv fitted_hist.png ${prefix}_fitted_hist.png
test -f "lookup_table.txt" && mv lookup_table.txt ${prefix}_lookup_table.txt

cat <<-END_VERSIONS > versions.yml
'${task.process}':
genomescope2: \$( genomescope2 -v | sed 's/GenomeScope //' )
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}_linear_plot.png
touch ${prefix}_transformed_linear_plot.png
touch ${prefix}_log_plot.png
touch ${prefix}_transformed_log_plot.png
touch ${prefix}_model.txt
touch ${prefix}_summary.txt
touch ${prefix}_fitted_hist.png
touch ${prefix}_lookup_table.txt

cat <<-END_VERSIONS > versions.yml
'${task.process}':
genomescope2: \$( genomescope2 -v | sed 's/GenomeScope //' )
Expand Down
10 changes: 9 additions & 1 deletion modules/nf-core/genomescope2/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tools:
documentation: "https://github.com/tbenavi1/genomescope2.0/blob/master/README.md"
tool_dev_url: "https://github.com/tbenavi1/genomescope2.0"
doi: "10.1038/s41467-020-14998-3"
licence: "['Apache License, Version 2.0 (Apache-2.0)']"
licence: ["Apache-2.0"]
input:
- meta:
type: map
Expand Down Expand Up @@ -60,6 +60,14 @@ output:
type: file
description: Genomescope2 histogram summary
pattern: "*_summary.txt"
- lookup_table:
type: file
description: Fitted histogram lookup table
pattern: "*_lookup_table.txt"
- fitted_histogram_png:
type: file
description: A genomescope2 fitted histogram plot in PNG format
pattern: "*_fitted_hist.png"
authors:
- "@mahesh-panchal"
maintainers:
Expand Down
84 changes: 84 additions & 0 deletions modules/nf-core/genomescope2/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
nextflow_process {

name "Test Process GENOMESCOPE2"
script "../main.nf"
config "./nextflow.config"
process "GENOMESCOPE2"

tag "modules"
tag "modules_nfcore"
tag "genomescope2"
tag "meryl/count"
tag "meryl/histogram"

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/prokaryotes/bacteroides_fragilis/illumina/fastq/test1_1.fastq.gz", checkIfExists: true )
])
"""
}
}
run('MERYL_HISTOGRAM'){
script "../../../../modules/nf-core/meryl/histogram/main.nf"
process {
"""
input[0] = MERYL_COUNT.out.meryl_db
"""
}
}
}

test("bacteroides_fragilis - fastq") {

when {
process {
"""
input[0] = MERYL_HISTOGRAM.out.hist
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert file(process.out.linear_plot_png[0][1]).exists() }, // PNG md5sum mismatches using conda
{ assert file(process.out.transformed_linear_plot_png[0][1]).exists() }, // PNG md5sum mismatches using conda
{ assert file(process.out.log_plot_png[0][1]).exists() }, // PNG md5sum mismatches using conda
{ assert file(process.out.transformed_log_plot_png[0][1]).exists() }, // PNG md5sum mismatches using conda
{ assert snapshot(process.out.model).match("model") },
{ assert snapshot(process.out.summary).match("summary") },
{ assert snapshot(process.out.lookup_table).match("lookup_table") },
{ assert file(process.out.fitted_histogram_png[0][1]).exists() }, // PNG md5sum mismatches using conda
{ assert snapshot(process.out.versions).match("versions") }
)
}

}

test("bacteroides_fragilis - fastq - stub") {

options "-stub"

when {
process {
"""
input[0] = MERYL_HISTOGRAM.out.hist
"""
}
}

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

}

}
Loading
Loading