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

GATK CNVCaller fixes #472

Merged
merged 12 commits into from
Jan 10, 2024
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- ngsbits samplegender to check sex [#453](https://github.com/nf-core/raredisease/pull/453)
- New workflow for generating cgh files from SV vcfs for interpretation in the CytosSure interpretation software. Turned off by default [#456](https://github.com/nf-core/raredisease/pull/456/)
- Fastp to do adapter trimming. It can be skipped using `--skip_fastp` [#457](https://github.com/nf-core/raredisease/pull/457)
- GATK CNVCaller uses segments instead of intervals, filters out "reference" segments between the calls, and fixes a bug with how `ch_readcount_intervals` was handled

### `Changed`

Expand Down
5 changes: 5 additions & 0 deletions conf/modules/call_sv_germlinecnvcaller.config
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,10 @@ process {
ext.args = "--run-mode CASE"
ext.prefix = { "${meta.id}_${model.simpleName}" }
}

withName: '.*CALL_STRUCTURAL_VARIANTS:CALL_SV_GERMLINECNVCALLER:BCFTOOLS_VIEW' {
ext.prefix = { "${meta.id}_gatkcnv_segments_reffiltered" }
ext.args = { '--output-type z --exclude "N_ALT = 0" ' }
}
}
}
2 changes: 1 addition & 1 deletion subworkflows/local/call_structural_variants.nf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ workflow CALL_STRUCTURAL_VARIANTS {

if (!params.skip_germlinecnvcaller) {
CALL_SV_GERMLINECNVCALLER (ch_genome_bam_bai, ch_genome_fasta, ch_genome_fai, ch_readcount_intervals, ch_genome_dictionary, ch_ploidy_model, ch_gcnvcaller_model)
.genotyped_intervals_vcf
.genotyped_filtered_segments_vcf
.collect{it[1]}
.set { gcnvcaller_vcf }

Expand Down
24 changes: 18 additions & 6 deletions subworkflows/local/variant_calling/call_sv_germlinecnvcaller.nf
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@ include { GATK4_COLLECTREADCOUNTS } from '../../../modules/nf-core/g
include { GATK4_DETERMINEGERMLINECONTIGPLOIDY } from '../../../modules/nf-core/gatk4/determinegermlinecontigploidy/main.nf'
include { GATK4_GERMLINECNVCALLER } from '../../../modules/nf-core/gatk4/germlinecnvcaller/main.nf'
include { GATK4_POSTPROCESSGERMLINECNVCALLS } from '../../../modules/nf-core/gatk4/postprocessgermlinecnvcalls/main.nf'
include { BCFTOOLS_VIEW } from '../../../modules/nf-core/bcftools/view/main'
include { TABIX_TABIX } from '../../../modules/nf-core/tabix/tabix/main'

workflow CALL_SV_GERMLINECNVCALLER {
take:
ch_bam_bai // channel: [mandatory][ val(meta), path(bam), path(bai) ]
ch_fasta // channel: [mandatory][ val(meta), path(ch_fasta_no_meta) ]
ch_fai // channel: [mandatory][ val(meta), path(ch_fai) ]
ch_readcount_intervals // channel: [mandatory][ val(meta), path(bed), path(tbi) ]
ch_readcount_intervals // channel: [mandatory][ path(intervals) ]
ch_genome_dictionary // channel: [mandatory][ val(meta), path(ch_dict) ]
ch_ploidy_model // channel: [mandatory][ path(ch_ploidy_model) ]
ch_gcnvcaller_model // channel: [mandatory][ path(ch_gcnvcaller_model) ]

main:
ch_versions = Channel.empty()

input = ch_bam_bai.combine( ch_readcount_intervals.collect{ it[1] } )
input = ch_bam_bai.combine( ch_readcount_intervals )

GATK4_COLLECTREADCOUNTS ( input, ch_fasta, ch_fai, ch_genome_dictionary )

Expand All @@ -47,16 +49,26 @@ workflow CALL_SV_GERMLINECNVCALLER {

GATK4_POSTPROCESSGERMLINECNVCALLS ( ch_postproc_in )

TABIX_TABIX(GATK4_POSTPROCESSGERMLINECNVCALLS.out.segments)
GATK4_POSTPROCESSGERMLINECNVCALLS.out.segments
.join(TABIX_TABIX.out.tbi, failOnMismatch:true)
.set {ch_segments_in}
// Filter out reference only (0/0) segments
BCFTOOLS_VIEW (ch_segments_in , [], [], [] )

ch_versions = ch_versions.mix(GATK4_COLLECTREADCOUNTS.out.versions)
ch_versions = ch_versions.mix(GATK4_DETERMINEGERMLINECONTIGPLOIDY.out.versions)
ch_versions = ch_versions.mix(GATK4_GERMLINECNVCALLER.out.versions)
ch_versions = ch_versions.mix(GATK4_POSTPROCESSGERMLINECNVCALLS.out.versions)
ch_versions = ch_versions.mix(TABIX_TABIX.out.versions)
ch_versions = ch_versions.mix(BCFTOOLS_VIEW.out.versions)

emit:
genotyped_intervals_vcf = GATK4_POSTPROCESSGERMLINECNVCALLS.out.intervals // channel: [ val(meta), path(*.tar.gz) ]
genotyped_segments_vcf = GATK4_POSTPROCESSGERMLINECNVCALLS.out.segments // channel: [ val(meta), path(*.tar.gz) ]
denoised_vcf = GATK4_POSTPROCESSGERMLINECNVCALLS.out.denoised // channel: [ val(meta), path(*.tar.gz) ]
versions = ch_versions // channel: [ versions.yml ]
genotyped_intervals_vcf = GATK4_POSTPROCESSGERMLINECNVCALLS.out.intervals // channel: [ val(meta), path(*.vcf.gz) ]
genotyped_segments_vcf = GATK4_POSTPROCESSGERMLINECNVCALLS.out.segments // channel: [ val(meta), path(*.vcf.gz) ]
genotyped_filtered_segments_vcf = BCFTOOLS_VIEW.out.vcf // channel: [ val(meta), path(*.vcf.gz) ]
denoised_vcf = GATK4_POSTPROCESSGERMLINECNVCALLS.out.denoised // channel: [ val(meta), path(*.vcf.gz) ]
versions = ch_versions // channel: [ versions.yml ]
}

// This function groups calls with same meta for postprocessing.
Expand Down