domains / science / variant-calling / variant-calling
The two skills cover the same core task (calling variants from BAMs with bcftools) but differ in scope and critical guidance. The first copy is a procedural reference for bcftools commands, options, and pipelines. The second copy is a strategic guide that emphasizes engine selection (bcftools vs. GATK vs. DeepVariant vs. DRAGEN), explains the 'Governing Principle' of position-based vs. local-reassembly callers, and includes version compatibility checks. The second copy explicitly states it is not for joint calling or somatic detection, while the first copy provides detailed command-line examples for multi-sample and parallel calling that the second copy omits or defers to other skills. Combining them provides both the strategic decision-making framework and the specific execution details.
| Repository | Path |
|---|---|
| FreedomIntelligence/OpenClaw-Medical-Skills | skills/variant-interpretation-acmg/bioSkills/variant-calling/SKILL.md |
| GPTomics/bioSkills | variant-calling/variant-calling/SKILL.md |
| Role | Repository | Path |
|---|---|---|
| peer | FreedomIntelligence/OpenClaw-Medical-Skills | skills/variant-interpretation-acmg/bioSkills/variant-calling/SKILL.md |
| peer | GPTomics/bioSkills | variant-calling/variant-calling/SKILL.md |
# Variant Calling
## 1. Engine Selection
Before running commands, select the appropriate caller based on the analysis goal:
- **bcftools mpileup|call**: Best for simple germline SNPs, non-model organisms, organelle/haploid genomes, and quick exploratory scans. Fast and simple.
- **GATK HaplotypeCaller**: Best for auditable human WGS/WES and joint calling workflows.
- **DeepVariant**: Best for indels and difficult regions (MHC, segdups) and non-Illumina platforms (PacBio/ONT).
- **DRAGEN**: Best for maximum throughput on Illumina data.
*Note: bcftools is weaker on indels in homopolymers/STRs and low-mappability regions. For these, prefer reassembly or deep-learning callers.*
## 2. Version Compatibility
Verify `bcftools --version` (tested with 1.19+). If flags fail, check `--help` for the installed version.
## 3. Basic Workflow (bcftools)
```bash
# Basic SNP/Indel Calling
bcftools mpileup -f reference.fa input.bam | bcftools call -mv -o variants.vcf
# Compressed Output
bcftools mpileup -f reference.fa input.bam | bcftools call -mv -Oz -o variants.vcf.gz
bcftools index variants.vcf.gz
```
## 4. Advanced Options
### Quality Filtering
```bash
bcftools mpileup -f reference.fa -q 20 -Q 20 input.bam | bcftools call -mv -o variants.vcf
```
### Annotations
```bash
# Add Depth and Allelic Depth
bcftools mpileup -f reference.fa -a FORMAT/DP,FORMAT/AD input.bam | bcftools call -mv -o variants.vcf
```
### Ploidy
```bash
# Haploid (e.g., organelles, Y-chromosome)
bcftools mpileup -f reference.fa input.bam | bcftools call -m --ploidy 1 -o variants.vcf
```
### Region Calling
```bash
# Specific region
bcftools mpileup -f reference.fa -r chr1:1000000-2000000 input.bam | bcftools call -mv -o region.vcf
# BED file
bcftools mpileup -f reference.fa -R targets.bed input.bam | bcftools call -mv -o targets.vcf
```
## 5. Multi-Sample and Parallel Calling
```bash
# Multi-sample
bcftools mpileup -f reference.fa sample1.bam sample2.bam | bcftools call -mv -Oz -o cohort.vcf.gz
# Parallel by chromosome
for chr in chr1 chr2 chr3; do
bcftools mpileup -Ou -f reference.fa -r "$chr" input.bam | \
bcftools call -mv -Oz -o "${chr}.vcf.gz" &
done
wait
bcftools concat -Oz -o all.vcf.gz chr*.vcf.gz
bcftools index all.vcf.gz
```
## 6. Performance
```bash
# Multi-threading
bcftools mpileup -f reference.fa --threads 4 input.bam | bcftools call -mv --threads 4 -o variants.vcf
# Uncompressed BCF for speed in pipeline
bcftools mpileup -Ou -f reference.fa input.bam | bcftools call -mv -Ou | bcftools filter -Oz -o filtered.vcf.gz
```