diff --git a/modules/nf-core/genomescope2/main.nf b/modules/nf-core/genomescope2/main.nf index d0bca0822c9..2aed1a70aaf 100644 --- a/modules/nf-core/genomescope2/main.nf +++ b/modules/nf-core/genomescope2/main.nf @@ -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 @@ -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 //' ) diff --git a/modules/nf-core/genomescope2/meta.yml b/modules/nf-core/genomescope2/meta.yml index 2c1d5158dd7..928bb812d0c 100644 --- a/modules/nf-core/genomescope2/meta.yml +++ b/modules/nf-core/genomescope2/meta.yml @@ -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 @@ -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: diff --git a/modules/nf-core/genomescope2/tests/main.nf.test b/modules/nf-core/genomescope2/tests/main.nf.test new file mode 100644 index 00000000000..677e4262a8a --- /dev/null +++ b/modules/nf-core/genomescope2/tests/main.nf.test @@ -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() } + ) + } + + } + +} diff --git a/modules/nf-core/genomescope2/tests/main.nf.test.snap b/modules/nf-core/genomescope2/tests/main.nf.test.snap new file mode 100644 index 00000000000..4d0800fd6ff --- /dev/null +++ b/modules/nf-core/genomescope2/tests/main.nf.test.snap @@ -0,0 +1,229 @@ +{ + "summary": { + "content": [ + [ + [ + { + "id": "test", + "single_end": true + }, + "test_summary.txt:md5,7452860e2cea99b85f3ff60daeac77f5" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-26T16:43:15.407365039" + }, + "lookup_table": { + "content": [ + [ + [ + { + "id": "test", + "single_end": true + }, + "test_lookup_table.txt:md5,0eb174756f1f662055e1becf9b1080be" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-26T16:43:15.413781389" + }, + "versions": { + "content": [ + [ + "versions.yml:md5,d9a07fd689e0386675370db0995227c3" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-26T16:43:15.422588239" + }, + "bacteroides_fragilis - fastq - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test_linear_plot.png:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": true + }, + "test_transformed_linear_plot.png:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": true + }, + "test_log_plot.png:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": true + }, + "test_transformed_log_plot.png:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + [ + { + "id": "test", + "single_end": true + }, + "test_model.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "5": [ + [ + { + "id": "test", + "single_end": true + }, + "test_summary.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "6": [ + [ + { + "id": "test", + "single_end": true + }, + "test_lookup_table.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "7": [ + [ + { + "id": "test", + "single_end": true + }, + "test_fitted_hist.png:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "8": [ + "versions.yml:md5,d9a07fd689e0386675370db0995227c3" + ], + "fitted_histogram_png": [ + [ + { + "id": "test", + "single_end": true + }, + "test_fitted_hist.png:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "linear_plot_png": [ + [ + { + "id": "test", + "single_end": true + }, + "test_linear_plot.png:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "log_plot_png": [ + [ + { + "id": "test", + "single_end": true + }, + "test_log_plot.png:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "lookup_table": [ + [ + { + "id": "test", + "single_end": true + }, + "test_lookup_table.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "model": [ + [ + { + "id": "test", + "single_end": true + }, + "test_model.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "summary": [ + [ + { + "id": "test", + "single_end": true + }, + "test_summary.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "transformed_linear_plot_png": [ + [ + { + "id": "test", + "single_end": true + }, + "test_transformed_linear_plot.png:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "transformed_log_plot_png": [ + [ + { + "id": "test", + "single_end": true + }, + "test_transformed_log_plot.png:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,d9a07fd689e0386675370db0995227c3" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-26T16:43:32.293155073" + }, + "model": { + "content": [ + [ + [ + { + "id": "test", + "single_end": true + }, + "test_model.txt:md5,3caf62f715f64a2f2b8fdff5d079cb84" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-26T16:43:15.39496668" + } +} \ No newline at end of file diff --git a/modules/nf-core/genomescope2/tests/nextflow.config b/modules/nf-core/genomescope2/tests/nextflow.config new file mode 100644 index 00000000000..33340158d60 --- /dev/null +++ b/modules/nf-core/genomescope2/tests/nextflow.config @@ -0,0 +1,8 @@ +process { + withName: 'MERYL.*' { + ext.args = 'k=21' + } + withName: 'GENOMESCOPE2' { + ext.args = '-k 21 -p 1 --fitted_hist' + } +} diff --git a/modules/nf-core/genomescope2/tests/tags.yml b/modules/nf-core/genomescope2/tests/tags.yml new file mode 100644 index 00000000000..f729bb23b3f --- /dev/null +++ b/modules/nf-core/genomescope2/tests/tags.yml @@ -0,0 +1,2 @@ +genomescope2: + - "modules/nf-core/genomescope2/**" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 7c982ed077f..a539e80802b 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -814,9 +814,6 @@ genmap/index: genmap/map: - modules/nf-core/genmap/map/** - tests/modules/nf-core/genmap/map/** -genomescope2: - - modules/nf-core/genomescope2/** - - tests/modules/nf-core/genomescope2/** genotyphi/parse: - modules/nf-core/genotyphi/parse/** - tests/modules/nf-core/genotyphi/parse/** diff --git a/tests/modules/nf-core/genomescope2/main.nf b/tests/modules/nf-core/genomescope2/main.nf deleted file mode 100644 index 1cb7c1b2229..00000000000 --- a/tests/modules/nf-core/genomescope2/main.nf +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { MERYL_COUNT } from '../../../../modules/nf-core/meryl/count/main.nf' -include { MERYL_HISTOGRAM } from '../../../../modules/nf-core/meryl/histogram/main.nf' -include { GENOMESCOPE2 } from '../../../../modules/nf-core/genomescope2/main.nf' - -workflow test_genomescope2 { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['bacteroides_fragilis']['illumina']['test1_1_fastq_gz'], checkIfExists: true) - ] - - MERYL_COUNT ( input ) - MERYL_HISTOGRAM ( MERYL_COUNT.out.meryl_db ) - GENOMESCOPE2 ( MERYL_HISTOGRAM.out.hist ) -} diff --git a/tests/modules/nf-core/genomescope2/nextflow.config b/tests/modules/nf-core/genomescope2/nextflow.config deleted file mode 100644 index 29a0be3a5a5..00000000000 --- a/tests/modules/nf-core/genomescope2/nextflow.config +++ /dev/null @@ -1,13 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: 'MERYL.*' { - ext.args = 'k=21' - } - - withName: 'GENOMESCOPE2' { - ext.args = '-k 21 -p 1' - } - -} diff --git a/tests/modules/nf-core/genomescope2/test.yml b/tests/modules/nf-core/genomescope2/test.yml deleted file mode 100644 index cb6a1fb6fcc..00000000000 --- a/tests/modules/nf-core/genomescope2/test.yml +++ /dev/null @@ -1,22 +0,0 @@ -- name: genomescope2 test_genomescope2 - command: nextflow run ./tests/modules/nf-core/genomescope2 -entry test_genomescope2 -c ./tests/config/nextflow.config - tags: - - genomescope2 - files: - - path: output/genomescope2/test_linear_plot.png - md5sum: 94c165c5028156299a1d4d05766cac51 - - path: output/genomescope2/test_log_plot.png - md5sum: 9d25ca463d92a0c73a893da7fd3979ba - - path: output/genomescope2/test_model.txt - md5sum: 3caf62f715f64a2f2b8fdff5d079cb84 - - path: output/genomescope2/test_summary.txt - md5sum: 7452860e2cea99b85f3ff60daeac77f5 - - path: output/genomescope2/test_transformed_linear_plot.png - md5sum: 99a64c1c18d8670f64cb863d4334abbb - - path: output/genomescope2/test_transformed_log_plot.png - md5sum: b4e029c9fb9987ca33b17392a691c1b4 - - path: output/genomescope2/versions.yml - md5sum: 18afeb26f62a47f680b2bb3e27da9cbc - - path: output/meryl/test.hist - md5sum: f75362ab9cd70d96621b3690e952085f - - path: output/meryl/versions.yml