← Về thư mục
📄 / / profiles / r-and-d / raw_evidence / OpenAI4S / skills / bioskills / bio-variant-calling-joint-calling / references / usage-guide.md

Joint Calling - Usage Guide

Overview

Multi-sample joint genotyping combines information across samples for improved variant detection, consistent site calling, and eligibility for cohort-level filtering (VQSR/VETS). It is not the same operation as merging single-sample VCFs: joint genotyping borrows evidence across samples to rescue low-coverage het sites and produces a squared-off sample-by-site matrix where an unassessed cell (./.) is distinguishable from a confident hom-ref (0/0). The GVCF workflow also solves the N+1 problem, letting a new sample be added without re-calling the whole cohort.

Prerequisites

conda install -c bioconda gatk4

Quick Start

Tell your AI agent what you want to do: - "Set up joint calling for my cohort of 50 samples" - "Combine GVCFs and run GenotypeGVCFs" - "Scale joint calling for 1000+ samples by chromosome" - "Choose between CombineGVCFs and GenomicsDBImport" - "Add a new sample to my cohort without re-calling everyone" - "Joint call DeepVariant gVCFs with GLnexus instead of GATK" - "Explain why I should not just bcftools merge my single-sample VCFs"

Example Prompts

Small Cohort

"Combine these 10 sample GVCFs and run joint genotyping"

"Run CombineGVCFs followed by GenotypeGVCFs for my family trio"

Large Cohort

"Set up GenomicsDBImport for 500 samples, processing by chromosome"

"Create a sample map file and import into GenomicsDB"

GVCF Generation

"Generate GVCFs from all BAM files for joint calling"

"Run HaplotypeCaller in GVCF mode for each sample in the cohort"

Post-Processing

"Apply VQSR to my joint-called cohort VCF"

"Joint call my samples and then apply hard filters"

Scaling and Alternatives

"Shard GenomicsDBImport and GenotypeGVCFs by chromosome for my 5000-sample cohort"

"Reblock my gVCFs and use GnarlyGenotyper for a biobank-scale cohort"

"Run DeepVariant per sample and joint call with GLnexus DeepVariantWGS config"

What the Agent Will Do

  1. Generate per-sample GVCFs using HaplotypeCaller with -ERC GVCF
  2. Select appropriate combining method (CombineGVCFs vs GenomicsDBImport)
  3. Combine GVCFs across samples
  4. Run GenotypeGVCFs to produce the cohort VCF
  5. Apply VQSR or hard filtering based on cohort size
  6. Validate output with variant statistics

Tips

Why Joint Calling?

Workflow Overview

Sample BAMs -> HaplotypeCaller (GVCF mode) -> CombineGVCFs -> GenotypeGVCFs -> Cohort VCF

Step-by-Step

1. Generate per-sample GVCFs

gatk HaplotypeCaller \
    -R reference.fa \
    -I sample1.bam \
    -O sample1.g.vcf.gz \
    -ERC GVCF

2. Combine GVCFs

Option A: CombineGVCFs (small cohorts)

gatk CombineGVCFs \
    -R reference.fa \
    -V sample1.g.vcf.gz \
    -V sample2.g.vcf.gz \
    -V sample3.g.vcf.gz \
    -O combined.g.vcf.gz

Option B: GenomicsDBImport (large cohorts)

gatk GenomicsDBImport \
    -V sample1.g.vcf.gz \
    -V sample2.g.vcf.gz \
    -V sample3.g.vcf.gz \
    --genomicsdb-workspace-path genomicsdb \
    -L intervals.bed

3. Joint Genotyping

# From CombineGVCFs
gatk GenotypeGVCFs \
    -R reference.fa \
    -V combined.g.vcf.gz \
    -O cohort.vcf.gz

# From GenomicsDB
gatk GenotypeGVCFs \
    -R reference.fa \
    -V gendb://genomicsdb \
    -O cohort.vcf.gz

Scaling Tips

Cohort Size Method Notes
< 100 CombineGVCFs Simple, single command; portable plain gVCF
100-10,000 GenomicsDBImport Scalable, interval-based; shard by chromosome
> 10,000 ReblockGVCF + GnarlyGenotyper, or DeepVariant + GLnexus Naive GenotypeGVCFs stops scaling

Large Cohort Strategy

# Import by chromosome
for chr in {1..22} X Y; do
    gatk GenomicsDBImport \
        --sample-name-map samples.map \
        --genomicsdb-workspace-path genomicsdb_chr${chr} \
        -L chr${chr}
done

# Genotype by chromosome, then merge

Post-Processing

# Apply VQSR (requires large cohorts)
gatk VariantRecalibrator ...
gatk ApplyVQSR ...

# Or hard filter for small cohorts
gatk VariantFiltration \
    -V cohort.vcf.gz \
    --filter-expression "QD < 2.0" --filter-name "LowQD" \
    -O filtered.vcf.gz