6: Germline Short Variant Calling with GATK4 & DeepVariant
Chapter 6: Germline Short Variant Calling with GATK4 & DeepVariant
Identifying single nucleotide polymorphisms (SNPs) and small insertions/deletions (indels) from aligned sequencing data is the cornerstone of clinical genetics and population genomics. The Broad Institute's GATK4 (Genome Analysis Toolkit) Best Practices pipeline represents the internationally standardized protocol for germline variant discovery.
Calling variants on samples individually introduces reference bias and makes it impossible to distinguish between a homozygous reference call and an unsequenced (zero-coverage) position. Under the Joint Genotyping paradigm, each sample is called independently in GVCF mode (recording genotype likelihoods across all positions, including monomorphic sites). Subsequently, all samples are genotyped jointly, allowing weak biological evidence in one sample to be bolstered by shared evidence across the cohort.
1. GATK4 Best Practices Workflow Execution
# Step 1: Base Quality Score Recalibration (BQSR)
gatk BaseRecalibrator \
-R GRCh38.fasta \
-I sample1.marked_dup.bam \
--known-sites dbsnp_146.hg38.vcf.gz \
--known-sites Mills_and_1000G_gold_standard.indels.hg38.vcf.gz \
-O sample1.recal_data.table
gatk ApplyBQSR \
-R GRCh38.fasta \
-I sample1.marked_dup.bam \
--bqsr-recal-file sample1.recal_data.table \
-O sample1.recalibrated.bam
# Step 2: HaplotypeCaller in GVCF Mode (-ERC GVCF)
gatk HaplotypeCaller \
-R GRCh38.fasta \
-I sample1.recalibrated.bam \
-O sample1.g.vcf.gz \
-ERC GVCF \
--native-pair-hmm-threads 8
# Step 3: Import Cohort GVCFs into GenomicsDB (High-performance tile storage)
gatk GenomicsDBImport \
--genomicsdb-workspace-path cohort_genomics_db \
-L chr22 \
--sample-name-map sample_map.tsv
# Step 4: Joint Genotype Across the Cohort
gatk GenotypeGVCFs \
-R GRCh38.fasta \
-V gendb://cohort_genomics_db \
-O cohort_raw_variants.vcf.gz2. Standard GATK Hard Filtering for Small Cohorts
# Filter SNPs using recommended thresholds
gatk VariantFiltration \
-R GRCh38.fasta \
-V cohort_raw_snps.vcf.gz \
-O cohort_filtered_snps.vcf.gz \
--filter-expression "QD < 2.0 || FS > 60.0 || MQ < 40.0 || MQRankSum < -12.5 || ReadPosRankSum < -8.0 || SOR > 3.0" \
--filter-name "SNP_HARD_FILTER"3. Deep Learning Variant Discovery with DeepVariant
Google's DeepVariant reimagines variant calling as a computer vision problem. It converts local alignments around candidate loci into multi-channel tensor images (encoding read base, quality, strand, and mismatch) and classifies genotypes using a convolutional neural network (CNN), outperforming heuristic callers in challenging regions.
Common Pitfalls & Troubleshooting Checklist
- Java Heap Exhaustion (GATK / Picard): If processes terminate with
java.lang.OutOfMemoryError, set your environment variable explicitly:export _JAVA_OPTIONS="-Xmx16g -Djava.io.tmpdir=/tmp". - Index Timestamp Mismatch: If tools complain that a BAM index is missing or out of date, regenerate with
samtools index -@ 4 sample.bam. - Conda Channel Conflicts: Avoid ABI incompatibilities between bioconda and conda-forge by setting strict priority:
conda config --set channel_priority strict. - Chromosome Naming Contamination: Always verify whether reference FASTA headers use
chr1or1; divergent naming causes silent alignment drops.