From 69a83253bae3ccf07fc5915123306dc4381ad4e9 Mon Sep 17 00:00:00 2001 From: inemesb Date: Wed, 29 Oct 2025 13:21:06 +0100 Subject: [PATCH 1/4] Add files --- .../alignedbamtocpgscores/environment.yml | 7 + .../pbcpgtools/alignedbamtocpgscores/main.nf | 64 +++++++++ .../pbcpgtools/alignedbamtocpgscores/meta.yml | 78 +++++++++++ .../alignedbamtocpgscores/tests/main.nf.test | 65 +++++++++ .../tests/main.nf.test.snap | 132 ++++++++++++++++++ 5 files changed, 346 insertions(+) create mode 100644 modules/nf-core/pbcpgtools/alignedbamtocpgscores/environment.yml create mode 100644 modules/nf-core/pbcpgtools/alignedbamtocpgscores/main.nf create mode 100644 modules/nf-core/pbcpgtools/alignedbamtocpgscores/meta.yml create mode 100644 modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test create mode 100644 modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test.snap diff --git a/modules/nf-core/pbcpgtools/alignedbamtocpgscores/environment.yml b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/environment.yml new file mode 100644 index 00000000000..21ff53b2f00 --- /dev/null +++ b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/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::pb-cpg-tools=3.0.0" diff --git a/modules/nf-core/pbcpgtools/alignedbamtocpgscores/main.nf b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/main.nf new file mode 100644 index 00000000000..3c60a52dd6d --- /dev/null +++ b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/main.nf @@ -0,0 +1,64 @@ +// TODO nf-core: If in doubt look at other nf-core/modules to see how we are doing things! :) +// https://github.com/nf-core/modules/tree/master/modules/nf-core/ +// You can also ask for help via your pull request or on the #modules channel on the nf-core Slack workspace: +// https://nf-co.re/join +// TODO nf-core: A module file SHOULD only define input and output files as command-line parameters. +// All other parameters MUST be provided using the "task.ext" directive, see here: +// https://www.nextflow.io/docs/latest/process.html#ext +// where "task.ext" is a string. +// Any parameters that need to be evaluated in the context of a particular sample +// e.g. single-end/paired-end data MUST also be defined and evaluated appropriately. + +process PBCPGTOOLS_ALIGNEDBAMTOCPGSCORES { + 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/pb-cpg-tools:3.0.0--h9ee0642_0': + 'biocontainers/pb-cpg-tools:3.0.0--h9ee0642_0' }" + + input: + tuple val(meta), path(bam), path(bai) + + output: + tuple val(meta), path("*.bed.gz"), emit: bed + tuple val(meta), path("*.bed.gz.tbi"), emit: bed_index + tuple val(meta), path("*.bw"), emit: bigwig + path "versions.yml", emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + """ + aligned_bam_to_cpg_scores \\ + --bam ${bam} \\ + --output-prefix ${prefix} \\ + --threads ${task.cpus} \\ + ${args} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + pbcpgtools: \$(aligned_bam_to_cpg_scores --version) + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + + """ + + echo "" | gzip > ${prefix}.combined.bed.gz + touch ${prefix}.combined.bed.gz.tbi + touch ${prefix}.combined.bw + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + pbcpgtools: \$(aligned_bam_to_cpg_scores --version) + END_VERSIONS + """ +} diff --git a/modules/nf-core/pbcpgtools/alignedbamtocpgscores/meta.yml b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/meta.yml new file mode 100644 index 00000000000..f3f0dc7d687 --- /dev/null +++ b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/meta.yml @@ -0,0 +1,78 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "pbcpgtools_alignedbamtocpgscores" +description: Converts aligned BAM files into CpG methylation scores using pb-cpg-tools. +keywords: + - methylation + - cpg + - pacbio +tools: + - "pbcpgtools": + description: "Collection of tools for the analysis of CpG data" + homepage: "https://github.com/PacificBiosciences/pb-CpG-tools" + documentation: "https://github.com/PacificBiosciences/pb-CpG-tools#readme" + tool_dev_url: "https://github.com/PacificBiosciences/pb-CpG-tools" + licence: ["Pacific Biosciences Software License Agreement"] + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - bam: + type: file + description: BAM/CRAM file + pattern: "*.{bam,cram}" + ontologies: [] + - bai: + type: file + description: Index of BAM/CRAM file + pattern: "*.{bai,crai,csi}" + ontologies: [] + +output: + ### TODO nf-core: Add a description of all of the variables used as output + bed: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "*.bed.gz": + type: file + description: Zipped BED file with CpG methylation scores + pattern: "*.{bed.gz}" + ontologies: [] + bed_index: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "*.bed.gz.tbi": + type: file + description: Index of zipped BED file + pattern: "*.{.bed.gz.tbi}" + ontologies: [] + bigwig: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "*.bw": + type: file + description: Bigwig file for visualization in IGV + pattern: "*.{bw}" + ontologies: [] + versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: [] + +authors: + - "@inemesb" +maintainers: + - "@inemesb" diff --git a/modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test new file mode 100644 index 00000000000..0c437811b2b --- /dev/null +++ b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test @@ -0,0 +1,65 @@ +nextflow_process { + + name "Test Process PBCPGTOOLS_ALIGNEDBAMTOCPGSCORES" + script "../main.nf" + process "PBCPGTOOLS_ALIGNEDBAMTOCPGSCORES" + + tag "modules" + tag "modules_nfcore" + tag "pbcpgtools" + tag "pbcpgtools/alignedbamtocpgscores" + + test("nanopore - bam - notphased") { + + when { + process { + """ + // TODO nf-core: define inputs of the process here. Example: + + input[0] = [ + [ id:'test'], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA037562_downsampled.pbmm2.repeats.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA037562_downsampled.pbmm2.repeats.bam.bai', checkIfExists: true) + + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("nanopore - bam - notphased - stub") { + + options "-stub" + + when { + process { + """ + // TODO nf-core: define inputs of the process here. Example: + + input[0] = [ + [ id:'test'], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA037562_downsampled.pbmm2.repeats.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA037562_downsampled.pbmm2.repeats.bam.bai', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test.snap b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test.snap new file mode 100644 index 00000000000..c9499d74584 --- /dev/null +++ b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test.snap @@ -0,0 +1,132 @@ +{ + "nanopore - bam - notphased": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.combined.bed.gz:md5,bacdb71f8eec683930c6103f020277cd" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.combined.bed.gz.tbi:md5,9ca5efde7981fec4e6a79b0b08999186" + ] + ], + "2": [ + [ + { + "id": "test" + }, + "test.combined.bw:md5,77a572a00645df6743459805bd397cb9" + ] + ], + "3": [ + "versions.yml:md5,8321e8b769578dda2f05f2b1d833bc80" + ], + "bed": [ + [ + { + "id": "test" + }, + "test.combined.bed.gz:md5,bacdb71f8eec683930c6103f020277cd" + ] + ], + "bed_index": [ + [ + { + "id": "test" + }, + "test.combined.bed.gz.tbi:md5,9ca5efde7981fec4e6a79b0b08999186" + ] + ], + "bigwig": [ + [ + { + "id": "test" + }, + "test.combined.bw:md5,77a572a00645df6743459805bd397cb9" + ] + ], + "versions": [ + "versions.yml:md5,8321e8b769578dda2f05f2b1d833bc80" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.7" + }, + "timestamp": "2025-10-29T11:03:27.20552685" + }, + "nanopore - bam - notphased - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.combined.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.combined.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test" + }, + "test.combined.bw:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + "versions.yml:md5,8321e8b769578dda2f05f2b1d833bc80" + ], + "bed": [ + [ + { + "id": "test" + }, + "test.combined.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "bed_index": [ + [ + { + "id": "test" + }, + "test.combined.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "bigwig": [ + [ + { + "id": "test" + }, + "test.combined.bw:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,8321e8b769578dda2f05f2b1d833bc80" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.7" + }, + "timestamp": "2025-10-29T11:03:31.429890506" + } +} \ No newline at end of file From d890cea53d7c192fb7954ec1e7ca7acbab8aa9b5 Mon Sep 17 00:00:00 2001 From: inemesb Date: Fri, 31 Oct 2025 10:06:07 +0100 Subject: [PATCH 2/4] Update test paths --- .../alignedbamtocpgscores/tests/main.nf.test | 35 ++++- .../tests/main.nf.test.snap | 133 ++++++++++++++++-- 2 files changed, 152 insertions(+), 16 deletions(-) diff --git a/modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test index 0c437811b2b..48a17fdcfd2 100644 --- a/modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test +++ b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test @@ -9,12 +9,11 @@ nextflow_process { tag "pbcpgtools" tag "pbcpgtools/alignedbamtocpgscores" - test("nanopore - bam - notphased") { + test("pacbio - bam - notphased") { when { process { """ - // TODO nf-core: define inputs of the process here. Example: input[0] = [ [ id:'test'], // meta map @@ -35,19 +34,43 @@ nextflow_process { } - test("nanopore - bam - notphased - stub") { + test("pacbio - bam - phased") { + + when { + process { + """ + + input[0] = [ + [ id:'test'], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA037562_downsampled.pbmm2.repeats.phased.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA037562_downsampled.pbmm2.repeats.phased.bam.bai', checkIfExists: true) + + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("pacbio - bam - phased - stub") { options "-stub" when { process { """ - // TODO nf-core: define inputs of the process here. Example: input[0] = [ [ id:'test'], // meta map - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA037562_downsampled.pbmm2.repeats.bam', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA037562_downsampled.pbmm2.repeats.bam.bai', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA037562_downsampled.pbmm2.repeats.phased.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA037562_downsampled.pbmm2.repeats.phased.bam.bai', checkIfExists: true) ] """ } diff --git a/modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test.snap b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test.snap index c9499d74584..d1d5400fe21 100644 --- a/modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test.snap +++ b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test.snap @@ -1,5 +1,5 @@ { - "nanopore - bam - notphased": { + "pacbio - bam - notphased": { "content": [ { "0": [ @@ -62,9 +62,9 @@ "nf-test": "0.9.2", "nextflow": "25.04.7" }, - "timestamp": "2025-10-29T11:03:27.20552685" + "timestamp": "2025-10-30T11:20:04.273642798" }, - "nanopore - bam - notphased - stub": { + "pacbio - bam - phased": { "content": [ { "0": [ @@ -72,7 +72,11 @@ { "id": "test" }, - "test.combined.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + [ + "test.combined.bed.gz:md5,861084b58d048a2a957a86068ec39bcf", + "test.hap1.bed.gz:md5,db37b440b02203f38c0d7c20b3dd62f3", + "test.hap2.bed.gz:md5,b5b7a4539d3906bd938010644b779196" + ] ] ], "1": [ @@ -80,7 +84,11 @@ { "id": "test" }, - "test.combined.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + [ + "test.combined.bed.gz.tbi:md5,4325f78aeb593d00de8b56cffbc77712", + "test.hap1.bed.gz.tbi:md5,b9813e40b7d3365fb312ad35ac117bab", + "test.hap2.bed.gz.tbi:md5,0213f587a323929cd2180862b01e8044" + ] ] ], "2": [ @@ -88,7 +96,11 @@ { "id": "test" }, - "test.combined.bw:md5,d41d8cd98f00b204e9800998ecf8427e" + [ + "test.combined.bw:md5,77a572a00645df6743459805bd397cb9", + "test.hap1.bw:md5,df389b5415312c1da05a762177f7b50e", + "test.hap2.bw:md5,b87e364ef8cf80790ddef4963fa5e55c" + ] ] ], "3": [ @@ -99,7 +111,11 @@ { "id": "test" }, - "test.combined.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + [ + "test.combined.bed.gz:md5,861084b58d048a2a957a86068ec39bcf", + "test.hap1.bed.gz:md5,db37b440b02203f38c0d7c20b3dd62f3", + "test.hap2.bed.gz:md5,b5b7a4539d3906bd938010644b779196" + ] ] ], "bed_index": [ @@ -107,7 +123,11 @@ { "id": "test" }, - "test.combined.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + [ + "test.combined.bed.gz.tbi:md5,4325f78aeb593d00de8b56cffbc77712", + "test.hap1.bed.gz.tbi:md5,b9813e40b7d3365fb312ad35ac117bab", + "test.hap2.bed.gz.tbi:md5,0213f587a323929cd2180862b01e8044" + ] ] ], "bigwig": [ @@ -115,7 +135,11 @@ { "id": "test" }, - "test.combined.bw:md5,d41d8cd98f00b204e9800998ecf8427e" + [ + "test.combined.bw:md5,77a572a00645df6743459805bd397cb9", + "test.hap1.bw:md5,df389b5415312c1da05a762177f7b50e", + "test.hap2.bw:md5,b87e364ef8cf80790ddef4963fa5e55c" + ] ] ], "versions": [ @@ -127,6 +151,95 @@ "nf-test": "0.9.2", "nextflow": "25.04.7" }, - "timestamp": "2025-10-29T11:03:31.429890506" + "timestamp": "2025-10-30T16:39:34.804751846" + }, + "pacbio - bam - phased - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + [ + "test.combined.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test.hap1.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test.hap2.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "1": [ + [ + { + "id": "test" + }, + [ + "test.combined.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e", + "test.hap1.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e", + "test.hap2.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "2": [ + [ + { + "id": "test" + }, + [ + "test.combined.bw:md5,d41d8cd98f00b204e9800998ecf8427e", + "test.hap1.bw:md5,d41d8cd98f00b204e9800998ecf8427e", + "test.hap2.bw:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "3": [ + "versions.yml:md5,8321e8b769578dda2f05f2b1d833bc80" + ], + "bed": [ + [ + { + "id": "test" + }, + [ + "test.combined.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test.hap1.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test.hap2.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "bed_index": [ + [ + { + "id": "test" + }, + [ + "test.combined.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e", + "test.hap1.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e", + "test.hap2.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "bigwig": [ + [ + { + "id": "test" + }, + [ + "test.combined.bw:md5,d41d8cd98f00b204e9800998ecf8427e", + "test.hap1.bw:md5,d41d8cd98f00b204e9800998ecf8427e", + "test.hap2.bw:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "versions": [ + "versions.yml:md5,8321e8b769578dda2f05f2b1d833bc80" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.7" + }, + "timestamp": "2025-10-31T09:45:02.484082977" } } \ No newline at end of file From 46a108fece876e24ad83a25aee3d7ff3f0d1e865 Mon Sep 17 00:00:00 2001 From: inemesb Date: Fri, 31 Oct 2025 10:28:05 +0100 Subject: [PATCH 3/4] Update versions.yml and stub --- .../pbcpgtools/alignedbamtocpgscores/main.nf | 23 ++++++++----------- .../pbcpgtools/alignedbamtocpgscores/meta.yml | 1 - .../tests/main.nf.test.snap | 18 +++++++-------- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/modules/nf-core/pbcpgtools/alignedbamtocpgscores/main.nf b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/main.nf index 3c60a52dd6d..bba19efad97 100644 --- a/modules/nf-core/pbcpgtools/alignedbamtocpgscores/main.nf +++ b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/main.nf @@ -1,14 +1,3 @@ -// TODO nf-core: If in doubt look at other nf-core/modules to see how we are doing things! :) -// https://github.com/nf-core/modules/tree/master/modules/nf-core/ -// You can also ask for help via your pull request or on the #modules channel on the nf-core Slack workspace: -// https://nf-co.re/join -// TODO nf-core: A module file SHOULD only define input and output files as command-line parameters. -// All other parameters MUST be provided using the "task.ext" directive, see here: -// https://www.nextflow.io/docs/latest/process.html#ext -// where "task.ext" is a string. -// Any parameters that need to be evaluated in the context of a particular sample -// e.g. single-end/paired-end data MUST also be defined and evaluated appropriately. - process PBCPGTOOLS_ALIGNEDBAMTOCPGSCORES { tag "$meta.id" label 'process_medium' @@ -43,7 +32,7 @@ process PBCPGTOOLS_ALIGNEDBAMTOCPGSCORES { cat <<-END_VERSIONS > versions.yml "${task.process}": - pbcpgtools: \$(aligned_bam_to_cpg_scores --version) + pbcpgtools: \$(aligned_bam_to_cpg_scores --version | sed 's/aligned_bam_to_cpg_scores //') END_VERSIONS """ @@ -56,9 +45,17 @@ process PBCPGTOOLS_ALIGNEDBAMTOCPGSCORES { touch ${prefix}.combined.bed.gz.tbi touch ${prefix}.combined.bw + echo "" | gzip > ${prefix}.hap1.bed.gz + touch ${prefix}.hap1.bed.gz.tbi + touch ${prefix}.hap1.bw + + echo "" | gzip > ${prefix}.hap2.bed.gz + touch ${prefix}.hap2.bed.gz.tbi + touch ${prefix}.hap2.bw + cat <<-END_VERSIONS > versions.yml "${task.process}": - pbcpgtools: \$(aligned_bam_to_cpg_scores --version) + pbcpgtools: \$(aligned_bam_to_cpg_scores --version | sed 's/aligned_bam_to_cpg_scores //') END_VERSIONS """ } diff --git a/modules/nf-core/pbcpgtools/alignedbamtocpgscores/meta.yml b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/meta.yml index f3f0dc7d687..38a67841742 100644 --- a/modules/nf-core/pbcpgtools/alignedbamtocpgscores/meta.yml +++ b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/meta.yml @@ -31,7 +31,6 @@ input: ontologies: [] output: - ### TODO nf-core: Add a description of all of the variables used as output bed: - - meta: type: map diff --git a/modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test.snap b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test.snap index d1d5400fe21..70fd97e5a76 100644 --- a/modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test.snap +++ b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test.snap @@ -27,7 +27,7 @@ ] ], "3": [ - "versions.yml:md5,8321e8b769578dda2f05f2b1d833bc80" + "versions.yml:md5,e77c5038eded0c8fe9de5af6f9de783b" ], "bed": [ [ @@ -54,7 +54,7 @@ ] ], "versions": [ - "versions.yml:md5,8321e8b769578dda2f05f2b1d833bc80" + "versions.yml:md5,e77c5038eded0c8fe9de5af6f9de783b" ] } ], @@ -62,7 +62,7 @@ "nf-test": "0.9.2", "nextflow": "25.04.7" }, - "timestamp": "2025-10-30T11:20:04.273642798" + "timestamp": "2025-10-31T10:15:31.999302716" }, "pacbio - bam - phased": { "content": [ @@ -104,7 +104,7 @@ ] ], "3": [ - "versions.yml:md5,8321e8b769578dda2f05f2b1d833bc80" + "versions.yml:md5,e77c5038eded0c8fe9de5af6f9de783b" ], "bed": [ [ @@ -143,7 +143,7 @@ ] ], "versions": [ - "versions.yml:md5,8321e8b769578dda2f05f2b1d833bc80" + "versions.yml:md5,e77c5038eded0c8fe9de5af6f9de783b" ] } ], @@ -151,7 +151,7 @@ "nf-test": "0.9.2", "nextflow": "25.04.7" }, - "timestamp": "2025-10-30T16:39:34.804751846" + "timestamp": "2025-10-31T10:15:35.516831346" }, "pacbio - bam - phased - stub": { "content": [ @@ -193,7 +193,7 @@ ] ], "3": [ - "versions.yml:md5,8321e8b769578dda2f05f2b1d833bc80" + "versions.yml:md5,e77c5038eded0c8fe9de5af6f9de783b" ], "bed": [ [ @@ -232,7 +232,7 @@ ] ], "versions": [ - "versions.yml:md5,8321e8b769578dda2f05f2b1d833bc80" + "versions.yml:md5,e77c5038eded0c8fe9de5af6f9de783b" ] } ], @@ -240,6 +240,6 @@ "nf-test": "0.9.2", "nextflow": "25.04.7" }, - "timestamp": "2025-10-31T09:45:02.484082977" + "timestamp": "2025-10-31T10:15:38.750126786" } } \ No newline at end of file From 5138a9a64625c03c3bf1dc68da4965bec255ce98 Mon Sep 17 00:00:00 2001 From: inemesb Date: Mon, 3 Nov 2025 14:12:28 +0100 Subject: [PATCH 4/4] Add more optional output channels --- .../pbcpgtools/alignedbamtocpgscores/main.nf | 21 +- .../pbcpgtools/alignedbamtocpgscores/meta.yml | 109 ++++-- .../tests/main.nf.test.snap | 324 ++++++++++++++---- 3 files changed, 351 insertions(+), 103 deletions(-) diff --git a/modules/nf-core/pbcpgtools/alignedbamtocpgscores/main.nf b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/main.nf index bba19efad97..c0706163ecf 100644 --- a/modules/nf-core/pbcpgtools/alignedbamtocpgscores/main.nf +++ b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/main.nf @@ -11,10 +11,16 @@ process PBCPGTOOLS_ALIGNEDBAMTOCPGSCORES { tuple val(meta), path(bam), path(bai) output: - tuple val(meta), path("*.bed.gz"), emit: bed - tuple val(meta), path("*.bed.gz.tbi"), emit: bed_index - tuple val(meta), path("*.bw"), emit: bigwig - path "versions.yml", emit: versions + tuple val(meta), path("*.combined.bed.gz") , emit: combined_bed + tuple val(meta), path("*.combined.bed.gz.tbi"), emit: combined_bed_index + tuple val(meta), path("*.combined.bw") , emit: combined_bigwig + tuple val(meta), path("*.hap1.bed.gz") , emit: hap1_bed , optional: true + tuple val(meta), path("*.hap1.bed.gz.tbi") , emit: hap1_bed_index , optional: true + tuple val(meta), path("*.hap1.bw") , emit: hap1_bigwig , optional: true + tuple val(meta), path("*.hap2.bed.gz") , emit: hap2_bed , optional: true + tuple val(meta), path("*.hap2.bed.gz.tbi") , emit: hap2_bed_index , optional: true + tuple val(meta), path("*.hap2.bw") , emit: hap2_bigwig , optional: true + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -22,7 +28,6 @@ process PBCPGTOOLS_ALIGNEDBAMTOCPGSCORES { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - """ aligned_bam_to_cpg_scores \\ --bam ${bam} \\ @@ -32,15 +37,13 @@ process PBCPGTOOLS_ALIGNEDBAMTOCPGSCORES { cat <<-END_VERSIONS > versions.yml "${task.process}": - pbcpgtools: \$(aligned_bam_to_cpg_scores --version | sed 's/aligned_bam_to_cpg_scores //') + pbcpgtools: \$(aligned_bam_to_cpg_scores --version | sed 's/.* //') END_VERSIONS """ stub: def prefix = task.ext.prefix ?: "${meta.id}" - """ - echo "" | gzip > ${prefix}.combined.bed.gz touch ${prefix}.combined.bed.gz.tbi touch ${prefix}.combined.bw @@ -55,7 +58,7 @@ process PBCPGTOOLS_ALIGNEDBAMTOCPGSCORES { cat <<-END_VERSIONS > versions.yml "${task.process}": - pbcpgtools: \$(aligned_bam_to_cpg_scores --version | sed 's/aligned_bam_to_cpg_scores //') + pbcpgtools: \$(aligned_bam_to_cpg_scores --version | sed 's/.* //') END_VERSIONS """ } diff --git a/modules/nf-core/pbcpgtools/alignedbamtocpgscores/meta.yml b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/meta.yml index 38a67841742..ce6161edc34 100644 --- a/modules/nf-core/pbcpgtools/alignedbamtocpgscores/meta.yml +++ b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/meta.yml @@ -1,24 +1,24 @@ # yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json name: "pbcpgtools_alignedbamtocpgscores" -description: Converts aligned BAM files into CpG methylation scores using pb-cpg-tools. +description: Converts aligned BAM files into CpG methylation scores keywords: - methylation - cpg - pacbio tools: - - "pbcpgtools": + - pbcpgtools: description: "Collection of tools for the analysis of CpG data" homepage: "https://github.com/PacificBiosciences/pb-CpG-tools" documentation: "https://github.com/PacificBiosciences/pb-CpG-tools#readme" tool_dev_url: "https://github.com/PacificBiosciences/pb-CpG-tools" licence: ["Pacific Biosciences Software License Agreement"] - + identifier: "" input: - - meta: type: map description: | Groovy Map containing sample information - e.g. `[ id:'sample1' ]` + e.g. `[ id:'test' ]` - bam: type: file description: BAM/CRAM file @@ -29,48 +29,113 @@ input: description: Index of BAM/CRAM file pattern: "*.{bai,crai,csi}" ontologies: [] - output: - bed: + combined_bed: - - meta: type: map description: | Groovy Map containing sample information - e.g. `[ id:'sample1' ]` - - "*.bed.gz": + e.g. `[ id:'test' ]` + - "*.combined.bed.gz": type: file - description: Zipped BED file with CpG methylation scores - pattern: "*.{bed.gz}" + description: Zipped BED file with CpG methylation scores for both haplotypes + pattern: "*.{combined.bed.gz}" ontologies: [] - bed_index: + combined_bed_index: - - meta: type: map description: | Groovy Map containing sample information - e.g. `[ id:'sample1' ]` - - "*.bed.gz.tbi": + e.g. `[ id:'test' ]` + - "*.combined.bed.gz.tbi": type: file - description: Index of zipped BED file - pattern: "*.{.bed.gz.tbi}" + description: Index of combined zipped BED file + pattern: "*.{combined.bed.gz.tbi}" ontologies: [] - bigwig: + combined_bigwig: - - meta: type: map description: | Groovy Map containing sample information - e.g. `[ id:'sample1' ]` - - "*.bw": + e.g. `[ id:'test' ]` + - "*.combined.bw": type: file description: Bigwig file for visualization in IGV - pattern: "*.{bw}" + pattern: "*.{combined.bw}" + ontologies: [] + hap1_bed: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test' ]` + - "*.hap1.bed.gz": + type: file + description: Zipped BED file with CpG methylation scores for haplotype 1 + pattern: "*.{hap1.bed.gz}" + ontologies: [] + hap1_bed_index: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test' ]` + - "*.hap1.bed.gz.tbi": + type: file + description: Index of hap1 zipped BED file + pattern: "*.{hap1.bed.gz.tbi}" + ontologies: [] + hap1_bigwig: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test' ]` + - "*.hap1.bw": + type: file + description: Bigwig file for visualization in IGV + pattern: "*.{hap1.bw}" + ontologies: [] + hap2_bed: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test' ]` + - "*.hap2.bed.gz": + type: file + description: Zipped BED file with CpG methylation scores for haplotype 2 + pattern: "*.{hap2.bed.gz}" + ontologies: [] + hap2_bed_index: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test' ]` + - "*.hap2.bed.gz.tbi": + type: file + description: Index of hap2 zipped BED file + pattern: "*.{hap2.bed.gz.tbi}" + ontologies: [] + hap2_bigwig: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test' ]` + - "*.hap2.bw": + type: file + description: Bigwig file for visualization in IGV + pattern: "*.{hap2.bw}" ontologies: [] versions: - - "versions.yml": + - versions.yml: type: file description: File containing software versions pattern: "versions.yml" - ontologies: [] - + ontologies: + - edam: http://edamontology.org/format_3750 # YAML authors: - "@inemesb" maintainers: diff --git a/modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test.snap b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test.snap index 70fd97e5a76..311e4ca1fe5 100644 --- a/modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test.snap +++ b/modules/nf-core/pbcpgtools/alignedbamtocpgscores/tests/main.nf.test.snap @@ -27,9 +27,27 @@ ] ], "3": [ + + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + + ], + "7": [ + + ], + "8": [ + + ], + "9": [ "versions.yml:md5,e77c5038eded0c8fe9de5af6f9de783b" ], - "bed": [ + "combined_bed": [ [ { "id": "test" @@ -37,7 +55,7 @@ "test.combined.bed.gz:md5,bacdb71f8eec683930c6103f020277cd" ] ], - "bed_index": [ + "combined_bed_index": [ [ { "id": "test" @@ -45,13 +63,31 @@ "test.combined.bed.gz.tbi:md5,9ca5efde7981fec4e6a79b0b08999186" ] ], - "bigwig": [ + "combined_bigwig": [ [ { "id": "test" }, "test.combined.bw:md5,77a572a00645df6743459805bd397cb9" ] + ], + "hap1_bed": [ + + ], + "hap1_bed_index": [ + + ], + "hap1_bigwig": [ + + ], + "hap2_bed": [ + + ], + "hap2_bed_index": [ + + ], + "hap2_bigwig": [ + ], "versions": [ "versions.yml:md5,e77c5038eded0c8fe9de5af6f9de783b" @@ -62,7 +98,7 @@ "nf-test": "0.9.2", "nextflow": "25.04.7" }, - "timestamp": "2025-10-31T10:15:31.999302716" + "timestamp": "2025-11-03T09:38:40.744685049" }, "pacbio - bam - phased": { "content": [ @@ -72,11 +108,7 @@ { "id": "test" }, - [ - "test.combined.bed.gz:md5,861084b58d048a2a957a86068ec39bcf", - "test.hap1.bed.gz:md5,db37b440b02203f38c0d7c20b3dd62f3", - "test.hap2.bed.gz:md5,b5b7a4539d3906bd938010644b779196" - ] + "test.combined.bed.gz:md5,861084b58d048a2a957a86068ec39bcf" ] ], "1": [ @@ -84,11 +116,7 @@ { "id": "test" }, - [ - "test.combined.bed.gz.tbi:md5,4325f78aeb593d00de8b56cffbc77712", - "test.hap1.bed.gz.tbi:md5,b9813e40b7d3365fb312ad35ac117bab", - "test.hap2.bed.gz.tbi:md5,0213f587a323929cd2180862b01e8044" - ] + "test.combined.bed.gz.tbi:md5,4325f78aeb593d00de8b56cffbc77712" ] ], "2": [ @@ -96,50 +124,130 @@ { "id": "test" }, - [ - "test.combined.bw:md5,77a572a00645df6743459805bd397cb9", - "test.hap1.bw:md5,df389b5415312c1da05a762177f7b50e", - "test.hap2.bw:md5,b87e364ef8cf80790ddef4963fa5e55c" - ] + "test.combined.bw:md5,77a572a00645df6743459805bd397cb9" ] ], "3": [ + [ + { + "id": "test" + }, + "test.hap1.bed.gz:md5,db37b440b02203f38c0d7c20b3dd62f3" + ] + ], + "4": [ + [ + { + "id": "test" + }, + "test.hap1.bed.gz.tbi:md5,b9813e40b7d3365fb312ad35ac117bab" + ] + ], + "5": [ + [ + { + "id": "test" + }, + "test.hap1.bw:md5,df389b5415312c1da05a762177f7b50e" + ] + ], + "6": [ + [ + { + "id": "test" + }, + "test.hap2.bed.gz:md5,b5b7a4539d3906bd938010644b779196" + ] + ], + "7": [ + [ + { + "id": "test" + }, + "test.hap2.bed.gz.tbi:md5,0213f587a323929cd2180862b01e8044" + ] + ], + "8": [ + [ + { + "id": "test" + }, + "test.hap2.bw:md5,b87e364ef8cf80790ddef4963fa5e55c" + ] + ], + "9": [ "versions.yml:md5,e77c5038eded0c8fe9de5af6f9de783b" ], - "bed": [ + "combined_bed": [ + [ + { + "id": "test" + }, + "test.combined.bed.gz:md5,861084b58d048a2a957a86068ec39bcf" + ] + ], + "combined_bed_index": [ + [ + { + "id": "test" + }, + "test.combined.bed.gz.tbi:md5,4325f78aeb593d00de8b56cffbc77712" + ] + ], + "combined_bigwig": [ + [ + { + "id": "test" + }, + "test.combined.bw:md5,77a572a00645df6743459805bd397cb9" + ] + ], + "hap1_bed": [ + [ + { + "id": "test" + }, + "test.hap1.bed.gz:md5,db37b440b02203f38c0d7c20b3dd62f3" + ] + ], + "hap1_bed_index": [ + [ + { + "id": "test" + }, + "test.hap1.bed.gz.tbi:md5,b9813e40b7d3365fb312ad35ac117bab" + ] + ], + "hap1_bigwig": [ + [ + { + "id": "test" + }, + "test.hap1.bw:md5,df389b5415312c1da05a762177f7b50e" + ] + ], + "hap2_bed": [ [ { "id": "test" }, - [ - "test.combined.bed.gz:md5,861084b58d048a2a957a86068ec39bcf", - "test.hap1.bed.gz:md5,db37b440b02203f38c0d7c20b3dd62f3", - "test.hap2.bed.gz:md5,b5b7a4539d3906bd938010644b779196" - ] + "test.hap2.bed.gz:md5,b5b7a4539d3906bd938010644b779196" ] ], - "bed_index": [ + "hap2_bed_index": [ [ { "id": "test" }, - [ - "test.combined.bed.gz.tbi:md5,4325f78aeb593d00de8b56cffbc77712", - "test.hap1.bed.gz.tbi:md5,b9813e40b7d3365fb312ad35ac117bab", - "test.hap2.bed.gz.tbi:md5,0213f587a323929cd2180862b01e8044" - ] + "test.hap2.bed.gz.tbi:md5,0213f587a323929cd2180862b01e8044" ] ], - "bigwig": [ + "hap2_bigwig": [ [ { "id": "test" }, - [ - "test.combined.bw:md5,77a572a00645df6743459805bd397cb9", - "test.hap1.bw:md5,df389b5415312c1da05a762177f7b50e", - "test.hap2.bw:md5,b87e364ef8cf80790ddef4963fa5e55c" - ] + "test.hap2.bw:md5,b87e364ef8cf80790ddef4963fa5e55c" ] ], "versions": [ @@ -151,7 +259,7 @@ "nf-test": "0.9.2", "nextflow": "25.04.7" }, - "timestamp": "2025-10-31T10:15:35.516831346" + "timestamp": "2025-11-03T09:38:43.970189604" }, "pacbio - bam - phased - stub": { "content": [ @@ -161,11 +269,7 @@ { "id": "test" }, - [ - "test.combined.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940", - "test.hap1.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940", - "test.hap2.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" - ] + "test.combined.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" ] ], "1": [ @@ -173,11 +277,7 @@ { "id": "test" }, - [ - "test.combined.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e", - "test.hap1.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e", - "test.hap2.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" - ] + "test.combined.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" ] ], "2": [ @@ -185,50 +285,130 @@ { "id": "test" }, - [ - "test.combined.bw:md5,d41d8cd98f00b204e9800998ecf8427e", - "test.hap1.bw:md5,d41d8cd98f00b204e9800998ecf8427e", - "test.hap2.bw:md5,d41d8cd98f00b204e9800998ecf8427e" - ] + "test.combined.bw:md5,d41d8cd98f00b204e9800998ecf8427e" ] ], "3": [ + [ + { + "id": "test" + }, + "test.hap1.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "4": [ + [ + { + "id": "test" + }, + "test.hap1.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "5": [ + [ + { + "id": "test" + }, + "test.hap1.bw:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "6": [ + [ + { + "id": "test" + }, + "test.hap2.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "7": [ + [ + { + "id": "test" + }, + "test.hap2.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "8": [ + [ + { + "id": "test" + }, + "test.hap2.bw:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "9": [ "versions.yml:md5,e77c5038eded0c8fe9de5af6f9de783b" ], - "bed": [ + "combined_bed": [ + [ + { + "id": "test" + }, + "test.combined.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "combined_bed_index": [ + [ + { + "id": "test" + }, + "test.combined.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "combined_bigwig": [ + [ + { + "id": "test" + }, + "test.combined.bw:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "hap1_bed": [ + [ + { + "id": "test" + }, + "test.hap1.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "hap1_bed_index": [ + [ + { + "id": "test" + }, + "test.hap1.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "hap1_bigwig": [ + [ + { + "id": "test" + }, + "test.hap1.bw:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "hap2_bed": [ [ { "id": "test" }, - [ - "test.combined.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940", - "test.hap1.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940", - "test.hap2.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" - ] + "test.hap2.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" ] ], - "bed_index": [ + "hap2_bed_index": [ [ { "id": "test" }, - [ - "test.combined.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e", - "test.hap1.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e", - "test.hap2.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" - ] + "test.hap2.bed.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" ] ], - "bigwig": [ + "hap2_bigwig": [ [ { "id": "test" }, - [ - "test.combined.bw:md5,d41d8cd98f00b204e9800998ecf8427e", - "test.hap1.bw:md5,d41d8cd98f00b204e9800998ecf8427e", - "test.hap2.bw:md5,d41d8cd98f00b204e9800998ecf8427e" - ] + "test.hap2.bw:md5,d41d8cd98f00b204e9800998ecf8427e" ] ], "versions": [ @@ -240,6 +420,6 @@ "nf-test": "0.9.2", "nextflow": "25.04.7" }, - "timestamp": "2025-10-31T10:15:38.750126786" + "timestamp": "2025-11-03T09:38:47.181920137" } } \ No newline at end of file