Skip to content
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

Add chunk_model as parameter #157

Merged
merged 7 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Initial release of nf-core/phaseimpute, created with the [nf-core](https://nf-co
- [#148](https://github.com/nf-core/phaseimpute/pull/148) - Fix awsfulltest github action for manual dispatch
- [#149](https://github.com/nf-core/phaseimpute/pull/149) - Remove the map file from the awsfulltest
- [#152](https://github.com/nf-core/phaseimpute/pull/152) - Fix URLs in the documentation and remove tools citation in the README, use a white background for all images in the documentation.
- [#157](https://github.com/nf-core/phaseimpute/pull/157) - Add `chunk_model` as parameter for better control over `GLIMPSE2_CHUNK` and set window size in `GLIMPSE1_CHUNK` and `GLIMPSE2_chunk` to 4mb to reduce number of chunks (empirical).

### `Fixed`

Expand Down
15 changes: 9 additions & 6 deletions conf/steps/panel_prep.config
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ process {
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_NORMALIZE_BCFTOOLS:BCFTOOLS_NORM' {
ext.args = ["-m +any", "--no-version", "--output-type z", "--write-index=tbi"].join(' ')
ext.prefix = { "${meta.id}_${meta.chr}_multiallelic" }
ext.args = ["-m +any", "--no-version", "--output-type z", "--write-index=tbi"].join(' ')
ext.prefix = { "${meta.id}_${meta.chr}_multiallelic" }
publishDir = [ enabled: false ]
}

Expand All @@ -62,7 +62,7 @@ process {
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_NORMALIZE_BCFTOOLS:VCFLIB_VCFFIXUP' {
ext.prefix = { "${meta.id}_${meta.chr}_fixup" }
ext.prefix = { "${meta.id}_${meta.chr}_fixup" }
publishDir = [
path: { "${params.outdir}/prep_panel/panel" },
mode: params.publish_dir_mode,
Expand All @@ -72,7 +72,7 @@ process {
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_NORMALIZE_BCFTOOLS:BCFTOOLS_INDEX' {
ext.args = "--tbi"
ext.args = "--tbi"
publishDir = [
path: { "${params.outdir}/prep_panel/panel" },
mode: params.publish_dir_mode,
Expand All @@ -88,6 +88,7 @@ process {
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_PHASE_SHAPEIT5:GLIMPSE2_CHUNK' {
ext.args = "--window-mb 4"
ext.prefix = { "${meta.id}_chunks" }
}

Expand Down Expand Up @@ -123,7 +124,7 @@ process {
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_SITES_EXTRACT_BCFTOOLS:BCFTOOLS_CONVERT' {
ext.args = {"--haplegendsample ${meta.id}_${meta.chr}"}
ext.args = {"--haplegendsample ${meta.id}_${meta.chr}"}
publishDir = [
path: { "${params.outdir}/prep_panel/haplegend/" },
mode: params.publish_dir_mode,
Expand Down Expand Up @@ -184,6 +185,7 @@ process {
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_CHUNK_GLIMPSE:GLIMPSE_CHUNK' {
ext.args = "--window-size 4"
atrigila marked this conversation as resolved.
Show resolved Hide resolved
ext.prefix = { "${meta.id}_${meta.chr}_chunks_glimpse1" }
publishDir = [
path: { "${params.outdir}/prep_panel/chunks/glimpse1/" },
Expand All @@ -194,7 +196,8 @@ process {
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_CHUNK_GLIMPSE:GLIMPSE2_CHUNK' {
ext.prefix = { "${meta.id}_${meta.chr}_chunks_glimpse2" }
ext.args = "--window-mb 4"
ext.prefix = { "${meta.id}_${meta.chr}_chunks_glimpse2" }
publishDir = [
path: { "${params.outdir}/prep_panel/chunks/glimpse2/" },
mode: params.publish_dir_mode,
Expand Down
1 change: 1 addition & 0 deletions conf/test_all.config
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ params {
phase = true
normalize = true
compute_freq = false
chunk_model = "recursive"

// Pipeline steps
steps = "all"
Expand Down
1 change: 1 addition & 0 deletions conf/test_dog.config
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ params {
normalize = false
compute_freq = false
rename_chr = true
chunk_model = "recursive"

// Input data
input = params.pipelines_testdata_base_path + "dog_data/csv/sample_dog.csv"
Expand Down
1 change: 1 addition & 0 deletions conf/test_panelprep.config
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ params {
normalize = true
compute_freq = true
remove_samples = "HG00096,HG00097,HG00099,HG00100"
chunk_model = "recursive"

// Pipeline steps
steps = "panelprep"
Expand Down
3 changes: 2 additions & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
params {

// steps
steps = null
steps = null

// Input options
input = null
Expand All @@ -24,6 +24,7 @@ params {
normalize = true
compute_freq = false
remove_samples = null
chunk_model = 'sequential'
LouisLeNezet marked this conversation as resolved.
Show resolved Hide resolved

// ChrCheck parameters
rename_chr = false
Expand Down
7 changes: 7 additions & 0 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@
"binaryref": {
"type": "string",
"description": "Whether to generate a binary reference file to be used with GLIMPSE2"
},
"chunk_model": {
"type": "string",
"description": "Model type to use for GLIMPSE2_CHUNK",
"enum": ["recursive", "sequential", "uniform-number-variants"],
LouisLeNezet marked this conversation as resolved.
Show resolved Hide resolved
"default": "sequential",
"hidden": true
}
}
},
Expand Down
4 changes: 1 addition & 3 deletions subworkflows/local/vcf_chunk_glimpse/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ workflow VCF_CHUNK_GLIMPSE {
take:
ch_reference // channel: [ [panel, chr], vcf, csi ]
ch_map // channel (optional): [ [chr], map ]
chunk_model // channel : model

main:

Expand Down Expand Up @@ -36,9 +37,6 @@ workflow VCF_CHUNK_GLIMPSE {
)
.map { metaPC, it -> [metaPC, it["RegionIn"], it["RegionOut"]]}

// Make chunks with Glimpse2 (does not work with "sequential" mode)
chunk_model = "recursive"

ch_input_glimpse2 = ch_vcf_csi_chr
.map{
metaPC, vcf, csi, chr -> [metaPC.subMap("chr"), metaPC, vcf, csi, chr]
Expand Down
2 changes: 2 additions & 0 deletions subworkflows/local/vcf_chunk_glimpse/tests/main.nf.test
LouisLeNezet marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ nextflow_workflow {
file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38_21.map", checkIfExist:true)
]
)
input[2] = "recursive"
"""
}
}
Expand Down Expand Up @@ -87,6 +88,7 @@ nextflow_workflow {
[[chr: "chr22"], []],
[[chr: "chr21"], []]
)
input[2] = "recursive"
"""
}
}
Expand Down
10 changes: 4 additions & 6 deletions subworkflows/local/vcf_phase_shapeit5/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@ include { BCFTOOLS_INDEX as VCF_BCFTOOLS_INDEX_2 } from '../../../modules/nf-cor
workflow VCF_PHASE_SHAPEIT5 {

take:
ch_vcf // channel (mandatory): [ [id, chr], vcf, csi, pedigree ]
ch_vcf // channel (mandatory) : [ [id, chr], vcf, csi, pedigree ]
ch_region // channel (mandatory) : [ [chr, region], region ]
ch_ref // channel (optional) : [ [id, chr], ref, csi ]
ch_scaffold // channel (optional) : [ [id, chr], scaffold, csi ]
ch_ref // channel (optional) : [ [id, chr], ref, csi ]
ch_scaffold // channel (optional) : [ [id, chr], scaffold, csi ]
ch_map // channel (mandatory) : [ [chr], map]
chunk_model // channel (mandatory) : [ model ]

main:

ch_versions = Channel.empty()

// Make chunks with Glimpse2 (does not work with "sequential" mode)
chunk_model = "recursive"

// Chunk with Glimpse2
ch_input_glimpse2 = ch_vcf
.map{
Expand Down
2 changes: 2 additions & 0 deletions subworkflows/local/vcf_phase_shapeit5/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ nextflow_workflow {
[[chr: "chr22"],[]],
[[chr: "chr21"], []]
)
input[5] = "recursive"
"""
}
}
Expand Down Expand Up @@ -103,6 +104,7 @@ nextflow_workflow {
[ [chr: "chr22"], file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38_22.map", checkIfExist:true)],
[ [chr: "chr21"], file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38_21.map", checkIfExist:true)]
)
input[5] = "recursive"
"""
}
}
Expand Down
5 changes: 3 additions & 2 deletions workflows/phaseimpute/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,15 @@ workflow PHASEIMPUTE {
ch_region,
[[],[],[]],
[[],[],[]],
ch_map
ch_map,
params.chunk_model
)
ch_panel_phased = VCF_PHASE_SHAPEIT5.out.vcf_tbi
ch_versions = ch_versions.mix(VCF_PHASE_SHAPEIT5.out.versions)
}

// Create chunks from reference VCF
VCF_CHUNK_GLIMPSE(ch_panel_phased, ch_map)
VCF_CHUNK_GLIMPSE(ch_panel_phased, ch_map, params.chunk_model)
LouisLeNezet marked this conversation as resolved.
Show resolved Hide resolved
ch_versions = ch_versions.mix(VCF_CHUNK_GLIMPSE.out.versions)

// Assign chunks channels
Expand Down
Loading