Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#188](https://github.com/nf-core/phaseimpute/pull/188) - Add documentation for all subworkflows.
- [#210](https://github.com/nf-core/phaseimpute/pull/200) - Add BEAGLE5 support for genotype imputation.
- [#211](https://github.com/nf-core/phaseimpute/pull/211) - Add MINIMAC4 support for genotype imputation.
- [#223](https://github.com/nf-core/phaseimpute/pull/223) - Add genetic map support for `SHAPEIT5`.

### `Changed`

Expand Down
25 changes: 13 additions & 12 deletions subworkflows/local/vcf_phase_shapeit5/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ workflow VCF_PHASE_SHAPEIT5 {

main:

ch_versions = Channel.empty()
ch_versions = channel.empty()

// Chunk with Glimpse2
ch_input_glimpse2 = ch_vcf
.map{
metaIC, vcf, csi, _pedigree -> [metaIC.subMap("chr"), metaIC, vcf, csi]
}
.combine(ch_region.map{ metaCR, region -> [metaCR.subMap("chr"), region]}, by:0)
.join(ch_map)
.combine(ch_map, by:0)
.map{
_metaC, metaIC, vcf, csi, region, gmap -> [metaIC, vcf, csi, region, gmap]
}
Expand Down Expand Up @@ -64,16 +64,17 @@ workflow VCF_PHASE_SHAPEIT5 {
.join(VCF_BCFTOOLS_INDEX_1.out.csi, failOnMismatch:true, failOnDuplicate:true)
.map{ meta, vcf, csi -> [meta.subMap("id", "chr"), [vcf, meta.chunk], csi]}
.groupTuple()
.map{ meta, vcf, csi ->
[ meta,
vcf
.sort { a, b ->
def aStart = a.last().split("-")[-1].toInteger()
def bStart = b.last().split("-")[-1].toInteger()
aStart <=> bStart
}
.collect{it.first()},
csi]}
.map{ meta, vcf, csi -> [
meta,
vcf
.sort { a, b ->
def aStart = a.last().split("-")[-1].toInteger()
def bStart = b.last().split("-")[-1].toInteger()
aStart <=> bStart
}
.collect{ file -> file.first() },
csi
]}

SHAPEIT5_LIGATE(ch_ligate_input)
ch_versions = ch_versions.mix(SHAPEIT5_LIGATE.out.versions.first())
Expand Down
8 changes: 5 additions & 3 deletions subworkflows/local/vcf_phase_shapeit5/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,16 @@ input:
description: VCF index file
pattern: "*.{tbi,csi}"
- ch_map:
description: Channel with genetic map data (optional)
description: Channel with genetic map data
structure:
- meta:
type: map
description: Metadata map
description: |
Metadata map containing chromosome information
Need to have "chr" as chromosome name
- map:
type: file
description: Map file
description: Glimpse format genetic map files
pattern: "*.map"
- chunk_model:
description: Chunk model for Glimpse2
Expand Down
49 changes: 19 additions & 30 deletions subworkflows/local/vcf_phase_shapeit5/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ nextflow_workflow {

test("Phase vcf with regions, no map, no ref, no scaffold, recursive model") {
when {
params {
max_cpus = 2
max_memory = '2.GB'
}
workflow {
"""
input[0] = Channel.of(
Expand Down Expand Up @@ -61,15 +57,14 @@ nextflow_workflow {
assertAll(
{ assert workflow.success },
{ assert snapshot(
workflow.out.versions,
workflow.out.vcf_tbi.collect{[
it[0],
path(it[1]).getFileName().toString(),
path(it[2]).getFileName().toString()
] },
workflow.out.vcf_tbi.collect{
path(it[1]).vcf.summary
},
path(it[2]).getFileName().toString(),
path(it[1]).vcf.summary,
path(it[1]).vcf.header.getGenotypeSamples().sort(),
path(it[1]).vcf.variantsMD5
]},
workflow.out.versions.collect{ path(it).yaml }
).match() },
{ workflow.out.vcf_tbi.collect{
Expand All @@ -81,10 +76,6 @@ nextflow_workflow {

test("Phase vcf with regions, no map, no ref, no scaffold, sequential model") {
when {
params {
max_cpus = 2
max_memory = '2.GB'
}
workflow {
"""
input[0] = Channel.of(
Expand Down Expand Up @@ -120,15 +111,14 @@ nextflow_workflow {
assertAll(
{ assert workflow.success },
{ assert snapshot(
workflow.out.versions,
workflow.out.vcf_tbi.collect{[
it[0],
path(it[1]).getFileName().toString(),
path(it[2]).getFileName().toString()
] },
workflow.out.vcf_tbi.collect{
path(it[1]).vcf.summary
},
path(it[2]).getFileName().toString(),
path(it[1]).vcf.summary,
path(it[1]).vcf.header.getGenotypeSamples().sort(),
path(it[1]).vcf.variantsMD5
]},
workflow.out.versions.collect{ path(it).yaml }
).match() },
{ workflow.out.vcf_tbi.collect{
Expand All @@ -138,13 +128,8 @@ nextflow_workflow {
}
}

/* TODO: Fix this test with https://github.com/odelaneau/shapeit5/issues/96
test("Phase vcf with regions, with map, no ref, no scaffold") {
when {
params {
max_cpus = 2
max_memory = '2.GB'
}
workflow {
"""
input[0] = Channel.of(
Expand Down Expand Up @@ -180,13 +165,17 @@ nextflow_workflow {
assertAll(
{ assert workflow.success },
{ assert snapshot(
workflow.out,
workflow.out.vcf_tbi.collect{
path(it[1]).vcf.summary
},
workflow.out.vcf_tbi.collect{[
it[0],
path(it[1]).getFileName().toString(),
path(it[2]).getFileName().toString(),
path(it[1]).vcf.summary,
path(it[1]).vcf.header.getGenotypeSamples().sort(),
path(it[1]).vcf.variantsMD5
]},
workflow.out.versions.collect{ path(it).yaml }
).match() }
)
}
}*/
}
}
Loading