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 realigned bam export possibilities to gatk4_haplotypecaller #864

Merged
merged 9 commits into from
Nov 24, 2022
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
5 changes: 3 additions & 2 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
},
"bcftools/mpileup": {
"branch": "master",
"git_sha": "6301e29d77e7ec7ce98b55b8a361b316a9a91bfe"
"git_sha": "6301e29d77e7ec7ce98b55b8a361b316a9a91bfe",
"installed_by": ["modules"]
},
"bcftools/sort": {
"branch": "master",
Expand Down Expand Up @@ -233,7 +234,7 @@
},
"gatk4/haplotypecaller": {
"branch": "master",
"git_sha": "7578005a576f3ac1b0d4f10c037dde34cdedfb67",
"git_sha": "9e9cd1dc1865ee28514c6435e02f1618c091ae20",
"installed_by": ["modules"]
},
"gatk4/intervallisttobed": {
Expand Down
9 changes: 6 additions & 3 deletions modules/nf-core/gatk4/haplotypecaller/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions modules/nf-core/gatk4/haplotypecaller/meta.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 28 additions & 2 deletions subworkflows/local/bam_variant_calling_haplotypecaller/main.nf
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
include { GATK4_MERGEVCFS as MERGE_HAPLOTYPECALLER } from '../../../modules/nf-core/gatk4/mergevcfs/main'
include { GATK4_HAPLOTYPECALLER } from '../../../modules/nf-core/gatk4/haplotypecaller/main'
include { BAM_JOINT_CALLING_GERMLINE_GATK } from '../bam_joint_calling_germline_gatk/main'
include { BAM_MERGE_INDEX_SAMTOOLS } from '../bam_merge_index_samtools/main'
include { VCF_VARIANT_FILTERING_GATK } from '../vcf_variant_filtering_gatk/main'
include { GATK4_HAPLOTYPECALLER } from '../../../modules/nf-core/gatk4/haplotypecaller/main'
include { GATK4_MERGEVCFS as MERGE_HAPLOTYPECALLER } from '../../../modules/nf-core/gatk4/mergevcfs/main'

workflow BAM_VARIANT_CALLING_HAPLOTYPECALLER {
take:
Expand Down Expand Up @@ -42,6 +43,11 @@ workflow BAM_VARIANT_CALLING_HAPLOTYPECALLER {
no_intervals: it[0].num_intervals <= 1
}.set{haplotypecaller_tbi_branch}

GATK4_HAPLOTYPECALLER.out.bam.branch{
intervals: it[0].num_intervals > 1
no_intervals: it[0].num_intervals <= 1
}.set{haplotypecaller_bam_branch}

if (params.joint_germline) {
// merge vcf and tbis
genotype_gvcf_to_call = Channel.empty().mix(GATK4_HAPLOTYPECALLER.out.vcf
Expand Down Expand Up @@ -100,6 +106,25 @@ workflow BAM_VARIANT_CALLING_HAPLOTYPECALLER {
MERGE_HAPLOTYPECALLER.out.tbi,
haplotypecaller_tbi_branch.no_intervals)

// BAM output
BAM_MERGE_INDEX_SAMTOOLS(
haplotypecaller_bam_branch.intervals
.map{ meta, bam ->

new_meta = [
id: meta.sample,
num_intervals: meta.num_intervals,
patient: meta.patient,
sample: meta.sample,
sex: meta.sex,
status: meta.status
]

[groupKey(new_meta, new_meta.num_intervals), bam]
}.groupTuple().mix(haplotypecaller_bam_branch.no_intervals))

realigned_bam = BAM_MERGE_INDEX_SAMTOOLS.out.bam_bai

VCF_VARIANT_FILTERING_GATK(haplotypecaller_vcf.join(haplotypecaller_tbi),
fasta,
fasta_fai,
Expand All @@ -117,4 +142,5 @@ workflow BAM_VARIANT_CALLING_HAPLOTYPECALLER {
emit:
versions = ch_versions
filtered_vcf
realigned_bam
}