diff --git a/modules/nf-core/methurator/gtestimator/environment.yml b/modules/nf-core/methurator/gtestimator/environment.yml new file mode 100644 index 000000000000..942a9948cb6d --- /dev/null +++ b/modules/nf-core/methurator/gtestimator/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - "bioconda::methurator=2.1.1" diff --git a/modules/nf-core/methurator/gtestimator/main.nf b/modules/nf-core/methurator/gtestimator/main.nf new file mode 100755 index 000000000000..43a27f61bb8d --- /dev/null +++ b/modules/nf-core/methurator/gtestimator/main.nf @@ -0,0 +1,40 @@ +process METHURATOR_GTESTIMATOR { + tag "${meta.id}" + label 'process_medium' + + conda "${moduleDir}/environment.yml" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/methurator:2.1.1--pyhdfd78af_0' + : 'quay.io/biocontainers/methurator:2.1.1--pyhdfd78af_0'}" + + input: + tuple val(meta), path(bam), path(bai), path(fasta) + + output: + tuple val(meta), path("${prefix}.yml"), emit: summary_report + tuple val("${task.process}"), val('methurator'), eval("methurator --version | sed 's/.* //'"), emit: versions_methurator, topic: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + """ + methurator gt-estimator \\ + ${bam} \\ + --fasta ${fasta} \\ + -@ ${task.cpus} \\ + --outdir . \\ + ${args} + + mv methurator_summary.yml ${prefix}.yml + """ + + stub: + prefix = task.ext.prefix?: "${meta.id}" + """ + touch ${prefix}.yml + + """ +} diff --git a/modules/nf-core/methurator/gtestimator/meta.yml b/modules/nf-core/methurator/gtestimator/meta.yml new file mode 100755 index 000000000000..f498d1a582b7 --- /dev/null +++ b/modules/nf-core/methurator/gtestimator/meta.yml @@ -0,0 +1,84 @@ +name: methurator_gtestimator +description: | + Run estimator for DNA methylation sequencing saturation. +keywords: + - rrbs + - BS-seq + - methylation + - 5mC + - methylseq + - bisulphite + - bam +tools: + - methurator: + description: | + Methurator is a Python package designed to estimate CpGs saturation + for DNA methylation sequencing data. + homepage: https://github.com/VIBTOBIlab/methurator + documentation: https://github.com/VIBTOBIlab/methurator/README.md + licence: + - "MIT" + identifier: "" +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - bam: + type: file + description: Single BAM file + pattern: "*.{bam,cram}" + ontologies: + - edam: "http://edamontology.org/format_2572" # BAM + - bai: + type: file + description: Single BAM/CRAM index file + pattern: "*.{bai,crai}" + ontologies: + - edam: "http://edamontology.org/format_3327" # BAM index + - fasta: + type: file + description: Input genome fasta file + pattern: "*.{fasta,fa}" + ontologies: + - edam: "http://edamontology.org/format_1332" # FASTA +output: + summary_report: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "${prefix}.yml": + type: file + description: | + YAML file summarizing the saturation analysis results. + pattern: "${prefix}.yml" + ontologies: + - edam: http://edamontology.org/format_3750 # YAML + versions_methurator: + - - ${task.process}: + type: string + description: methurator gtestimator + - methurator: + type: string + description: The name of the tool + - methurator --version | sed 's/.* //': + type: eval + description: The expression to obtain the version of the tool +topics: + versions: + - - ${task.process}: + type: string + description: methurator gtestimator + - methurator: + type: string + description: The name of the tool + - methurator --version | sed 's/.* //': + type: eval + description: The expression to obtain the version of the tool +authors: + - "@edogiuili" +maintainers: + - "@edogiuili" diff --git a/modules/nf-core/methurator/gtestimator/tests/main.nf.test b/modules/nf-core/methurator/gtestimator/tests/main.nf.test new file mode 100644 index 000000000000..de1cff6e2687 --- /dev/null +++ b/modules/nf-core/methurator/gtestimator/tests/main.nf.test @@ -0,0 +1,68 @@ +nextflow_process { + + name "Test Process METHURATOR_GTESTIMATOR" + script "../main.nf" + process "METHURATOR_GTESTIMATOR" + config './nextflow.config' + + tag "modules" + tag "modules_nfcore" + tag "methurator" + tag "methurator/gtestimator" + + test("Run methurator gt-estimator on paired-end methylated [bam] | sarscov2 genome [fasta]") { + + when { + params { + module_args = '--t-max 10 --minimum-coverage 1 --compute_ci' + } + + process { + """ + input[0] = [ [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam.bai', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + // Avoid first 3 lines of the summary report as they contain the date and time of the run + file(process.out.summary_report[0][1]).readLines()[3..10].join('\n').md5(), + process.out.findAll { key, val -> key.startsWith('versions') } + ).match()} + ) + } + } + test("Run methurator gt-estimator on paired-end methylated [bam] | sarscov2 genome [fasta] - stub") { + + options "-stub" + + when { + params { + module_args = '--t-max 10 --minimum-coverage 1 --compute_ci' + } + process { + """ + input[0] = [ [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam.bai', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(sanitizeOutput(process.out)).match() } + ) + } + } +} diff --git a/modules/nf-core/methurator/gtestimator/tests/main.nf.test.snap b/modules/nf-core/methurator/gtestimator/tests/main.nf.test.snap new file mode 100644 index 000000000000..6e5d5ab3639f --- /dev/null +++ b/modules/nf-core/methurator/gtestimator/tests/main.nf.test.snap @@ -0,0 +1,48 @@ +{ + "Run methurator gt-estimator on paired-end methylated [bam] | sarscov2 genome [fasta] - stub": { + "content": [ + { + "summary_report": [ + [ + { + "id": "test", + "single_end": false + }, + "test.yml:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions_methurator": [ + [ + "METHURATOR_GTESTIMATOR", + "methurator", + "2.1.1" + ] + ] + } + ], + "timestamp": "2026-04-07T22:41:16.975667", + "meta": { + "nf-test": "0.9.5", + "nextflow": "25.10.0" + } + }, + "Run methurator gt-estimator on paired-end methylated [bam] | sarscov2 genome [fasta]": { + "content": [ + "983d27e4d62f86d15a779820758af458", + { + "versions_methurator": [ + [ + "METHURATOR_GTESTIMATOR", + "methurator", + "2.1.1" + ] + ] + } + ], + "timestamp": "2026-04-07T14:33:27.127158", + "meta": { + "nf-test": "0.9.5", + "nextflow": "25.10.0" + } + } +} \ No newline at end of file diff --git a/modules/nf-core/methurator/gtestimator/tests/nextflow.config b/modules/nf-core/methurator/gtestimator/tests/nextflow.config new file mode 100644 index 000000000000..9cb31eb3a925 --- /dev/null +++ b/modules/nf-core/methurator/gtestimator/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: METHURATOR_GTESTIMATOR { + ext.args = params.module_args + } +} diff --git a/modules/nf-core/methurator/plot/environment.yml b/modules/nf-core/methurator/plot/environment.yml new file mode 100644 index 000000000000..942a9948cb6d --- /dev/null +++ b/modules/nf-core/methurator/plot/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - "bioconda::methurator=2.1.1" diff --git a/modules/nf-core/methurator/plot/main.nf b/modules/nf-core/methurator/plot/main.nf new file mode 100644 index 000000000000..a2a887620fff --- /dev/null +++ b/modules/nf-core/methurator/plot/main.nf @@ -0,0 +1,35 @@ +process METHURATOR_PLOT { + tag "${meta.id}" + label 'process_medium' + + conda "${moduleDir}/environment.yml" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/methurator:2.1.1--pyhdfd78af_0' + : 'quay.io/biocontainers/methurator:2.1.1--pyhdfd78af_0'}" + + input: + tuple val(meta), path(summary_report) + + output: + tuple val(meta), path("plots/*.html"), emit: plots + tuple val("${task.process}"), val('methurator'), eval("methurator --version | sed 's/.* //'"), emit: versions_methurator, topic: versions + + when: + task.ext.when == null || task.ext.when + + script: + """ + methurator plot \\ + --summary ${summary_report} \\ + --outdir . + + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + mkdir plots/ + touch plots/${prefix}.html + + """ +} diff --git a/modules/nf-core/methurator/plot/meta.yml b/modules/nf-core/methurator/plot/meta.yml new file mode 100644 index 000000000000..3811f0e84cdc --- /dev/null +++ b/modules/nf-core/methurator/plot/meta.yml @@ -0,0 +1,73 @@ +name: methurator_plot +description: Plots results produced by methurator gtestimator. +keywords: + - rrbs + - BS-seq + - methylation + - 5mC + - methylseq + - bisulphite + - bisulfite + - bam +tools: + - methurator: + description: | + methurator is a Python package designed to estimate sequencing saturation + for DNA methylation sequencing data. + homepage: https://github.com/VIBTOBIlab/methurator + documentation: https://github.com/VIBTOBIlab/methurator/README.md + licence: + - "MIT" + identifier: "" +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - summary_report: + type: file + description: | + YAML file summarizing the saturation analysis results. + pattern: "methurator_*.yml" + ontologies: + - edam: http://edamontology.org/format_3750 # YAML +output: + plots: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - plots/*.html: + type: file + description: | + HTML plots generated from the saturation analysis. + pattern: "plots/*.html" + ontologies: + - edam: "http://edamontology.org/format_2331" # HTML + versions_methurator: + - - ${task.process}: + type: string + description: methurator plot + - methurator: + type: string + description: The name of the tool + - methurator --version | sed 's/.* //': + type: eval + description: The expression to obtain the version of the tool +topics: + versions: + - - ${task.process}: + type: string + description: methurator plot + - methurator: + type: string + description: The name of the tool + - methurator --version | sed 's/.* //': + type: eval + description: The expression to obtain the version of the tool +authors: + - "@edogiuili" +maintainers: + - "@edogiuili" diff --git a/modules/nf-core/methurator/plot/tests/main.nf.test b/modules/nf-core/methurator/plot/tests/main.nf.test new file mode 100644 index 000000000000..acd4043937f1 --- /dev/null +++ b/modules/nf-core/methurator/plot/tests/main.nf.test @@ -0,0 +1,73 @@ +nextflow_process { + + name "Test Process METHURATOR_PLOT" + script "../main.nf" + process "METHURATOR_PLOT" + + tag "modules" + tag "modules_nfcore" + tag "methurator" + tag "methurator/plot" + tag "methurator/gtestimator" + + setup { + run("METHURATOR_GTESTIMATOR") { + script "../../gtestimator/main.nf" + params { + t_max = 10 + minimum_coverage = 1 + rrbs = false + } + process { + """ + input[0] = [ [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam.bai', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + """ + } + } + } + + test("Run methurator plot on the output of methurator gt-estimator") { + + when { + process { + """ + input[0] = METHURATOR_GTESTIMATOR.out.summary_report + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.plots.collect { it.collect { it instanceof Map ? it : file(it).name } }, + process.out.findAll { key, val -> key.startsWith('versions') }).match() + } + ) + } + } + + test("Run methurator plot on the output of methurator gt-estimator - stub") { + + options "-stub" + + when { + process { + """ + input[0] = METHURATOR_GTESTIMATOR.out.summary_report + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(sanitizeOutput(process.out)).match() } + ) + } + } +} diff --git a/modules/nf-core/methurator/plot/tests/main.nf.test.snap b/modules/nf-core/methurator/plot/tests/main.nf.test.snap new file mode 100644 index 000000000000..a52140b74c25 --- /dev/null +++ b/modules/nf-core/methurator/plot/tests/main.nf.test.snap @@ -0,0 +1,56 @@ +{ + "Run methurator plot on the output of methurator gt-estimator": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test.paired_end.methylated.sorted_CpG.bedGraph_1x_plot.html" + ] + ], + { + "versions_methurator": [ + [ + "METHURATOR_PLOT", + "methurator", + "2.1.1" + ] + ] + } + ], + "timestamp": "2026-04-07T22:44:11.302149", + "meta": { + "nf-test": "0.9.5", + "nextflow": "25.10.0" + } + }, + "Run methurator plot on the output of methurator gt-estimator - stub": { + "content": [ + { + "plots": [ + [ + { + "id": "test", + "single_end": false + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions_methurator": [ + [ + "METHURATOR_PLOT", + "methurator", + "2.1.1" + ] + ] + } + ], + "timestamp": "2026-04-07T22:44:22.201627", + "meta": { + "nf-test": "0.9.5", + "nextflow": "25.10.0" + } + } +} \ No newline at end of file