From 3c56c6494299d8a920a2a9294564573850f65bad Mon Sep 17 00:00:00 2001 From: HaidYi Date: Wed, 19 Nov 2025 15:23:01 -0800 Subject: [PATCH 01/16] add whatshap phase module --- .../nf-core/whatshap/phase/environment.yml | 7 ++ modules/nf-core/whatshap/phase/main.nf | 56 ++++++++++ modules/nf-core/whatshap/phase/meta.yml | 97 +++++++++++++++++ .../nf-core/whatshap/phase/tests/main.nf.test | 102 ++++++++++++++++++ .../whatshap/phase/tests/main.nf.test.snap | 51 +++++++++ 5 files changed, 313 insertions(+) create mode 100644 modules/nf-core/whatshap/phase/environment.yml create mode 100644 modules/nf-core/whatshap/phase/main.nf create mode 100644 modules/nf-core/whatshap/phase/meta.yml create mode 100644 modules/nf-core/whatshap/phase/tests/main.nf.test create mode 100644 modules/nf-core/whatshap/phase/tests/main.nf.test.snap diff --git a/modules/nf-core/whatshap/phase/environment.yml b/modules/nf-core/whatshap/phase/environment.yml new file mode 100644 index 00000000000..389d6871ef4 --- /dev/null +++ b/modules/nf-core/whatshap/phase/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::whatshap=2.8" diff --git a/modules/nf-core/whatshap/phase/main.nf b/modules/nf-core/whatshap/phase/main.nf new file mode 100644 index 00000000000..b4f60602e2a --- /dev/null +++ b/modules/nf-core/whatshap/phase/main.nf @@ -0,0 +1,56 @@ +process WHATSHAP_PHASE { + tag "$meta.id" + label 'process_low' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'oras://community.wave.seqera.io/library/whatshap:2.8--c3862a4b2ad0f978': + 'community.wave.seqera.io/library/whatshap:2.8--7fe530bc624a3e5a' }" + + input: + tuple val(meta), path(vcf), path(tbi) + tuple val(meta2), path(bam), path(bai) + tuple val(meta3), path(fasta), path(fai) + + output: + tuple val(meta), path("*.phased.vcf.gz") , emit: vcf + tuple val(meta), path("*.phased.vcf.gz.tbi"), emit: tbi + 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}" + """ + whatshap \\ + phase \\ + --output ${prefix}.phased.vcf \\ + --reference $fasta \\ + $args \\ + $vcf \\ + $bam + + bgzip ${prefix}.phased.vcf + tabix -p vcf ${prefix}.phased.vcf.gz + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + whatshap: \$(whatshap --version 2>&1 | sed 's/whatshap //g') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.phased.vcf.gz + touch ${prefix}.phased.vcf.gz.tbi + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + whatshap: \$(whatshap --version 2>&1 | sed 's/whatshap //g') + END_VERSIONS + """ +} diff --git a/modules/nf-core/whatshap/phase/meta.yml b/modules/nf-core/whatshap/phase/meta.yml new file mode 100644 index 00000000000..148a5462a58 --- /dev/null +++ b/modules/nf-core/whatshap/phase/meta.yml @@ -0,0 +1,97 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "whatshap_phase" +description: Phase variants in a VCF file using long-read sequencing data +keywords: + - phasing + - haplotypes + - vcf + - long-reads + - nanopore + - pacbio +tools: + - whatshap: + description: | + WhatsHap is a software for phasing genomic variants using DNA sequencing + reads, also called read-based phasing or haplotype assembly. + homepage: https://whatshap.readthedocs.io/ + documentation: https://whatshap.readthedocs.io/ + tool_dev_url: https://github.com/whatshap/whatshap + doi: "10.1101/085050" + licence: ["MIT"] + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - vcf: + type: file + description: VCF file with unphased variants (can be gzipped) + pattern: "*.{vcf,vcf.gz}" + - tbi: + type: file + description: VCF index file (optional but recommended) + pattern: "*.{tbi,csi}" + - - meta2: + type: map + description: | + Groovy Map containing bam information + e.g. [ id:'test', single_end:false ] + - bam: + type: file + description: BAM file with aligned reads + pattern: "*.bam" + - bai: + type: file + description: BAM index file (optional but recommended) + pattern: "*.bai" + - - meta3: + type: map + description: | + Groovy Map containing reference information + e.g. [ id:'genome' ] + - fasta: + type: file + description: Reference genome in FASTA format + pattern: "*.{fa,fasta}" + - fai: + type: file + description: Reference genome index + pattern: "*.fai" + +output: + vcf: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.phased.vcf.gz": + type: file + description: Bgzipped phased VCF file + pattern: "*.vcf.gz" + ontologies: [] + tbi: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.phased.vcf.gz.tbi": + type: file + description: Phased VCF index file + pattern: "*.vcf.gz" + ontologies: [] + versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: + - edam: http://edamontology.org/format_3750 # YAML + +authors: + - "@haidyi" +maintainers: + - "@haidyi" diff --git a/modules/nf-core/whatshap/phase/tests/main.nf.test b/modules/nf-core/whatshap/phase/tests/main.nf.test new file mode 100644 index 00000000000..a3f08ca0953 --- /dev/null +++ b/modules/nf-core/whatshap/phase/tests/main.nf.test @@ -0,0 +1,102 @@ +nextflow_process { + + name "Test Process WHATSHAP_PHASE" + script "../main.nf" + process "WHATSHAP_PHASE" + + tag "modules" + tag "modules_nfcore" + tag "whatshap" + tag "whatshap/phase" + tag "samtools_faidx" + + setup { + run("SAMTOOLS_FAIDX") { + script "../../../samtools/faidx/main.nf" + process { + """ + input[0] = [ [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome3.fasta', checkIfExists: true) ] + input[1] = [[],[]] + input[2] = false + """ + } + } + } + + test("whatshap - phase - vcf") { + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/vcf/NA03697B2_new.pbmm2.repeats.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/vcf/NA03697B2_new.pbmm2.repeats.vcf.gz.csi', checkIfExists: true), + + ] + + input[1] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA03697B2_downsampled.pbmm2.repeats.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA03697B2_downsampled.pbmm2.repeats.bam.bai', checkIfExists: true), + ] + + input[2] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome3.fasta', checkIfExists: true) + ]).join(SAMTOOLS_FAIDX.out.fai) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.vcf[0][1]).vcf.summary, + file(process.out.vcf[0][1]).vcf.variantsMD5, + ).match() } + ) + } + + } + + test("whatshap - phase - vcf - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/vcf/NA03697B2_new.pbmm2.repeats.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/vcf/NA03697B2_new.pbmm2.repeats.vcf.gz.csi', checkIfExists: true), + + ] + + input[1] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA03697B2_downsampled.pbmm2.repeats.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA03697B2_downsampled.pbmm2.repeats.bam.bai', checkIfExists: true), + ] + + input[2] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome3.fasta', checkIfExists: true) + ]).join(SAMTOOLS_FAIDX.out.fai) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/whatshap/phase/tests/main.nf.test.snap b/modules/nf-core/whatshap/phase/tests/main.nf.test.snap new file mode 100644 index 00000000000..23a8d73ee8e --- /dev/null +++ b/modules/nf-core/whatshap/phase/tests/main.nf.test.snap @@ -0,0 +1,51 @@ +{ + "whatshap - phase - vcf - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "/Users/hyi/Documents/proj/modules/.nf-test/tests/e287a32825e762a59103c13d3c316644/work/38/14e6fb7a2d6c8765594e1a3d7a9cf7/test.phased.vcf.gz" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.phased.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,eebecfb3d7f284fc7d11c67978bf1994" + ], + "tbi": [ + [ + { + "id": "test" + }, + "test.phased.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "vcf": [ + [ + { + "id": "test" + }, + "/Users/hyi/Documents/proj/modules/.nf-test/tests/e287a32825e762a59103c13d3c316644/work/38/14e6fb7a2d6c8765594e1a3d7a9cf7/test.phased.vcf.gz" + ] + ], + "versions": [ + "versions.yml:md5,eebecfb3d7f284fc7d11c67978bf1994" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.2" + }, + "timestamp": "2025-11-19T15:19:22.827299" + } +} \ No newline at end of file From cba565faa413b64fa6e897430f01aca20d525e96 Mon Sep 17 00:00:00 2001 From: HaidYi Date: Wed, 19 Nov 2025 17:36:15 -0600 Subject: [PATCH 02/16] change the vcf-specific test --- modules/nf-core/whatshap/phase/tests/main.nf.test | 4 ++-- .../nf-core/whatshap/phase/tests/main.nf.test.snap | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/nf-core/whatshap/phase/tests/main.nf.test b/modules/nf-core/whatshap/phase/tests/main.nf.test index a3f08ca0953..9ede19d35aa 100644 --- a/modules/nf-core/whatshap/phase/tests/main.nf.test +++ b/modules/nf-core/whatshap/phase/tests/main.nf.test @@ -54,8 +54,8 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot( - file(process.out.vcf[0][1]).vcf.summary, - file(process.out.vcf[0][1]).vcf.variantsMD5, + path(process.out.vcf.get(0).get(1)).vcf.summary, + path(process.out.vcf.get(0).get(1)).vcf.variantsMD5, ).match() } ) } diff --git a/modules/nf-core/whatshap/phase/tests/main.nf.test.snap b/modules/nf-core/whatshap/phase/tests/main.nf.test.snap index 23a8d73ee8e..6b2d331be55 100644 --- a/modules/nf-core/whatshap/phase/tests/main.nf.test.snap +++ b/modules/nf-core/whatshap/phase/tests/main.nf.test.snap @@ -47,5 +47,16 @@ "nextflow": "25.04.2" }, "timestamp": "2025-11-19T15:19:22.827299" + }, + "whatshap - phase - vcf": { + "content": [ + "VcfFile [chromosomes=[chr19:45760000-45770300], sampleCount=1, variantCount=1, phased=false, phasedAutodetect=false]", + "e75d1ebbe87d6e55739cacb4e81dcd08" + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2025-11-19T17:33:13.304122613" } } \ No newline at end of file From 9ae34b7f10f907d5f85ea150361c173a19aec340 Mon Sep 17 00:00:00 2001 From: HaidYi Date: Wed, 19 Nov 2025 18:09:52 -0600 Subject: [PATCH 03/16] change test --- .../nf-core/whatshap/phase/tests/main.nf.test | 3 +- .../whatshap/phase/tests/main.nf.test.snap | 49 ------------------- 2 files changed, 1 insertion(+), 51 deletions(-) diff --git a/modules/nf-core/whatshap/phase/tests/main.nf.test b/modules/nf-core/whatshap/phase/tests/main.nf.test index 9ede19d35aa..a67d2e46ecf 100644 --- a/modules/nf-core/whatshap/phase/tests/main.nf.test +++ b/modules/nf-core/whatshap/phase/tests/main.nf.test @@ -92,8 +92,7 @@ nextflow_process { then { assertAll( - { assert process.success }, - { assert snapshot(process.out).match() } + { assert process.success } ) } diff --git a/modules/nf-core/whatshap/phase/tests/main.nf.test.snap b/modules/nf-core/whatshap/phase/tests/main.nf.test.snap index 6b2d331be55..37c64ea38eb 100644 --- a/modules/nf-core/whatshap/phase/tests/main.nf.test.snap +++ b/modules/nf-core/whatshap/phase/tests/main.nf.test.snap @@ -1,53 +1,4 @@ { - "whatshap - phase - vcf - stub": { - "content": [ - { - "0": [ - [ - { - "id": "test" - }, - "/Users/hyi/Documents/proj/modules/.nf-test/tests/e287a32825e762a59103c13d3c316644/work/38/14e6fb7a2d6c8765594e1a3d7a9cf7/test.phased.vcf.gz" - ] - ], - "1": [ - [ - { - "id": "test" - }, - "test.phased.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "2": [ - "versions.yml:md5,eebecfb3d7f284fc7d11c67978bf1994" - ], - "tbi": [ - [ - { - "id": "test" - }, - "test.phased.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "vcf": [ - [ - { - "id": "test" - }, - "/Users/hyi/Documents/proj/modules/.nf-test/tests/e287a32825e762a59103c13d3c316644/work/38/14e6fb7a2d6c8765594e1a3d7a9cf7/test.phased.vcf.gz" - ] - ], - "versions": [ - "versions.yml:md5,eebecfb3d7f284fc7d11c67978bf1994" - ] - } - ], - "meta": { - "nf-test": "0.9.2", - "nextflow": "25.04.2" - }, - "timestamp": "2025-11-19T15:19:22.827299" - }, "whatshap - phase - vcf": { "content": [ "VcfFile [chromosomes=[chr19:45760000-45770300], sampleCount=1, variantCount=1, phased=false, phasedAutodetect=false]", From 8b7b28e33d80917302ea6e2c40589ca09e68b534 Mon Sep 17 00:00:00 2001 From: HaidYi Date: Wed, 19 Nov 2025 18:18:56 -0600 Subject: [PATCH 04/16] add versions --- modules/nf-core/whatshap/phase/tests/main.nf.test | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/nf-core/whatshap/phase/tests/main.nf.test b/modules/nf-core/whatshap/phase/tests/main.nf.test index a67d2e46ecf..e9d18b9ab37 100644 --- a/modules/nf-core/whatshap/phase/tests/main.nf.test +++ b/modules/nf-core/whatshap/phase/tests/main.nf.test @@ -8,7 +8,7 @@ nextflow_process { tag "modules_nfcore" tag "whatshap" tag "whatshap/phase" - tag "samtools_faidx" + tag "samtools/faidx" setup { run("SAMTOOLS_FAIDX") { @@ -56,6 +56,7 @@ nextflow_process { { assert snapshot( path(process.out.vcf.get(0).get(1)).vcf.summary, path(process.out.vcf.get(0).get(1)).vcf.variantsMD5, + process.out.versions, ).match() } ) } From 5f4e5f9729c45680e33038e5ced186030b5df1b8 Mon Sep 17 00:00:00 2001 From: HaidYi Date: Wed, 19 Nov 2025 18:20:21 -0600 Subject: [PATCH 05/16] remove snapshot --- .../nf-core/whatshap/phase/tests/main.nf.test.snap | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 modules/nf-core/whatshap/phase/tests/main.nf.test.snap diff --git a/modules/nf-core/whatshap/phase/tests/main.nf.test.snap b/modules/nf-core/whatshap/phase/tests/main.nf.test.snap deleted file mode 100644 index 37c64ea38eb..00000000000 --- a/modules/nf-core/whatshap/phase/tests/main.nf.test.snap +++ /dev/null @@ -1,13 +0,0 @@ -{ - "whatshap - phase - vcf": { - "content": [ - "VcfFile [chromosomes=[chr19:45760000-45770300], sampleCount=1, variantCount=1, phased=false, phasedAutodetect=false]", - "e75d1ebbe87d6e55739cacb4e81dcd08" - ], - "meta": { - "nf-test": "0.9.2", - "nextflow": "25.04.6" - }, - "timestamp": "2025-11-19T17:33:13.304122613" - } -} \ No newline at end of file From 3e8877d64ae0b96de3ee2142fc2ea331826e21a8 Mon Sep 17 00:00:00 2001 From: HaidYi Date: Wed, 19 Nov 2025 18:26:43 -0600 Subject: [PATCH 06/16] update snapshot --- .../whatshap/phase/tests/main.nf.test.snap | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 modules/nf-core/whatshap/phase/tests/main.nf.test.snap diff --git a/modules/nf-core/whatshap/phase/tests/main.nf.test.snap b/modules/nf-core/whatshap/phase/tests/main.nf.test.snap new file mode 100644 index 00000000000..00ecb0968eb --- /dev/null +++ b/modules/nf-core/whatshap/phase/tests/main.nf.test.snap @@ -0,0 +1,16 @@ +{ + "whatshap - phase - vcf": { + "content": [ + "VcfFile [chromosomes=[chr19:45760000-45770300], sampleCount=1, variantCount=1, phased=false, phasedAutodetect=false]", + "e75d1ebbe87d6e55739cacb4e81dcd08", + [ + "versions.yml:md5,eebecfb3d7f284fc7d11c67978bf1994" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2025-11-19T18:25:34.024894349" + } +} \ No newline at end of file From 42850a647cb8f6d5d6d83b1ccf280c7960c69685 Mon Sep 17 00:00:00 2001 From: HD Yi Date: Mon, 24 Nov 2025 09:21:54 -0800 Subject: [PATCH 07/16] Update modules/nf-core/whatshap/phase/tests/main.nf.test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Famke Bäuerle <45968370+famosab@users.noreply.github.com> --- modules/nf-core/whatshap/phase/tests/main.nf.test | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/nf-core/whatshap/phase/tests/main.nf.test b/modules/nf-core/whatshap/phase/tests/main.nf.test index e9d18b9ab37..ed1d3df5668 100644 --- a/modules/nf-core/whatshap/phase/tests/main.nf.test +++ b/modules/nf-core/whatshap/phase/tests/main.nf.test @@ -57,6 +57,7 @@ nextflow_process { path(process.out.vcf.get(0).get(1)).vcf.summary, path(process.out.vcf.get(0).get(1)).vcf.variantsMD5, process.out.versions, + path(process.out.versions[0]).yaml, ).match() } ) } From 3a6669eb54a012323dd9cd82963a9ed1952ea79d Mon Sep 17 00:00:00 2001 From: HaidYi Date: Mon, 24 Nov 2025 11:52:11 -0600 Subject: [PATCH 08/16] rm unused args --- modules/nf-core/whatshap/phase/main.nf | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/nf-core/whatshap/phase/main.nf b/modules/nf-core/whatshap/phase/main.nf index b4f60602e2a..bc166a2064f 100644 --- a/modules/nf-core/whatshap/phase/main.nf +++ b/modules/nf-core/whatshap/phase/main.nf @@ -42,7 +42,6 @@ process WHATSHAP_PHASE { """ stub: - def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" """ touch ${prefix}.phased.vcf.gz From da323149905c84609703e57f2e8bb3fad5e14a72 Mon Sep 17 00:00:00 2001 From: HaidYi Date: Mon, 24 Nov 2025 11:52:34 -0600 Subject: [PATCH 09/16] add snapshot --- .../nf-core/whatshap/phase/tests/main.nf.test | 4 +- .../whatshap/phase/tests/main.nf.test.snap | 49 +++++++++++++++++++ 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/modules/nf-core/whatshap/phase/tests/main.nf.test b/modules/nf-core/whatshap/phase/tests/main.nf.test index ed1d3df5668..622a91237ba 100644 --- a/modules/nf-core/whatshap/phase/tests/main.nf.test +++ b/modules/nf-core/whatshap/phase/tests/main.nf.test @@ -56,7 +56,6 @@ nextflow_process { { assert snapshot( path(process.out.vcf.get(0).get(1)).vcf.summary, path(process.out.vcf.get(0).get(1)).vcf.variantsMD5, - process.out.versions, path(process.out.versions[0]).yaml, ).match() } ) @@ -94,7 +93,8 @@ nextflow_process { then { assertAll( - { assert process.success } + { assert process.success }, + { assert snapshot(process.out).match() } ) } diff --git a/modules/nf-core/whatshap/phase/tests/main.nf.test.snap b/modules/nf-core/whatshap/phase/tests/main.nf.test.snap index 00ecb0968eb..4c3f575e336 100644 --- a/modules/nf-core/whatshap/phase/tests/main.nf.test.snap +++ b/modules/nf-core/whatshap/phase/tests/main.nf.test.snap @@ -1,4 +1,53 @@ { + "whatshap - phase - vcf - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "/home/hyi/proj/modules/.nf-test/tests/7e4bcbe39c49c581a6da5ac23f7380c9/work/d0/80a77469a6d95b50348c3d6068d0c3/test.phased.vcf.gz" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.phased.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,eebecfb3d7f284fc7d11c67978bf1994" + ], + "tbi": [ + [ + { + "id": "test" + }, + "test.phased.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "vcf": [ + [ + { + "id": "test" + }, + "/home/hyi/proj/modules/.nf-test/tests/7e4bcbe39c49c581a6da5ac23f7380c9/work/d0/80a77469a6d95b50348c3d6068d0c3/test.phased.vcf.gz" + ] + ], + "versions": [ + "versions.yml:md5,eebecfb3d7f284fc7d11c67978bf1994" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2025-11-24T11:48:27.220260344" + }, "whatshap - phase - vcf": { "content": [ "VcfFile [chromosomes=[chr19:45760000-45770300], sampleCount=1, variantCount=1, phased=false, phasedAutodetect=false]", From 1bb901113dad83506de367fb0c45cba7e298f9ec Mon Sep 17 00:00:00 2001 From: HaidYi Date: Mon, 24 Nov 2025 11:52:41 -0600 Subject: [PATCH 10/16] add ontologies --- modules/nf-core/whatshap/phase/meta.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/nf-core/whatshap/phase/meta.yml b/modules/nf-core/whatshap/phase/meta.yml index 148a5462a58..05dbbf5fb38 100644 --- a/modules/nf-core/whatshap/phase/meta.yml +++ b/modules/nf-core/whatshap/phase/meta.yml @@ -70,8 +70,9 @@ output: - "*.phased.vcf.gz": type: file description: Bgzipped phased VCF file - pattern: "*.vcf.gz" - ontologies: [] + pattern: "*.phased.vcf.gz" + ontologies: + - edam: http://edamontology.org/format_3989 # GZIP format tbi: - - meta: type: map @@ -81,8 +82,9 @@ output: - "*.phased.vcf.gz.tbi": type: file description: Phased VCF index file - pattern: "*.vcf.gz" - ontologies: [] + pattern: "*.phased.vcf.gz.tbi" + ontologies: + - edam: http://edamontology.org/format_3616 # TBI format versions: - versions.yml: type: file From 750d314c7dd19bb00ea75e66d3c66ecb173e33a6 Mon Sep 17 00:00:00 2001 From: HaidYi Date: Mon, 24 Nov 2025 12:20:22 -0600 Subject: [PATCH 11/16] update the snapshot --- .../nf-core/whatshap/phase/tests/main.nf.test | 5 +- .../whatshap/phase/tests/main.nf.test.snap | 61 ++++++------------- 2 files changed, 22 insertions(+), 44 deletions(-) diff --git a/modules/nf-core/whatshap/phase/tests/main.nf.test b/modules/nf-core/whatshap/phase/tests/main.nf.test index 622a91237ba..2555c8c9152 100644 --- a/modules/nf-core/whatshap/phase/tests/main.nf.test +++ b/modules/nf-core/whatshap/phase/tests/main.nf.test @@ -94,7 +94,10 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot( + process.out.tbi, + path(process.out.versions[0]).yaml + ).match() } ) } diff --git a/modules/nf-core/whatshap/phase/tests/main.nf.test.snap b/modules/nf-core/whatshap/phase/tests/main.nf.test.snap index 4c3f575e336..51162cf40c0 100644 --- a/modules/nf-core/whatshap/phase/tests/main.nf.test.snap +++ b/modules/nf-core/whatshap/phase/tests/main.nf.test.snap @@ -1,65 +1,40 @@ { "whatshap - phase - vcf - stub": { "content": [ - { - "0": [ - [ - { - "id": "test" - }, - "/home/hyi/proj/modules/.nf-test/tests/7e4bcbe39c49c581a6da5ac23f7380c9/work/d0/80a77469a6d95b50348c3d6068d0c3/test.phased.vcf.gz" - ] - ], - "1": [ - [ - { - "id": "test" - }, - "test.phased.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "2": [ - "versions.yml:md5,eebecfb3d7f284fc7d11c67978bf1994" - ], - "tbi": [ - [ - { - "id": "test" - }, - "test.phased.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "vcf": [ - [ - { - "id": "test" - }, - "/home/hyi/proj/modules/.nf-test/tests/7e4bcbe39c49c581a6da5ac23f7380c9/work/d0/80a77469a6d95b50348c3d6068d0c3/test.phased.vcf.gz" - ] - ], - "versions": [ - "versions.yml:md5,eebecfb3d7f284fc7d11c67978bf1994" + [ + [ + { + "id": "test" + }, + "test.phased.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" ] + ], + { + "WHATSHAP_PHASE": { + "whatshap": 2.8 + } } ], "meta": { "nf-test": "0.9.2", "nextflow": "25.04.6" }, - "timestamp": "2025-11-24T11:48:27.220260344" + "timestamp": "2025-11-24T12:18:25.956894074" }, "whatshap - phase - vcf": { "content": [ "VcfFile [chromosomes=[chr19:45760000-45770300], sampleCount=1, variantCount=1, phased=false, phasedAutodetect=false]", "e75d1ebbe87d6e55739cacb4e81dcd08", - [ - "versions.yml:md5,eebecfb3d7f284fc7d11c67978bf1994" - ] + { + "WHATSHAP_PHASE": { + "whatshap": 2.8 + } + } ], "meta": { "nf-test": "0.9.2", "nextflow": "25.04.6" }, - "timestamp": "2025-11-19T18:25:34.024894349" + "timestamp": "2025-11-24T12:18:21.776294793" } } \ No newline at end of file From cf6027ff0c2a9a17124257b83a56913b5e21dc40 Mon Sep 17 00:00:00 2001 From: HaidYi Date: Mon, 24 Nov 2025 12:26:16 -0600 Subject: [PATCH 12/16] add versions to snapshot --- modules/nf-core/whatshap/phase/tests/main.nf.test | 2 ++ modules/nf-core/whatshap/phase/tests/main.nf.test.snap | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/nf-core/whatshap/phase/tests/main.nf.test b/modules/nf-core/whatshap/phase/tests/main.nf.test index 2555c8c9152..27c68a669fd 100644 --- a/modules/nf-core/whatshap/phase/tests/main.nf.test +++ b/modules/nf-core/whatshap/phase/tests/main.nf.test @@ -56,6 +56,7 @@ nextflow_process { { assert snapshot( path(process.out.vcf.get(0).get(1)).vcf.summary, path(process.out.vcf.get(0).get(1)).vcf.variantsMD5, + process.out.versions, path(process.out.versions[0]).yaml, ).match() } ) @@ -96,6 +97,7 @@ nextflow_process { { assert process.success }, { assert snapshot( process.out.tbi, + process.out.versions, path(process.out.versions[0]).yaml ).match() } ) diff --git a/modules/nf-core/whatshap/phase/tests/main.nf.test.snap b/modules/nf-core/whatshap/phase/tests/main.nf.test.snap index 51162cf40c0..b406e34ed82 100644 --- a/modules/nf-core/whatshap/phase/tests/main.nf.test.snap +++ b/modules/nf-core/whatshap/phase/tests/main.nf.test.snap @@ -9,6 +9,9 @@ "test.phased.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" ] ], + [ + "versions.yml:md5,eebecfb3d7f284fc7d11c67978bf1994" + ], { "WHATSHAP_PHASE": { "whatshap": 2.8 @@ -19,12 +22,15 @@ "nf-test": "0.9.2", "nextflow": "25.04.6" }, - "timestamp": "2025-11-24T12:18:25.956894074" + "timestamp": "2025-11-24T12:25:06.255615822" }, "whatshap - phase - vcf": { "content": [ "VcfFile [chromosomes=[chr19:45760000-45770300], sampleCount=1, variantCount=1, phased=false, phasedAutodetect=false]", "e75d1ebbe87d6e55739cacb4e81dcd08", + [ + "versions.yml:md5,eebecfb3d7f284fc7d11c67978bf1994" + ], { "WHATSHAP_PHASE": { "whatshap": 2.8 @@ -35,6 +41,6 @@ "nf-test": "0.9.2", "nextflow": "25.04.6" }, - "timestamp": "2025-11-24T12:18:21.776294793" + "timestamp": "2025-11-24T12:25:02.040845428" } } \ No newline at end of file From 7f4c53878fb7a8f3e28ae9756b9d877a38e047f9 Mon Sep 17 00:00:00 2001 From: HaidYi Date: Thu, 4 Dec 2025 13:12:17 -0600 Subject: [PATCH 13/16] fix stub issues --- modules/nf-core/whatshap/phase/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nf-core/whatshap/phase/main.nf b/modules/nf-core/whatshap/phase/main.nf index bc166a2064f..4517a9cd3b6 100644 --- a/modules/nf-core/whatshap/phase/main.nf +++ b/modules/nf-core/whatshap/phase/main.nf @@ -44,7 +44,7 @@ process WHATSHAP_PHASE { stub: def prefix = task.ext.prefix ?: "${meta.id}" """ - touch ${prefix}.phased.vcf.gz + echo "" | gzip > ${prefix}.phased.vcf.gz touch ${prefix}.phased.vcf.gz.tbi cat <<-END_VERSIONS > versions.yml From 4a179d06d571eb9fa0a47e683cc47089b955acc5 Mon Sep 17 00:00:00 2001 From: HaidYi Date: Thu, 4 Dec 2025 13:12:29 -0600 Subject: [PATCH 14/16] update the test and snap --- .../nf-core/whatshap/phase/tests/main.nf.test | 6 +- .../whatshap/phase/tests/main.nf.test.snap | 64 +++++++++++++------ 2 files changed, 45 insertions(+), 25 deletions(-) diff --git a/modules/nf-core/whatshap/phase/tests/main.nf.test b/modules/nf-core/whatshap/phase/tests/main.nf.test index 27c68a669fd..5d6ec2b8a9e 100644 --- a/modules/nf-core/whatshap/phase/tests/main.nf.test +++ b/modules/nf-core/whatshap/phase/tests/main.nf.test @@ -95,11 +95,7 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot( - process.out.tbi, - process.out.versions, - path(process.out.versions[0]).yaml - ).match() } + { assert snapshot(process.out).match() } ) } diff --git a/modules/nf-core/whatshap/phase/tests/main.nf.test.snap b/modules/nf-core/whatshap/phase/tests/main.nf.test.snap index b406e34ed82..2d0b696d0b7 100644 --- a/modules/nf-core/whatshap/phase/tests/main.nf.test.snap +++ b/modules/nf-core/whatshap/phase/tests/main.nf.test.snap @@ -1,28 +1,52 @@ { "whatshap - phase - vcf - stub": { "content": [ - [ - [ - { - "id": "test" - }, - "test.phased.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - [ - "versions.yml:md5,eebecfb3d7f284fc7d11c67978bf1994" - ], { - "WHATSHAP_PHASE": { - "whatshap": 2.8 - } + "0": [ + [ + { + "id": "test" + }, + "test.phased.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.phased.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,eebecfb3d7f284fc7d11c67978bf1994" + ], + "tbi": [ + [ + { + "id": "test" + }, + "test.phased.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "vcf": [ + [ + { + "id": "test" + }, + "test.phased.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "versions": [ + "versions.yml:md5,eebecfb3d7f284fc7d11c67978bf1994" + ] } ], "meta": { - "nf-test": "0.9.2", - "nextflow": "25.04.6" + "nf-test": "0.9.3", + "nextflow": "25.10.2" }, - "timestamp": "2025-11-24T12:25:06.255615822" + "timestamp": "2025-12-04T13:11:14.419732725" }, "whatshap - phase - vcf": { "content": [ @@ -38,9 +62,9 @@ } ], "meta": { - "nf-test": "0.9.2", - "nextflow": "25.04.6" + "nf-test": "0.9.3", + "nextflow": "25.10.2" }, - "timestamp": "2025-11-24T12:25:02.040845428" + "timestamp": "2025-12-04T13:11:09.397108709" } } \ No newline at end of file From 27072daafbf0cecda6f3b92d7ff97d4d907ab523 Mon Sep 17 00:00:00 2001 From: HaidYi Date: Thu, 4 Dec 2025 13:15:15 -0600 Subject: [PATCH 15/16] fix format with "nextflow lint" --- modules/nf-core/whatshap/phase/main.nf | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/nf-core/whatshap/phase/main.nf b/modules/nf-core/whatshap/phase/main.nf index 4517a9cd3b6..b114b8e6f52 100644 --- a/modules/nf-core/whatshap/phase/main.nf +++ b/modules/nf-core/whatshap/phase/main.nf @@ -1,11 +1,11 @@ process WHATSHAP_PHASE { - tag "$meta.id" + tag "${meta.id}" label 'process_low' conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'oras://community.wave.seqera.io/library/whatshap:2.8--c3862a4b2ad0f978': - 'community.wave.seqera.io/library/whatshap:2.8--7fe530bc624a3e5a' }" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'oras://community.wave.seqera.io/library/whatshap:2.8--c3862a4b2ad0f978' + : 'community.wave.seqera.io/library/whatshap:2.8--7fe530bc624a3e5a'}" input: tuple val(meta), path(vcf), path(tbi) @@ -13,9 +13,9 @@ process WHATSHAP_PHASE { tuple val(meta3), path(fasta), path(fai) output: - tuple val(meta), path("*.phased.vcf.gz") , emit: vcf + tuple val(meta), path("*.phased.vcf.gz"), emit: vcf tuple val(meta), path("*.phased.vcf.gz.tbi"), emit: tbi - path "versions.yml" , emit: versions + path "versions.yml", emit: versions when: task.ext.when == null || task.ext.when @@ -27,10 +27,10 @@ process WHATSHAP_PHASE { whatshap \\ phase \\ --output ${prefix}.phased.vcf \\ - --reference $fasta \\ - $args \\ - $vcf \\ - $bam + --reference ${fasta} \\ + ${args} \\ + ${vcf} \\ + ${bam} bgzip ${prefix}.phased.vcf tabix -p vcf ${prefix}.phased.vcf.gz From 995b9114c0e794ea3ab1624a0c446a3fd659108c Mon Sep 17 00:00:00 2001 From: HaidYi Date: Mon, 8 Dec 2025 10:19:05 -0600 Subject: [PATCH 16/16] fix hardcoded name and file name ambiguity problem --- modules/nf-core/whatshap/phase/main.nf | 22 +++++++++++++------ modules/nf-core/whatshap/phase/meta.yml | 8 +++---- .../whatshap/phase/tests/main.nf.test.snap | 12 +++++----- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/modules/nf-core/whatshap/phase/main.nf b/modules/nf-core/whatshap/phase/main.nf index b114b8e6f52..6d572960783 100644 --- a/modules/nf-core/whatshap/phase/main.nf +++ b/modules/nf-core/whatshap/phase/main.nf @@ -13,8 +13,8 @@ process WHATSHAP_PHASE { tuple val(meta3), path(fasta), path(fai) output: - tuple val(meta), path("*.phased.vcf.gz"), emit: vcf - tuple val(meta), path("*.phased.vcf.gz.tbi"), emit: tbi + tuple val(meta), path("*.vcf.gz"), emit: vcf + tuple val(meta), path("*.vcf.gz.tbi"), emit: tbi path "versions.yml", emit: versions when: @@ -23,17 +23,21 @@ process WHATSHAP_PHASE { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + + if ("${vcf}" == "${prefix}.vcf" || "${vcf}" == "${prefix}.vcf.gz") { + error("Input and output names are the same, set prefix in module configuration to disambiguate!") + } """ whatshap \\ phase \\ - --output ${prefix}.phased.vcf \\ + --output ${prefix}.vcf \\ --reference ${fasta} \\ ${args} \\ ${vcf} \\ ${bam} - bgzip ${prefix}.phased.vcf - tabix -p vcf ${prefix}.phased.vcf.gz + bgzip ${prefix}.vcf + tabix -p vcf ${prefix}.vcf.gz cat <<-END_VERSIONS > versions.yml "${task.process}": @@ -43,9 +47,13 @@ process WHATSHAP_PHASE { stub: def prefix = task.ext.prefix ?: "${meta.id}" + + if ("${vcf}" == "${prefix}.vcf" || "${vcf}" == "${prefix}.vcf.gz") { + error("Input and output names are the same, set prefix in module configuration to disambiguate!") + } """ - echo "" | gzip > ${prefix}.phased.vcf.gz - touch ${prefix}.phased.vcf.gz.tbi + echo "" | gzip > ${prefix}.vcf.gz + touch ${prefix}.vcf.gz.tbi cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/whatshap/phase/meta.yml b/modules/nf-core/whatshap/phase/meta.yml index 05dbbf5fb38..89233aae3b6 100644 --- a/modules/nf-core/whatshap/phase/meta.yml +++ b/modules/nf-core/whatshap/phase/meta.yml @@ -67,10 +67,10 @@ output: description: | Groovy Map containing sample information e.g. `[ id:'sample1', single_end:false ]` - - "*.phased.vcf.gz": + - "*.vcf.gz": type: file description: Bgzipped phased VCF file - pattern: "*.phased.vcf.gz" + pattern: "*.vcf.gz" ontologies: - edam: http://edamontology.org/format_3989 # GZIP format tbi: @@ -79,10 +79,10 @@ output: description: | Groovy Map containing sample information e.g. `[ id:'sample1', single_end:false ]` - - "*.phased.vcf.gz.tbi": + - "*.vcf.gz.tbi": type: file description: Phased VCF index file - pattern: "*.phased.vcf.gz.tbi" + pattern: "*.vcf.gz.tbi" ontologies: - edam: http://edamontology.org/format_3616 # TBI format versions: diff --git a/modules/nf-core/whatshap/phase/tests/main.nf.test.snap b/modules/nf-core/whatshap/phase/tests/main.nf.test.snap index 2d0b696d0b7..18b00f7fb6b 100644 --- a/modules/nf-core/whatshap/phase/tests/main.nf.test.snap +++ b/modules/nf-core/whatshap/phase/tests/main.nf.test.snap @@ -7,7 +7,7 @@ { "id": "test" }, - "test.phased.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + "test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" ] ], "1": [ @@ -15,7 +15,7 @@ { "id": "test" }, - "test.phased.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + "test.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" ] ], "2": [ @@ -26,7 +26,7 @@ { "id": "test" }, - "test.phased.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + "test.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" ] ], "vcf": [ @@ -34,7 +34,7 @@ { "id": "test" }, - "test.phased.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + "test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" ] ], "versions": [ @@ -46,7 +46,7 @@ "nf-test": "0.9.3", "nextflow": "25.10.2" }, - "timestamp": "2025-12-04T13:11:14.419732725" + "timestamp": "2025-12-08T10:09:39.439411781" }, "whatshap - phase - vcf": { "content": [ @@ -65,6 +65,6 @@ "nf-test": "0.9.3", "nextflow": "25.10.2" }, - "timestamp": "2025-12-04T13:11:09.397108709" + "timestamp": "2025-12-08T10:09:34.591009388" } } \ No newline at end of file