-
Notifications
You must be signed in to change notification settings - Fork 950
New module: whatshap/phase #9431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
3c56c64
add whatshap phase module
HaidYi cba565f
change the vcf-specific test
HaidYi 9ae34b7
change test
HaidYi 8b7b28e
add versions
HaidYi 5f4e5f9
remove snapshot
HaidYi 3e8877d
update snapshot
HaidYi 42850a6
Update modules/nf-core/whatshap/phase/tests/main.nf.test
HaidYi 3a6669e
rm unused args
HaidYi da32314
add snapshot
HaidYi 1bb9011
add ontologies
HaidYi 750d314
update the snapshot
HaidYi cf6027f
add versions to snapshot
HaidYi 7f4c538
fix stub issues
HaidYi 4a179d0
update the test and snap
HaidYi 27072da
fix format with "nextflow lint"
HaidYi 4b305ac
Merge branch 'master' into whatshap
famosab 995b911
fix hardcoded name and file name ambiguity problem
HaidYi 69e7c5e
Merge branch 'master' into whatshap
famosab File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| 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("*.vcf.gz"), emit: vcf | ||
| tuple val(meta), path("*.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}" | ||
|
|
||
| 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}.vcf \\ | ||
| --reference ${fasta} \\ | ||
| ${args} \\ | ||
| ${vcf} \\ | ||
| ${bam} | ||
|
|
||
| bgzip ${prefix}.vcf | ||
| tabix -p vcf ${prefix}.vcf.gz | ||
|
|
||
| cat <<-END_VERSIONS > versions.yml | ||
| "${task.process}": | ||
| whatshap: \$(whatshap --version 2>&1 | sed 's/whatshap //g') | ||
| END_VERSIONS | ||
| """ | ||
|
|
||
| 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}.vcf.gz | ||
| touch ${prefix}.vcf.gz.tbi | ||
|
|
||
| cat <<-END_VERSIONS > versions.yml | ||
| "${task.process}": | ||
| whatshap: \$(whatshap --version 2>&1 | sed 's/whatshap //g') | ||
| END_VERSIONS | ||
| """ | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| # 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 ]` | ||
| - "*.vcf.gz": | ||
| type: file | ||
| description: Bgzipped phased VCF file | ||
| pattern: "*.vcf.gz" | ||
| ontologies: | ||
| - edam: http://edamontology.org/format_3989 # GZIP format | ||
| tbi: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. `[ id:'sample1', single_end:false ]` | ||
| - "*.vcf.gz.tbi": | ||
| type: file | ||
| description: Phased VCF index file | ||
| pattern: "*.vcf.gz.tbi" | ||
| ontologies: | ||
| - edam: http://edamontology.org/format_3616 # TBI format | ||
| 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| 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( | ||
| path(process.out.vcf.get(0).get(1)).vcf.summary, | ||
| path(process.out.vcf.get(0).get(1)).vcf.variantsMD5, | ||
HaidYi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| process.out.versions, | ||
| path(process.out.versions[0]).yaml, | ||
| ).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() } | ||
| ) | ||
| } | ||
|
|
||
| } | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| { | ||
| "whatshap - phase - vcf - stub": { | ||
| "content": [ | ||
| { | ||
| "0": [ | ||
| [ | ||
| { | ||
| "id": "test" | ||
| }, | ||
| "test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" | ||
| ] | ||
| ], | ||
| "1": [ | ||
| [ | ||
| { | ||
| "id": "test" | ||
| }, | ||
| "test.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" | ||
| ] | ||
| ], | ||
| "2": [ | ||
| "versions.yml:md5,eebecfb3d7f284fc7d11c67978bf1994" | ||
| ], | ||
| "tbi": [ | ||
| [ | ||
| { | ||
| "id": "test" | ||
| }, | ||
| "test.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" | ||
| ] | ||
| ], | ||
| "vcf": [ | ||
| [ | ||
| { | ||
| "id": "test" | ||
| }, | ||
| "test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" | ||
| ] | ||
| ], | ||
| "versions": [ | ||
| "versions.yml:md5,eebecfb3d7f284fc7d11c67978bf1994" | ||
| ] | ||
| } | ||
| ], | ||
| "meta": { | ||
| "nf-test": "0.9.3", | ||
| "nextflow": "25.10.2" | ||
| }, | ||
| "timestamp": "2025-12-08T10:09:39.439411781" | ||
| }, | ||
| "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.3", | ||
| "nextflow": "25.10.2" | ||
| }, | ||
| "timestamp": "2025-12-08T10:09:34.591009388" | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.