Skip to content

Commit

Permalink
Fix variant calling with deepvariant that outputs non-allowed variant…
Browse files Browse the repository at this point in the history
…s for hapcut2
  • Loading branch information
pontushojer committed Jan 13, 2023
1 parent 2fa2b21 commit 90a38f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/blr/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,7 @@ rule call_variants:
" --output_vcf={output.vcf}"
" --reads={input.bam}"
" --ref={params.reference}"
" 2> {log}"
}
shell(commands[config["variant_caller"]])

Expand Down Expand Up @@ -995,7 +996,14 @@ rule filter_vcfs:
input:
vcf = "chunks/{base}.variants.called.{type}.filtered.vcf"
shell:
"bcftools view -f 'PASS' {input.vcf} > {output.vcf}"
"bcftools view"
# Only heterozygous
" -g het"
# Only keep genotypes that hapcut2 accepts. I.e. in {0, 1, 2}
# Mainly filters variants from DeepVariant
" -i 'GT == \"0/1\" || GT == \"0/2\" || GT == \"1/2\"'"
" -f 'PASS'"
" {input.vcf} > {output.vcf}"


rule merge_filtered_snps_indels:
Expand Down
1 change: 1 addition & 0 deletions src/blr/rules/phasing.smk
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ rule hapcut2_extracthairs:
"extractHAIRS"
" --10X 1"
" --indels {params.indels}"
# TODO - test to include option `--triallelic` to include GT 1/2
" --realign_variants 1" # Improves overall error-rate
" --ref {params.reference}"
" --bam {input.bam}"
Expand Down

0 comments on commit 90a38f8

Please sign in to comment.