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.
- [#219](https://github.com/nf-core/phaseimpute/pull/219) - Add genetic map support for `QUILT`.

### `Changed`

Expand Down
23 changes: 10 additions & 13 deletions subworkflows/local/bam_impute_quilt/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,24 @@ workflow BAM_IMPUTE_QUILT {
ch_hap_legend // channel: [ [panel, chr], hap, legend ]
ch_chunks // channel: [ [panel, chr], chr, start_coordinate, end_coordinate ]
ch_fasta // channel: [ [genome], fa, fai ]
ch_map // channel: [ [chr], genetic_map ]

main:

ch_versions = Channel.empty()

genetic_map_file = []
ch_versions = channel.empty()

ngen_params = params.ngen
buffer_params = params.buffer

ch_hap_chunks = ch_hap_legend
.combine(ch_chunks, by:0)
.map { it + ngen_params + buffer_params + [[]] }

if (!genetic_map_file.isEmpty()) {
// Add genetic map file (untested)
ch_hap_chunks = ch_hap_chunks
.map{it[0..-1]}
.join(genetic_map_file)
}

.map{ metaPC, hap, legend, chr, start, end ->
[metaPC.subMap("chr"), metaPC, hap, legend, chr, start, end]
}
.combine(ch_map, by:0)
.map{ _metaC, metaPC, hap, legend, chr, start, end, map ->
[metaPC, hap, legend, chr, start, end, ngen_params, buffer_params, map]
}
ch_quilt = ch_input
.combine(ch_hap_chunks)
.map {
Expand All @@ -46,7 +43,7 @@ workflow BAM_IMPUTE_QUILT {
// Annotate the variants
BCFTOOLS_ANNOTATE(QUILT_QUILT.out.vcf
.join(QUILT_QUILT.out.tbi)
.combine(Channel.of([[], [], [], []]))
.combine(channel.of([[], [], [], []]))
)
ch_versions = ch_versions.mix(BCFTOOLS_ANNOTATE.out.versions.first())

Expand Down
12 changes: 12 additions & 0 deletions subworkflows/local/bam_impute_quilt/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,18 @@ input:
type: file
description: FASTA index file of the reference genome
pattern: "*.fai"
- ch_map:
description: Channel with genetic map data
structure:
- meta:
type: map
description: |
Metadata map containing chromosome information
Need to have "chr" as chromosome name
- map:
type: file
description: Stitch format genetic map files
pattern: "*.map"
output:
- vcf_tbi:
description: Channel with imputed VCF files
Expand Down
47 changes: 29 additions & 18 deletions subworkflows/local/bam_impute_quilt/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ nextflow_workflow {
tag "bcftools/index"
tag "bcftools/annotate"

test("Impute with quilt two individuals with bamlist and no renaming") {
test("Impute with quilt two individuals with bamlist and no renaming no map") {
when {
workflow {
"""
Expand Down Expand Up @@ -52,28 +52,31 @@ nextflow_workflow {
[id: "GRCh38"],
file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz", checkIfExist:true)
]).collect()
input[4] = Channel.of([
[chr: "chr22"], []
])
"""
}
}
then {
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 },
workflow.out.vcf_tbi.collect{ path(it[1]).vcf.header.getGenotypeSamples().sort() },
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() }
)
}
}

test("Impute with quilt two individuals with bamlist and renaming") {
test("Impute with quilt two individuals with bamlist and renaming no map") {
when {
workflow {
"""
Expand Down Expand Up @@ -112,6 +115,9 @@ nextflow_workflow {
[id: "GRCh38"],
file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz", checkIfExist:true)
]).collect()
input[4] = Channel.of([
[chr: "chr22"], []
])
"""
}
}
Expand All @@ -120,21 +126,21 @@ 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 },
workflow.out.vcf_tbi.collect{ path(it[1]).vcf.header.getGenotypeSamples().sort() },
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() }
)
}
}

test("Impute with quilt one individuals") {
test("Impute with quilt one individuals with map") {
when {
workflow {
"""
Expand All @@ -160,6 +166,10 @@ nextflow_workflow {
[id: "GRCh38"],
file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz", checkIfExist:true)
]).collect()
input[4] = Channel.of([
[chr: "chr22"],
file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38_chr22.stitch.map", checkIfExist:true)
])
"""
}
}
Expand All @@ -168,14 +178,15 @@ 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 },
workflow.out.vcf_tbi.collect{ path(it[1]).vcf.header.getGenotypeSamples().sort() }
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() }
)
}
Expand Down
Loading