[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EGHZZ5BBY969GECJVT2Y72":3,"skill-same:01M7EGHZZ5BBY969GECJVT2Y72":86},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":51,"commitSha":52,"skillDirectory":53,"forksCount":14,"repositoryHtmlUrl":54,"repositoryHomepageUrl":54,"ownerHtmlUrl":55,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":56,"install":57,"resources":69},"01M7EGHZZ5BBY969GECJVT2Y72","bio-workflows-fastq-to-variants",null,"Orchestrates the end-to-end germline short-variant pipeline from FASTQ to a filtered, normalized, benchmarked VCF, chaining QC\u002Ftrim, BWA-MEM2 alignment, duplicate marking, optional BQSR, calling (bcftools\u002FGATK HaplotypeCaller\u002FDeepVariant\u002FDRAGEN), normalization, site+genotype filtering, annotation, and hap.py\u002Fvcfeval benchmarking. Use when deciding the pipeline-wide reference-genome commitment (GRCh38 analysis set vs T2T, ALT\u002Fdecoy handling), sequencing the steps in the defensible order (normalize BEFORE annotate, filter site- then genotype-level), choosing the calling engine and single-sample vs cohort joint-calling, picking a filtering strategy by cohort size, or benchmarking stratified within GIAB confident regions. Hands off mechanism to the variant-calling and read-alignment component skills; not a re-teach of any single step.","Mr-Nobody-Anonymous\u002FAll-skills","Mr-Nobody-Anonymous","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F184253119?v=4","01M7AEXFJHKTYQW5R0ZCQQTWFV","anonymous","01M7C00M3GQR4QKP9GZA42GFAK",0,"MIT","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-workflows-fastq-to-variants\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bio-workflows-fastq-to-variants\ndescription: Orchestrates the end-to-end germline short-variant pipeline from FASTQ to a filtered, normalized, benchmarked VCF, chaining QC\u002Ftrim, BWA-MEM2 alignment, duplicate marking, optional BQSR, calling (bcftools\u002FGATK HaplotypeCaller\u002FDeepVariant\u002FDRAGEN), normalization, site+genotype filtering, annotation, and hap.py\u002Fvcfeval benchmarking. Use when deciding the pipeline-wide reference-genome commitment (GRCh38 analysis set vs T2T, ALT\u002Fdecoy handling), sequencing the steps in the defensible order (normalize BEFORE annotate, filter site- then genotype-level), choosing the calling engine and single-sample vs cohort joint-calling, picking a filtering strategy by cohort size, or benchmarking stratified within GIAB confident regions. Hands off mechanism to the variant-calling and read-alignment component skills; not a re-teach of any single step.\ntool_type: cli\nprimary_tool: bcftools\nworkflow: true\ndepends_on:\n  - read-qc\u002Ffastp-workflow\n  - read-alignment\u002Fbwa-alignment\n  - alignment-files\u002Falignment-sorting\n  - alignment-files\u002Fduplicate-handling\n  - variant-calling\u002Fvariant-calling\n  - variant-calling\u002Fjoint-calling\n  - variant-calling\u002Fvariant-normalization\n  - variant-calling\u002Ffiltering-best-practices\n  - variant-calling\u002Fvariant-annotation\n  - variant-calling\u002Fvcf-statistics\nqc_checkpoints:\n  - after_qc: \"Q30 >85%, adapter content \u003C1%\"\n  - after_alignment: \"Mapping rate >95%, properly paired >90%\"\n  - after_dedup: \"Duplication rate \u003C30% for WGS, \u003C50% for exome\"\n  - after_calling: \"Ti\u002FTv ratio ~2.0-2.1 for WGS, ~3.0-3.3 for exome; dbSNP overlap >95% only after annotating the ID column\"\nsource: \"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills\"\nsource_repository: \"GPTomics\u002FbioSkills\"\nsource_path: \"workflows\u002Ffastq-to-variants\u002FSKILL.md\"\nlicense: \"MIT\"\nimported_at: \"2026-09-20\"\n---\n\n## Version Compatibility\n\nReference examples tested with: BWA-MEM2 2.2.1+, GATK 4.5+, bcftools 1.19+, samtools 1.19+, fastp 0.23+, DeepVariant 1.6+, hap.py 0.3.15+, Ensembl VEP 111+\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- CLI: `\u003Ctool> --version` then `\u003Ctool> --help` to confirm flags\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed\npackage and adapt the example to match the actual API rather than retrying.\n\nNote: GenotypeGVCFs defaults (`--max-alternate-alleles`, `--heterozygosity`, `--stand-call-conf`), the GATK hard-filter thresholds, and DRAGEN speed\u002Faccuracy figures drift by version\u002Fvendor; confirm in-tool and against current GIAB benchmarks before quoting.\n\n# FASTQ to Variants Workflow\n\n**\"Call variants from my whole-genome or exome FASTQ files\"** -> Chain QC\u002Ftrim, alignment, duplicate marking, an engine-appropriate caller, normalization, filtering, annotation, and benchmarking into one filtered germline VCF.\n- CLI: fastp -> bwa-mem2 -> samtools markdup -> (bcftools | gatk HaplotypeCaller | DeepVariant) -> bcftools norm -> filter -> VEP -> hap.py\n\nThis is a workflow skill: it owns the chaining decisions and hand-offs, not the internals of any one step. Every step below cross-references the component skill that teaches its mechanism.\n\n## The governing principle\n\nA germline pipeline is a chain of commitments, and the two that decide whether the callset is trustworthy are made at the seams between steps, not inside them.\n\n1. **The reference is a pipeline-wide commitment made once and inherited by everything downstream.** The build and analysis set chosen at alignment (step 2) fix the coordinates of every later comparison: the dbSNP\u002FClinVar\u002FgnomAD records annotation matches against, the truth BED benchmarking scores within, and the cohort other samples are joint-called with must all be the SAME build. Changing it later means redoing alignment, calling, normalization, and annotation. Decide before aligning a single read.\n2. **The step order is not arbitrary; two orderings sink reviews.** (a) **Normalize BEFORE annotate.** An indel that is not left-aligned to the database's canonical position is one base off, so the annotator silently misses the ClinVar\u002FgnomAD record and reports a pathogenic variant as novel-absent -- a patient-safety failure that throws no error. (b) **Never `bcftools merge` single-sample VCFs into a cohort.** Absence of a record is then read as homozygous reference, fabricating genotypes; joint-genotype per-sample gVCFs instead so \"confident hom-ref\" is distinguished from \"no data.\"\n3. **Filter site-level first, then genotype-level, then recompute cohort QC.** Setting genotypes to no-call (`.\u002F.`) changes missingness, HWE, and allele frequencies, so those metrics must be computed on the genotype-filtered matrix, not before.\n4. **A single genome-wide F1 is nearly meaningless.** Callers agree on easy SNPs (F1 > 0.999); they diverge in indels-in-repeats, segmental duplications, and MHC. Benchmark stratified, within the GIAB confident region, or do not claim accuracy (Krusche 2019 *Nat Biotechnol* 37:555-560).\n\n## Workflow overview\n\n```\nFASTQ\n  | [1] QC & trim -------------------> fastp            (read-qc\u002Ffastp-workflow)\n  v\n  | [2] Align ----------------------> bwa-mem2          (read-alignment\u002Fbwa-alignment)\n  v     ^-- reference commitment: GRCh38 analysis set \u002F T2T, ALT\u002Fdecoy handling\n  | [3] Mark duplicates ------------> samtools markdup  (alignment-files\u002Fduplicate-handling)\n  v\n  | [4] (BQSR? optional on modern binned-quality instruments)\n  v\n  | [5] Call -----------------------> bcftools | GATK HaplotypeCaller | DeepVariant | DRAGEN\n  v     ^-- single-sample OR per-sample gVCF -> joint-genotype (variant-calling\u002Fjoint-calling)\n  | [6] Normalize (BEFORE annotate) -> bcftools norm -m-any -f ref  (variant-calling\u002Fvariant-normalization)\n  v\n  | [7] Filter: site-level THEN genotype-level         (variant-calling\u002Ffiltering-best-practices)\n  v\n  | [8] Recompute cohort QC on the genotype-filtered matrix  (missingness, Ti\u002FTv, het\u002Fhom, excess-het HWE)\n  v\n  | [9] Annotate -------------------> VEP \u002F SnpEff      (variant-calling\u002Fvariant-annotation)\n  v\n  | [10] Benchmark & QC ------------> hap.py\u002Fvcfeval, bcftools stats  (variant-calling\u002Fvcf-statistics)\n  v\nFiltered, normalized, benchmarked VCF\n```\n\n## Reference genome: the pipeline-wide commitment\n\n**Decision made once, before alignment; everything downstream inherits it.** Mechanism of building\u002Findexing the reference lives in read-alignment\u002Fbwa-alignment; the deeper reasoning below is what a reviewer expects justified.\n\n| Choice | Commit to it when | Consequence inherited downstream |\n|--------|-------------------|----------------------------------|\n| GRCh38 analysis set + decoys (hs38DH), ALT-aware (bwa-postalt) | Human germline, research or most clinical | Decoys soak up off-target reads; ALT-aware mapping recovers reads in MHC\u002Fsegdup loci that ALT-unaware mapping force-fits to the primary, inflating false positives |\n| GRCh38 analysis set, ALT-unaware (primary only) | Frozen clinical pipeline needing deterministic simplicity | Simpler and validated, but loses signal in ~5 Mb of ALT-bearing loci |\n| Masked GRCh38 (false-duplication fix) | Calling in CBS, U2AF1, KCNE1B, KCNJ18 and other affected genes | Recovers reads whose mapQ collapsed across the phantom duplicate copy |\n| T2T-CHM13 | Research needing segdups\u002Fcentromeres\u002Fdark genes; maximum accuracy | Reveals variants in newly resolved regions and removes GRCh38 false-duplication artifacts, but no lossless liftover to GRCh37\u002F38, so the entire annotation\u002Finterpretation stack must be revalidated (Nurk 2022 *Science* 376:44-53; Aganezov 2022 *Science* 376:eabl3533) |\n\nThe reason to fix this first: annotation databases, panel BEDs, benchmark truth sets, and any cohort a sample is joint-called with are all coordinate-specific. Mixing builds (e.g. normalizing to GRCh38 then annotating against a GRCh37 dbSNP) is a guaranteed silent miss. \"We used GRCh38\" is under-specified -- plain vs masked vs analysis-set-with-decoys materially changes results in named clinical genes.\n\n## The canonical order and why\n\nEach step assumes the previous; the order is defensible under review (canonical preprocessing order, filtering\u002Frepresentation practice).\n\n1. **QC\u002Ftrim** -- remove adapters and low-quality tails before they corrupt alignment and duplicate detection.\n2. **Align** -- to the committed reference, with read groups (SM\u002FID\u002FPL\u002FLB); read groups are a hard GATK requirement.\n3. **Mark duplicates** -- PCR\u002Foptical duplicates are not independent evidence; marking (not removing) lets the caller down-weight them. Skip for amplicon\u002FUMI data.\n4. **BQSR -- honestly optional on modern instruments.** BQSR corrected context\u002Fcycle-dependent miscalibration on 2010-era continuous-quality Illumina. NovaSeq\u002FNovaSeq X emit ~4 quality bins, leaving little to recalibrate; callsets are largely unchanged with vs without it. DeepVariant explicitly recommends NOT running BQSR (its CNN learned the raw-quality error model); DRAGEN handles quality internally (and uses DRAGSTR for STR\u002Findel error modeling). Keep it for GATK-HaplotypeCaller consistency if a frozen pipeline demands it; otherwise the modern indel-accuracy lever is STR-aware error modeling (`--dragen-mode`), not BQSR.\n5. **Call** -- per-sample VCF, or per-sample gVCF (`-ERC GVCF`) if a cohort will be joint-genotyped.\n6. **Normalize BEFORE annotate\u002Fcompare** -- `bcftools norm -m-any -f ref.fa` (split multiallelics, then left-align + parsimony), against the SAME reference used for annotation. Add `-a` (atomize) only when the downstream database is decomposed. This is the most common real ordering bug: annotate-then-normalize attaches consequences to a non-canonical representation that fails to match the database. The binding constraint is normalize-before-ANNOTATE\u002FCOMPARE, not normalize-before-filter: GATK convention runs `VariantFiltration` on the raw multiallelic records (its annotations are computed on that representation), then normalizes -- `bwa_gatk_workflow.sh` does exactly that, while `bwa_bcftools_workflow.sh` normalizes first. Both are correct; neither annotates before normalizing.\n7. **Filter site-level, then genotype-level** -- site filters (VQSR\u002Fhard\u002FML) decide whether a *site* is real; genotype filters (`GQ`\u002F`DP`\u002Fallele-balance) decide whether an *individual genotype* is trustworthy. SNPs and indels are filtered separately (different error processes and truth resources).\n8. **Recompute cohort QC on the genotype-filtered matrix** -- missingness, Ti\u002FTv, het\u002Fhom, excess-het HWE. Doing HWE before genotype filtering lets low-GQ garbage drive spurious deviation.\n9. **Annotate** on the normalized (and, where consequence matters, haplotype-resolved) representation.\n10. **Benchmark\u002Fvalidate** after transforms (`hap.py`, `bcftools stats`).\n\n## Choosing the calling engine\n\nPipeline-level selection only; the mechanism and full decision table live in variant-calling\u002Fvariant-calling. Hand off there to pick, then return here for chaining.\n\n| Situation | Lean toward | Hand off to |\n|-----------|-------------|-------------|\n| Auditable open-source, large cohort, joint calling | GATK HaplotypeCaller GVCF -> GenomicsDBImport -> GenotypeGVCFs | variant-calling\u002Fgatk-variant-calling, variant-calling\u002Fjoint-calling |\n| Best indel\u002Fdifficult-region accuracy, single or cohort | DeepVariant (+ GLnexus for cohorts) | variant-calling\u002Fdeepvariant |\n| Quick\u002Fexploratory, non-model organism, limited compute | bcftools mpileup + call | variant-calling\u002Fvariant-calling |\n| Maximum throughput on Illumina, hardware available | DRAGEN (or GATK `--dragen-mode` for the open equivalent) | variant-calling\u002Fvariant-calling |\n\n**Single-sample vs cohort is a chaining decision, not a caller feature.** For a cohort, emit per-sample gVCFs and joint-genotype them so a variant seen in one sample is evaluated in all (cohort rescue of low-coverage hets, squared-off genotype matrix). This is what makes the pipeline forward-compatible with new samples (the N+1 problem). Full mechanism: variant-calling\u002Fjoint-calling.\n\n## Primary path: BWA-MEM2 + bcftools\n\nFast, dependency-light, good for exploratory work and non-model organisms; weaker on indels in homopolymers than reassembly callers.\n\n### Step 1: QC\u002Ftrim with fastp\n\n```bash\nfastp -i sample_R1.fastq.gz -I sample_R2.fastq.gz \\\n    -o trimmed\u002Fsample_R1.fq.gz -O trimmed\u002Fsample_R2.fq.gz \\\n    --detect_adapter_for_pe \\\n    --qualified_quality_phred 20 \\\n    --length_required 50 \\\n    --html qc\u002Fsample_fastp.html\n```\n\n### Step 2: Align with BWA-MEM2\n\nRead groups are mandatory; add `-Y` (soft-clip supplementary) if structural-variant calling is downstream, and `-K 100000000` for thread-count-invariant output. Reference\u002Fanalysis-set choice: read-alignment\u002Fbwa-alignment.\n\n```bash\nbwa-mem2 index reference.fa   # once\nbwa-mem2 mem -t 8 -K 100000000 \\\n    -R \"@RG\\tID:sample\\tSM:sample\\tPL:ILLUMINA\\tLB:lib1\" \\\n    reference.fa trimmed\u002Fsample_R1.fq.gz trimmed\u002Fsample_R2.fq.gz \\\n  | samtools view -bS - > aligned\u002Fsample.bam\n```\n\n### Step 3: Mark duplicates\n\nStrict order (samtools convention): collate (name) -> fixmate `-m` -> sort (coordinate) -> markdup. Detail: alignment-files\u002Fduplicate-handling.\n\n```bash\n# collate groups mates by name; fixmate -m adds the ms\u002FMC tags markdup needs; markdup needs coordinate order.\n# Do NOT coordinate-sort before fixmate, and do NOT markdup amplicon\u002FPCR data (use UMIs there).\nsamtools collate -@ 8 -O -u aligned\u002Fsample.bam \\\n  | samtools fixmate -m -@ 8 -u - - \\\n  | samtools sort -@ 8 -u - \\\n  | samtools markdup -@ 8 - aligned\u002Fsample.markdup.bam\nsamtools index aligned\u002Fsample.markdup.bam\n```\n\n### Step 4: Call and normalize\n\n```bash\n# Single sample (mpileup passes MQ\u002FBQ filters into the pileup)\n# -a FORMAT\u002FDP,FORMAT\u002FAD + call -f GQ emit the per-sample DP\u002FGQ the Step 5 genotype filter needs.\nbcftools mpileup -Ou -f reference.fa -a FORMAT\u002FDP,FORMAT\u002FAD --max-depth 250 --min-MQ 20 --min-BQ 20 \\\n    aligned\u002Fsample.markdup.bam \\\n  | bcftools call -mv -f GQ -Oz -o variants\u002Fsample.vcf.gz\n\n# Normalize BEFORE any annotation or cross-callset comparison, against the SAME reference\nbcftools norm -m-any -f reference.fa -Oz -o variants\u002Fsample.norm.vcf.gz variants\u002Fsample.vcf.gz\nbcftools index variants\u002Fsample.norm.vcf.gz\n```\n\nFor multi-sample cohorts, bcftools can call several BAMs jointly, but the GATK\u002FDeepVariant gVCF path is preferred at scale (variant-calling\u002Fjoint-calling).\n\n### Step 5: Filter (site then genotype)\n\n```bash\n# Site-level (bcftools flags rather than removes, so failures stay auditable)\nbcftools filter -Oz -s LowQual \\\n    -e 'QUAL\u003C20 || INFO\u002FDP\u003C10 || MQ\u003C30' \\\n    -o variants\u002Fsample.siteflt.vcf.gz variants\u002Fsample.norm.vcf.gz\n\n# Genotype-level: set low-confidence genotypes to no-call (NOT 0\u002F0)\nbcftools filter -Oz -S . \\\n    -e 'FMT\u002FGQ\u003C20 | FMT\u002FDP\u003C8' \\\n    -o variants\u002Fsample.filtered.vcf.gz variants\u002Fsample.siteflt.vcf.gz\nbcftools index variants\u002Fsample.filtered.vcf.gz\n```\n\n## Alternative path: BWA-MEM2 + GATK HaplotypeCaller\n\nLocal reassembly + PairHMM; the auditable reference implementation, strong on indels. Full mechanism: variant-calling\u002Fgatk-variant-calling.\n\n```bash\ngatk CreateSequenceDictionary -R reference.fa\nsamtools faidx reference.fa\n\n# DRAGEN mode: no BQSR, STR-aware indel model (DRAGSTR), improved QUAL calibration\ngatk HaplotypeCaller -R reference.fa -I aligned\u002Fsample.markdup.bam \\\n    -O gvcf\u002Fsample.g.vcf.gz -ERC GVCF --dragen-mode\n\n# Cohort: consolidate gVCFs then joint-genotype (NEVER bcftools merge single-sample VCFs)\ngatk GenomicsDBImport --sample-name-map gvcf\u002Fmap.txt \\\n    --genomicsdb-workspace-path genomicsdb -L intervals.bed\ngatk GenotypeGVCFs -R reference.fa -V gendb:\u002F\u002Fgenomicsdb -O variants\u002Fcohort.vcf.gz\n```\n\n## Filtering strategy depends on cohort size\n\nThe site-level filter is chosen by cohort size, platform, and organism; genotype-level filtering is always applied on top. Full mechanism and thresholds: variant-calling\u002Ffiltering-best-practices.\n\n| Cohort \u002F data | Site-level filter | Why |\n|---------------|-------------------|-----|\n| Large WGS cohort (~30+ jointly genotyped) | VQSR (or AS_VQSR for huge cohorts) | The Gaussian-mixture model needs tens of thousands of variants and truth-resource overlap to fit; unreliable below that |\n| Single sample \u002F small cohort | GATK hard filters or VETS\u002FNVScoreVariants | VQSR is non-identifiable on few variants; a \"converged\" model on one exome is filtering on noise |\n| Exome specifically | Hard filters (do NOT use DP as a VQSR annotation) | Capture-boundary coverage cliffs break the annotation manifold |\n| Non-model organism | Hard filters or a bootstrapped truth set | No HapMap\u002FOmni\u002FMills truth resources exist |\n| DeepVariant \u002F DRAGEN output | Use the caller's own calibration; do NOT re-apply GATK hard filters | Their error modes differ; classic annotations do not describe them |\n\nSNPs and indels are filtered separately (different error processes, truth resources, abundance). Hard-filter starting points (SNPs `QD\u003C2, FS>60, MQ\u003C40, MQRankSum\u003C-12.5, ReadPosRankSum\u003C-8, SOR>3`; indels loosen `FS>200`, tighten `ReadPosRankSum\u003C-20`) are lenient heuristics to tune, not universal truth. RankSum annotations are only defined at het sites -- a hand-written filter must treat a missing annotation as PASS, or every hom-alt site vanishes.\n\n## Benchmarking the pipeline\n\n**Goal:** a defensible accuracy statement, not a single number.\n\nThe only rigorous way to compare a callset to truth is haplotype-aware, stratified, and confined to the truth set's confident region. Two VCFs can encode the identical haplotype with different records, so a naive `bcftools isec`\u002Fline-diff overcounts errors; use `hap.py` wrapping the `vcfeval` engine, which replays variants onto the reference and matches at the haplotype level (Krusche 2019 *Nat Biotechnol* 37:555-560; GIAB truth, Zook 2019 *Nat Biotechnol* 37:561-566).\n\n```bash\n# Only meaningful when the sample IS a GIAB genome (HG001-HG007) with a truth VCF + confident BED.\n# -f = confident\u002Fcallable region BED (TP\u002FFP\u002FFN counted ONLY inside it; calls outside are UNK, not FP)\nhap.py truth.vcf.gz query.norm.vcf.gz \\\n    -f HG002_confident.bed \\\n    -r reference.fa \\\n    -o bench\u002Fhg002 \\\n    --engine=vcfeval \\\n    --stratification stratification.tsv   # GIAB region BEDs: low-complexity, segdup, MHC, GC-extreme\n```\n\nDiscipline that separates a senior benchmark from a naive one:\n- **Refuse the global F1.** Report SNP and INDEL separately, and show the low-complexity\u002Fsegmental-duplication\u002FMHC rows explicitly -- hiding them behind an all-regions average is the most common soft cheat.\n- **Do not benchmark an ML caller only on its training genome.** DeepVariant and DRAGEN-ML train on GIAB coordinates, so scoring on HG002 alone partly measures memorization; score on a held-out or semi-blinded sample (HG003\u002FHG004).\n- **\"We found variants GIAB missed\" is almost always a category error** -- calls outside the confident region, which GIAB declined to adjudicate, not accuracy. Real hard-region claims cite CMRG or an assembly-based benchmark.\n- **When the sample is not a GIAB genome** (the usual case), there is no truth VCF; fall back to proxy QC -- Ti\u002FTv (~2.0-2.1 WGS, ~3.0-3.3 exome), dbSNP overlap, het\u002Fhom by ancestry, and trio Mendelian concordance if a family is available. These are proxies for the absence of a benchmark, not a substitute for one (variant-calling\u002Fvcf-statistics).\n\n## QC checkpoints between steps\n\n| After | Gate | Interpretation |\n|-------|------|----------------|\n| QC\u002Ftrim | Q30 >85%, adapter \u003C1% | DNA is typically higher quality than RNA |\n| Alignment | Mapped >95%, properly paired >90% (`samtools flagstat`) | Low mapping rate: wrong reference or contamination |\n| Dedup | Duplicates \u003C30% WGS, \u003C50% exome | High duplication: PCR over-amplification, low input |\n| Calling | Ti\u002FTv ~2.0-2.1 WGS, ~3.0-3.3 exome; dbSNP overlap >95% | Ti\u002FTv sliding toward 0.5 (random) signals false-positive inflation -- filters too loose. `bcftools stats` counts known sites from the ID column, and callers leave it as `.`: run `bcftools annotate -c ID -a dbsnp.vcf.gz` first or the dbSNP-overlap line reads 0% regardless of quality |\n\n## Common Errors\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| Annotation reports a known pathogenic variant as novel\u002Fabsent | Annotated before normalizing; indel one base off the database coordinate | `bcftools norm -m-any -f ref` against the SAME build as the annotation DB, BEFORE annotation |\n| Cohort has impossible all-hom-ref genotypes at variant sites | Built the cohort by `bcftools merge` of single-sample VCFs | Emit per-sample gVCFs and joint-genotype (variant-calling\u002Fjoint-calling) |\n| Every hom-alt site filtered out | Hand-written filter treats missing RankSum as failing | Treat missing annotation as PASS; RankSum is defined only at het sites |\n| VQSR \"converged\" on one exome but the callset is garbage | VQSR needs tens of thousands of variants across ~30+ samples | Use hard filters or VETS\u002FNVScoreVariants for single samples\u002Fexomes |\n| Spurious variants in CBS\u002FU2AF1\u002FKCNE1B | GRCh38 false duplications collapse mapQ | Use a masked GRCh38 or T2T-CHM13; commit the reference before calling |\n| GATK error \"sample ... has no read group\" | Read groups omitted at alignment | Re-run `bwa-mem2 mem -R \"@RG\\t...\"` (SM\u002FID\u002FPL\u002FLB) |\n| Different variant counts from vt vs bcftools on the same data | vt decomposes MNPs by default, bcftools does not | Standardize ONE normalization tool + flags across every cohort compared (variant-calling\u002Fvariant-normalization) |\n\n## Pipeline map (hand-offs)\n\n- read-qc\u002Ffastp-workflow -- QC\u002Ftrim options and report interpretation\n- read-alignment\u002Fbwa-alignment -- BWA-MEM2 parameters, read groups, ALT\u002Fdecoy analysis set, reference indexing\n- alignment-files\u002Fduplicate-handling -- the collate\u002Ffixmate\u002Fsort\u002Fmarkdup order and UMI cases\n- variant-calling\u002Fvariant-calling -- engine selection (bcftools vs GATK vs DeepVariant vs DRAGEN) and ploidy\n- variant-calling\u002Fgatk-variant-calling -- HaplotypeCaller, GVCF, BQSR\u002FDRAGSTR, edge cases\n- variant-calling\u002Fdeepvariant -- CNN calling, platform models, DeepTrio, GLnexus cohorts\n- variant-calling\u002Fjoint-calling -- per-sample gVCF -> cohort joint genotyping, the N+1 problem, scaling\n- variant-calling\u002Fvariant-normalization -- left-align\u002Fparsimony, multiallelic split, MNP decomposition\n- variant-calling\u002Ffiltering-best-practices -- VQSR vs hard vs ML by cohort size; site vs genotype filters\n- variant-calling\u002Fvariant-annotation -- VEP\u002FSnpEff on the normalized representation\n- variant-calling\u002Fvcf-statistics -- Ti\u002FTv, het\u002Fhom, contamination\u002Frelatedness identity QC\n\nThe complete runnable scripts for both paths are in this skill's examples\u002F (`bwa_bcftools_workflow.sh`, `bwa_gatk_workflow.sh`).\n\n## Related Skills\n\n- database-access\u002Fsra-data - Pull public FASTQ for reanalysis (ENA mirror or STRIDES cloud)\n- database-access\u002Fncbi-datasets-cli - Pull reference genome assembly via Datasets v2 CLI\n- read-qc\u002Ffastp-workflow - Detailed QC options\n- sequence-io\u002Ffastq-quality - Confirm the FASTQ quality encoding (Phred+33 vs legacy Phred+64\u002FSolexa) before trimming public or pre-2011 data\n- sequence-io\u002Fpaired-end-fastq - Keep R1\u002FR2 mates synchronized; independent per-mate filtering silently desyncs pairs\n- read-alignment\u002Fbwa-alignment - BWA-MEM2 parameters, read groups, ALT\u002Fdecoy analysis set, the dedup ordering\n- alignment-files\u002Fduplicate-handling - Duplicate marking details\n- variant-calling\u002Fvariant-calling - Engine selection and bcftools calling options\n- variant-calling\u002Fgatk-variant-calling - GATK HaplotypeCaller and DRAGEN mode\n- variant-calling\u002Fdeepvariant - Deep-learning calling and GLnexus cohorts\n- variant-calling\u002Fjoint-calling - Cohort joint genotyping and scaling\n- variant-calling\u002Fvariant-normalization - Normalize before annotate\u002Fcompare\n- variant-calling\u002Ffiltering-best-practices - VQSR, hard filters, VETS\n- variant-calling\u002Fvariant-annotation - Annotate variants with VEP\n- variant-calling\u002Fvcf-statistics - Ti\u002FTv, het\u002Fhom, and identity QC\n\n## References\n\n- Krusche P, Trigg L, Boutros PC, et al. (GA4GH Benchmarking Team). Best practices for benchmarking germline small-variant calls in human genomes. *Nature Biotechnology* 37:555-560 (2019). DOI 10.1038\u002Fs41587-019-0054-x. Stratified haplotype-aware benchmarking (hap.py\u002Fvcfeval).\n- Zook JM, McDaniel J, Olson ND, et al. An open resource for accurately benchmarking small variant and reference calls. *Nature Biotechnology* 37:561-566 (2019). DOI 10.1038\u002Fs41587-019-0074-6. GIAB truth set + confident regions.\n- DePristo MA, Banks E, Poplin R, et al. A framework for variation discovery and genotyping using next-generation DNA sequencing data. *Nature Genetics* 43:491-498 (2011). DOI 10.1038\u002Fng.806. GATK framework.\n- Van der Auwera GA, Carneiro MO, Hartl C, et al. From FastQ Data to High-Confidence Variant Calls: The Genome Analysis Toolkit Best Practices Pipeline. *Current Protocols in Bioinformatics* 43:11.10.1-11.10.33 (2013). DOI 10.1002\u002F0471250953.bi1110s43.\n- Poplin R, Ruano-Rubio V, DePristo MA, et al. Scaling accurate genetic variant discovery to tens of thousands of samples. *bioRxiv* 201178 (2018). DOI 10.1101\u002F201178. Preprint only (never journal-published); the GVCF\u002Fjoint-genotyping reference.\n- Poplin R, Chang P-C, Alexander D, et al. A universal SNP and small-indel variant caller using deep neural networks. *Nature Biotechnology* 36:983-987 (2018). DOI 10.1038\u002Fnbt.4235. DeepVariant.\n- Yun T, Li H, Chang P-C, et al. Accurate, scalable cohort variant calls using DeepVariant and GLnexus. *Bioinformatics* 36:5582-5589 (2020). DOI 10.1093\u002Fbioinformatics\u002Fbtaa1081.\n- Danecek P, Bonfield JK, Liddle J, et al. Twelve years of SAMtools and BCFtools. *GigaScience* 10:giab008 (2021). DOI 10.1093\u002Fgigascience\u002Fgiab008.\n- Nurk S, Koren S, Rhie A, et al. The complete sequence of a human genome. *Science* 376:44-53 (2022). DOI 10.1126\u002Fscience.abj6987. T2T-CHM13.\n- Aganezov S, Yan SM, et al. A complete reference genome improves analysis of human genetic variation. *Science* 376:eabl3533 (2022). DOI 10.1126\u002Fscience.abl3533. Reference-choice variant-calling payoff.\n","## Version Compatibility\n\nReference examples tested with: BWA-MEM2 2.2.1+, GATK 4.5+, bcftools 1.19+, samtools 1.19+, fastp 0.23+, DeepVariant 1.6+, hap.py 0.3.15+, Ensembl VEP 111+\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- CLI: `\u003Ctool> --version` then `\u003Ctool> --help` to confirm flags\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed\npackage and adapt the example to match the actual API rather than retrying.\n\nNote: GenotypeGVCFs defaults (`--max-alternate-alleles`, `--heterozygosity`, `--stand-call-conf`), the GATK hard-filter thresholds, and DRAGEN speed\u002Faccuracy figures drift by version\u002Fvendor; confirm in-tool and against current GIAB benchmarks before quoting.\n\n# FASTQ to Variants Workflow\n\n**\"Call variants from my whole-genome or exome FASTQ files\"** -> Chain QC\u002Ftrim, alignment, duplicate marking, an engine-appropriate caller, normalization, filtering, annotation, and benchmarking into one filtered germline VCF.\n- CLI: fastp -> bwa-mem2 -> samtools markdup -> (bcftools | gatk HaplotypeCaller | DeepVariant) -> bcftools norm -> filter -> VEP -> hap.py\n\nThis is a workflow skill: it owns the chaining decisions and hand-offs, not the internals of any one step. Every step below cross-references the component skill that teaches its mechanism.\n\n## The governing principle\n\nA germline pipeline is a chain of commitments, and the two that decide whether the callset is trustworthy are made at the seams between steps, not inside them.\n\n1. **The reference is a pipeline-wide commitment made once and inherited by everything downstream.** The build and analysis set chosen at alignment (step 2) fix the coordinates of every later comparison: the dbSNP\u002FClinVar\u002FgnomAD records annotation matches against, the truth BED benchmarking scores within, and the cohort other samples are joint-called with must all be the SAME build. Changing it later means redoing alignment, calling, normalization, and annotation. Decide before aligning a single read.\n2. **The step order is not arbitrary; two orderings sink reviews.** (a) **Normalize BEFORE annotate.** An indel that is not left-aligned to the database's canonical position is one base off, so the annotator silently misses the ClinVar\u002FgnomAD record and reports a pathogenic variant as novel-absent -- a patient-safety failure that throws no error. (b) **Never `bcftools merge` single-sample VCFs into a cohort.** Absence of a record is then read as homozygous reference, fabricating genotypes; joint-genotype per-sample gVCFs instead so \"confident hom-ref\" is distinguished from \"no data.\"\n3. **Filter site-level first, then genotype-level, then recompute cohort QC.** Setting genotypes to no-call (`.\u002F.`) changes missingness, HWE, and allele frequencies, so those metrics must be computed on the genotype-filtered matrix, not before.\n4. **A single genome-wide F1 is nearly meaningless.** Callers agree on easy SNPs (F1 > 0.999); they diverge in indels-in-repeats, segmental duplications, and MHC. Benchmark stratified, within the GIAB confident region, or do not claim accuracy (Krusche 2019 *Nat Biotechnol* 37:555-560).\n\n## Workflow overview\n\n```\nFASTQ\n  | [1] QC & trim -------------------> fastp            (read-qc\u002Ffastp-workflow)\n  v\n  | [2] Align ----------------------> bwa-mem2          (read-alignment\u002Fbwa-alignment)\n  v     ^-- reference commitment: GRCh38 analysis set \u002F T2T, ALT\u002Fdecoy handling\n  | [3] Mark duplicates ------------> samtools markdup  (alignment-files\u002Fduplicate-handling)\n  v\n  | [4] (BQSR? optional on modern binned-quality instruments)\n  v\n  | [5] Call -----------------------> bcftools | GATK HaplotypeCaller | DeepVariant | DRAGEN\n  v     ^-- single-sample OR per-sample gVCF -> joint-genotype (variant-calling\u002Fjoint-calling)\n  | [6] Normalize (BEFORE annotate) -> bcftools norm -m-any -f ref  (variant-calling\u002Fvariant-normalization)\n  v\n  | [7] Filter: site-level THEN genotype-level         (variant-calling\u002Ffiltering-best-practices)\n  v\n  | [8] Recompute cohort QC on the genotype-filtered matrix  (missingness, Ti\u002FTv, het\u002Fhom, excess-het HWE)\n  v\n  | [9] Annotate -------------------> VEP \u002F SnpEff      (variant-calling\u002Fvariant-annotation)\n  v\n  | [10] Benchmark & QC ------------> hap.py\u002Fvcfeval, bcftools stats  (variant-calling\u002Fvcf-statistics)\n  v\nFiltered, normalized, benchmarked VCF\n```\n\n## Reference genome: the pipeline-wide commitment\n\n**Decision made once, before alignment; everything downstream inherits it.** Mechanism of building\u002Findexing the reference lives in read-alignment\u002Fbwa-alignment; the deeper reasoning below is what a reviewer expects justified.\n\n| Choice | Commit to it when | Consequence inherited downstream |\n|--------|-------------------|----------------------------------|\n| GRCh38 analysis set + decoys (hs38DH), ALT-aware (bwa-postalt) | Human germline, research or most clinical | Decoys soak up off-target reads; ALT-aware mapping recovers reads in MHC\u002Fsegdup loci that ALT-unaware mapping force-fits to the primary, inflating false positives |\n| GRCh38 analysis set, ALT-unaware (primary only) | Frozen clinical pipeline needing deterministic simplicity | Simpler and validated, but loses signal in ~5 Mb of ALT-bearing loci |\n| Masked GRCh38 (false-duplication fix) | Calling in CBS, U2AF1, KCNE1B, KCNJ18 and other affected genes | Recovers reads whose mapQ collapsed across the phantom duplicate copy |\n| T2T-CHM13 | Research needing segdups\u002Fcentromeres\u002Fdark genes; maximum accuracy | Reveals variants in newly resolved regions and removes GRCh38 false-duplication artifacts, but no lossless liftover to GRCh37\u002F38, so the entire annotation\u002Finterpretation stack must be revalidated (Nurk 2022 *Science* 376:44-53; Aganezov 2022 *Science* 376:eabl3533) |\n\nThe reason to fix this first: annotation databases, panel BEDs, benchmark truth sets, and any cohort a sample is joint-called with are all coordinate-specific. Mixing builds (e.g. normalizing to GRCh38 then annotating against a GRCh37 dbSNP) is a guaranteed silent miss. \"We used GRCh38\" is under-specified -- plain vs masked vs analysis-set-with-decoys materially changes results in named clinical genes.\n\n## The canonical order and why\n\nEach step assumes the previous; the order is defensible under review (canonical preprocessing order, filtering\u002Frepresentation practice).\n\n1. **QC\u002Ftrim** -- remove adapters and low-quality tails before they corrupt alignment and duplicate detection.\n2. **Align** -- to the committed reference, with read groups (SM\u002FID\u002FPL\u002FLB); read groups are a hard GATK requirement.\n3. **Mark duplicates** -- PCR\u002Foptical duplicates are not independent evidence; marking (not removing) lets the caller down-weight them. Skip for amplicon\u002FUMI data.\n4. **BQSR -- honestly optional on modern instruments.** BQSR corrected context\u002Fcycle-dependent miscalibration on 2010-era continuous-quality Illumina. NovaSeq\u002FNovaSeq X emit ~4 quality bins, leaving little to recalibrate; callsets are largely unchanged with vs without it. DeepVariant explicitly recommends NOT running BQSR (its CNN learned the raw-quality error model); DRAGEN handles quality internally (and uses DRAGSTR for STR\u002Findel error modeling). Keep it for GATK-HaplotypeCaller consistency if a frozen pipeline demands it; otherwise the modern indel-accuracy lever is STR-aware error modeling (`--dragen-mode`), not BQSR.\n5. **Call** -- per-sample VCF, or per-sample gVCF (`-ERC GVCF`) if a cohort will be joint-genotyped.\n6. **Normalize BEFORE annotate\u002Fcompare** -- `bcftools norm -m-any -f ref.fa` (split multiallelics, then left-align + parsimony), against the SAME reference used for annotation. Add `-a` (atomize) only when the downstream database is decomposed. This is the most common real ordering bug: annotate-then-normalize attaches consequences to a non-canonical representation that fails to match the database. The binding constraint is normalize-before-ANNOTATE\u002FCOMPARE, not normalize-before-filter: GATK convention runs `VariantFiltration` on the raw multiallelic records (its annotations are computed on that representation), then normalizes -- `bwa_gatk_workflow.sh` does exactly that, while `bwa_bcftools_workflow.sh` normalizes first. Both are correct; neither annotates before normalizing.\n7. **Filter site-level, then genotype-level** -- site filters (VQSR\u002Fhard\u002FML) decide whether a *site* is real; genotype filters (`GQ`\u002F`DP`\u002Fallele-balance) decide whether an *individual genotype* is trustworthy. SNPs and indels are filtered separately (different error processes and truth resources).\n8. **Recompute cohort QC on the genotype-filtered matrix** -- missingness, Ti\u002FTv, het\u002Fhom, excess-het HWE. Doing HWE before genotype filtering lets low-GQ garbage drive spurious deviation.\n9. **Annotate** on the normalized (and, where consequence matters, haplotype-resolved) representation.\n10. **Benchmark\u002Fvalidate** after transforms (`hap.py`, `bcftools stats`).\n\n## Choosing the calling engine\n\nPipeline-level selection only; the mechanism and full decision table live in variant-calling\u002Fvariant-calling. Hand off there to pick, then return here for chaining.\n\n| Situation | Lean toward | Hand off to |\n|-----------|-------------|-------------|\n| Auditable open-source, large cohort, joint calling | GATK HaplotypeCaller GVCF -> GenomicsDBImport -> GenotypeGVCFs | variant-calling\u002Fgatk-variant-calling, variant-calling\u002Fjoint-calling |\n| Best indel\u002Fdifficult-region accuracy, single or cohort | DeepVariant (+ GLnexus for cohorts) | variant-calling\u002Fdeepvariant |\n| Quick\u002Fexploratory, non-model organism, limited compute | bcftools mpileup + call | variant-calling\u002Fvariant-calling |\n| Maximum throughput on Illumina, hardware available | DRAGEN (or GATK `--dragen-mode` for the open equivalent) | variant-calling\u002Fvariant-calling |\n\n**Single-sample vs cohort is a chaining decision, not a caller feature.** For a cohort, emit per-sample gVCFs and joint-genotype them so a variant seen in one sample is evaluated in all (cohort rescue of low-coverage hets, squared-off genotype matrix). This is what makes the pipeline forward-compatible with new samples (the N+1 problem). Full mechanism: variant-calling\u002Fjoint-calling.\n\n## Primary path: BWA-MEM2 + bcftools\n\nFast, dependency-light, good for exploratory work and non-model organisms; weaker on indels in homopolymers than reassembly callers.\n\n### Step 1: QC\u002Ftrim with fastp\n\n```bash\nfastp -i sample_R1.fastq.gz -I sample_R2.fastq.gz \\\n    -o trimmed\u002Fsample_R1.fq.gz -O trimmed\u002Fsample_R2.fq.gz \\\n    --detect_adapter_for_pe \\\n    --qualified_quality_phred 20 \\\n    --length_required 50 \\\n    --html qc\u002Fsample_fastp.html\n```\n\n### Step 2: Align with BWA-MEM2\n\nRead groups are mandatory; add `-Y` (soft-clip supplementary) if structural-variant calling is downstream, and `-K 100000000` for thread-count-invariant output. Reference\u002Fanalysis-set choice: read-alignment\u002Fbwa-alignment.\n\n```bash\nbwa-mem2 index reference.fa   # once\nbwa-mem2 mem -t 8 -K 100000000 \\\n    -R \"@RG\\tID:sample\\tSM:sample\\tPL:ILLUMINA\\tLB:lib1\" \\\n    reference.fa trimmed\u002Fsample_R1.fq.gz trimmed\u002Fsample_R2.fq.gz \\\n  | samtools view -bS - > aligned\u002Fsample.bam\n```\n\n### Step 3: Mark duplicates\n\nStrict order (samtools convention): collate (name) -> fixmate `-m` -> sort (coordinate) -> markdup. Detail: alignment-files\u002Fduplicate-handling.\n\n```bash\n# collate groups mates by name; fixmate -m adds the ms\u002FMC tags markdup needs; markdup needs coordinate order.\n# Do NOT coordinate-sort before fixmate, and do NOT markdup amplicon\u002FPCR data (use UMIs there).\nsamtools collate -@ 8 -O -u aligned\u002Fsample.bam \\\n  | samtools fixmate -m -@ 8 -u - - \\\n  | samtools sort -@ 8 -u - \\\n  | samtools markdup -@ 8 - aligned\u002Fsample.markdup.bam\nsamtools index aligned\u002Fsample.markdup.bam\n```\n\n### Step 4: Call and normalize\n\n```bash\n# Single sample (mpileup passes MQ\u002FBQ filters into the pileup)\n# -a FORMAT\u002FDP,FORMAT\u002FAD + call -f GQ emit the per-sample DP\u002FGQ the Step 5 genotype filter needs.\nbcftools mpileup -Ou -f reference.fa -a FORMAT\u002FDP,FORMAT\u002FAD --max-depth 250 --min-MQ 20 --min-BQ 20 \\\n    aligned\u002Fsample.markdup.bam \\\n  | bcftools call -mv -f GQ -Oz -o variants\u002Fsample.vcf.gz\n\n# Normalize BEFORE any annotation or cross-callset comparison, against the SAME reference\nbcftools norm -m-any -f reference.fa -Oz -o variants\u002Fsample.norm.vcf.gz variants\u002Fsample.vcf.gz\nbcftools index variants\u002Fsample.norm.vcf.gz\n```\n\nFor multi-sample cohorts, bcftools can call several BAMs jointly, but the GATK\u002FDeepVariant gVCF path is preferred at scale (variant-calling\u002Fjoint-calling).\n\n### Step 5: Filter (site then genotype)\n\n```bash\n# Site-level (bcftools flags rather than removes, so failures stay auditable)\nbcftools filter -Oz -s LowQual \\\n    -e 'QUAL\u003C20 || INFO\u002FDP\u003C10 || MQ\u003C30' \\\n    -o variants\u002Fsample.siteflt.vcf.gz variants\u002Fsample.norm.vcf.gz\n\n# Genotype-level: set low-confidence genotypes to no-call (NOT 0\u002F0)\nbcftools filter -Oz -S . \\\n    -e 'FMT\u002FGQ\u003C20 | FMT\u002FDP\u003C8' \\\n    -o variants\u002Fsample.filtered.vcf.gz variants\u002Fsample.siteflt.vcf.gz\nbcftools index variants\u002Fsample.filtered.vcf.gz\n```\n\n## Alternative path: BWA-MEM2 + GATK HaplotypeCaller\n\nLocal reassembly + PairHMM; the auditable reference implementation, strong on indels. Full mechanism: variant-calling\u002Fgatk-variant-calling.\n\n```bash\ngatk CreateSequenceDictionary -R reference.fa\nsamtools faidx reference.fa\n\n# DRAGEN mode: no BQSR, STR-aware indel model (DRAGSTR), improved QUAL calibration\ngatk HaplotypeCaller -R reference.fa -I aligned\u002Fsample.markdup.bam \\\n    -O gvcf\u002Fsample.g.vcf.gz -ERC GVCF --dragen-mode\n\n# Cohort: consolidate gVCFs then joint-genotype (NEVER bcftools merge single-sample VCFs)\ngatk GenomicsDBImport --sample-name-map gvcf\u002Fmap.txt \\\n    --genomicsdb-workspace-path genomicsdb -L intervals.bed\ngatk GenotypeGVCFs -R reference.fa -V gendb:\u002F\u002Fgenomicsdb -O variants\u002Fcohort.vcf.gz\n```\n\n## Filtering strategy depends on cohort size\n\nThe site-level filter is chosen by cohort size, platform, and organism; genotype-level filtering is always applied on top. Full mechanism and thresholds: variant-calling\u002Ffiltering-best-practices.\n\n| Cohort \u002F data | Site-level filter | Why |\n|---------------|-------------------|-----|\n| Large WGS cohort (~30+ jointly genotyped) | VQSR (or AS_VQSR for huge cohorts) | The Gaussian-mixture model needs tens of thousands of variants and truth-resource overlap to fit; unreliable below that |\n| Single sample \u002F small cohort | GATK hard filters or VETS\u002FNVScoreVariants | VQSR is non-identifiable on few variants; a \"converged\" model on one exome is filtering on noise |\n| Exome specifically | Hard filters (do NOT use DP as a VQSR annotation) | Capture-boundary coverage cliffs break the annotation manifold |\n| Non-model organism | Hard filters or a bootstrapped truth set | No HapMap\u002FOmni\u002FMills truth resources exist |\n| DeepVariant \u002F DRAGEN output | Use the caller's own calibration; do NOT re-apply GATK hard filters | Their error modes differ; classic annotations do not describe them |\n\nSNPs and indels are filtered separately (different error processes, truth resources, abundance). Hard-filter starting points (SNPs `QD\u003C2, FS>60, MQ\u003C40, MQRankSum\u003C-12.5, ReadPosRankSum\u003C-8, SOR>3`; indels loosen `FS>200`, tighten `ReadPosRankSum\u003C-20`) are lenient heuristics to tune, not universal truth. RankSum annotations are only defined at het sites -- a hand-written filter must treat a missing annotation as PASS, or every hom-alt site vanishes.\n\n## Benchmarking the pipeline\n\n**Goal:** a defensible accuracy statement, not a single number.\n\nThe only rigorous way to compare a callset to truth is haplotype-aware, stratified, and confined to the truth set's confident region. Two VCFs can encode the identical haplotype with different records, so a naive `bcftools isec`\u002Fline-diff overcounts errors; use `hap.py` wrapping the `vcfeval` engine, which replays variants onto the reference and matches at the haplotype level (Krusche 2019 *Nat Biotechnol* 37:555-560; GIAB truth, Zook 2019 *Nat Biotechnol* 37:561-566).\n\n```bash\n# Only meaningful when the sample IS a GIAB genome (HG001-HG007) with a truth VCF + confident BED.\n# -f = confident\u002Fcallable region BED (TP\u002FFP\u002FFN counted ONLY inside it; calls outside are UNK, not FP)\nhap.py truth.vcf.gz query.norm.vcf.gz \\\n    -f HG002_confident.bed \\\n    -r reference.fa \\\n    -o bench\u002Fhg002 \\\n    --engine=vcfeval \\\n    --stratification stratification.tsv   # GIAB region BEDs: low-complexity, segdup, MHC, GC-extreme\n```\n\nDiscipline that separates a senior benchmark from a naive one:\n- **Refuse the global F1.** Report SNP and INDEL separately, and show the low-complexity\u002Fsegmental-duplication\u002FMHC rows explicitly -- hiding them behind an all-regions average is the most common soft cheat.\n- **Do not benchmark an ML caller only on its training genome.** DeepVariant and DRAGEN-ML train on GIAB coordinates, so scoring on HG002 alone partly measures memorization; score on a held-out or semi-blinded sample (HG003\u002FHG004).\n- **\"We found variants GIAB missed\" is almost always a category error** -- calls outside the confident region, which GIAB declined to adjudicate, not accuracy. Real hard-region claims cite CMRG or an assembly-based benchmark.\n- **When the sample is not a GIAB genome** (the usual case), there is no truth VCF; fall back to proxy QC -- Ti\u002FTv (~2.0-2.1 WGS, ~3.0-3.3 exome), dbSNP overlap, het\u002Fhom by ancestry, and trio Mendelian concordance if a family is available. These are proxies for the absence of a benchmark, not a substitute for one (variant-calling\u002Fvcf-statistics).\n\n## QC checkpoints between steps\n\n| After | Gate | Interpretation |\n|-------|------|----------------|\n| QC\u002Ftrim | Q30 >85%, adapter \u003C1% | DNA is typically higher quality than RNA |\n| Alignment | Mapped >95%, properly paired >90% (`samtools flagstat`) | Low mapping rate: wrong reference or contamination |\n| Dedup | Duplicates \u003C30% WGS, \u003C50% exome | High duplication: PCR over-amplification, low input |\n| Calling | Ti\u002FTv ~2.0-2.1 WGS, ~3.0-3.3 exome; dbSNP overlap >95% | Ti\u002FTv sliding toward 0.5 (random) signals false-positive inflation -- filters too loose. `bcftools stats` counts known sites from the ID column, and callers leave it as `.`: run `bcftools annotate -c ID -a dbsnp.vcf.gz` first or the dbSNP-overlap line reads 0% regardless of quality |\n\n## Common Errors\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| Annotation reports a known pathogenic variant as novel\u002Fabsent | Annotated before normalizing; indel one base off the database coordinate | `bcftools norm -m-any -f ref` against the SAME build as the annotation DB, BEFORE annotation |\n| Cohort has impossible all-hom-ref genotypes at variant sites | Built the cohort by `bcftools merge` of single-sample VCFs | Emit per-sample gVCFs and joint-genotype (variant-calling\u002Fjoint-calling) |\n| Every hom-alt site filtered out | Hand-written filter treats missing RankSum as failing | Treat missing annotation as PASS; RankSum is defined only at het sites |\n| VQSR \"converged\" on one exome but the callset is garbage | VQSR needs tens of thousands of variants across ~30+ samples | Use hard filters or VETS\u002FNVScoreVariants for single samples\u002Fexomes |\n| Spurious variants in CBS\u002FU2AF1\u002FKCNE1B | GRCh38 false duplications collapse mapQ | Use a masked GRCh38 or T2T-CHM13; commit the reference before calling |\n| GATK error \"sample ... has no read group\" | Read groups omitted at alignment | Re-run `bwa-mem2 mem -R \"@RG\\t...\"` (SM\u002FID\u002FPL\u002FLB) |\n| Different variant counts from vt vs bcftools on the same data | vt decomposes MNPs by default, bcftools does not | Standardize ONE normalization tool + flags across every cohort compared (variant-calling\u002Fvariant-normalization) |\n\n## Pipeline map (hand-offs)\n\n- read-qc\u002Ffastp-workflow -- QC\u002Ftrim options and report interpretation\n- read-alignment\u002Fbwa-alignment -- BWA-MEM2 parameters, read groups, ALT\u002Fdecoy analysis set, reference indexing\n- alignment-files\u002Fduplicate-handling -- the collate\u002Ffixmate\u002Fsort\u002Fmarkdup order and UMI cases\n- variant-calling\u002Fvariant-calling -- engine selection (bcftools vs GATK vs DeepVariant vs DRAGEN) and ploidy\n- variant-calling\u002Fgatk-variant-calling -- HaplotypeCaller, GVCF, BQSR\u002FDRAGSTR, edge cases\n- variant-calling\u002Fdeepvariant -- CNN calling, platform models, DeepTrio, GLnexus cohorts\n- variant-calling\u002Fjoint-calling -- per-sample gVCF -> cohort joint genotyping, the N+1 problem, scaling\n- variant-calling\u002Fvariant-normalization -- left-align\u002Fparsimony, multiallelic split, MNP decomposition\n- variant-calling\u002Ffiltering-best-practices -- VQSR vs hard vs ML by cohort size; site vs genotype filters\n- variant-calling\u002Fvariant-annotation -- VEP\u002FSnpEff on the normalized representation\n- variant-calling\u002Fvcf-statistics -- Ti\u002FTv, het\u002Fhom, contamination\u002Frelatedness identity QC\n\nThe complete runnable scripts for both paths are in this skill's examples\u002F (`bwa_bcftools_workflow.sh`, `bwa_gatk_workflow.sh`).\n\n## Related Skills\n\n- database-access\u002Fsra-data - Pull public FASTQ for reanalysis (ENA mirror or STRIDES cloud)\n- database-access\u002Fncbi-datasets-cli - Pull reference genome assembly via Datasets v2 CLI\n- read-qc\u002Ffastp-workflow - Detailed QC options\n- sequence-io\u002Ffastq-quality - Confirm the FASTQ quality encoding (Phred+33 vs legacy Phred+64\u002FSolexa) before trimming public or pre-2011 data\n- sequence-io\u002Fpaired-end-fastq - Keep R1\u002FR2 mates synchronized; independent per-mate filtering silently desyncs pairs\n- read-alignment\u002Fbwa-alignment - BWA-MEM2 parameters, read groups, ALT\u002Fdecoy analysis set, the dedup ordering\n- alignment-files\u002Fduplicate-handling - Duplicate marking details\n- variant-calling\u002Fvariant-calling - Engine selection and bcftools calling options\n- variant-calling\u002Fgatk-variant-calling - GATK HaplotypeCaller and DRAGEN mode\n- variant-calling\u002Fdeepvariant - Deep-learning calling and GLnexus cohorts\n- variant-calling\u002Fjoint-calling - Cohort joint genotyping and scaling\n- variant-calling\u002Fvariant-normalization - Normalize before annotate\u002Fcompare\n- variant-calling\u002Ffiltering-best-practices - VQSR, hard filters, VETS\n- variant-calling\u002Fvariant-annotation - Annotate variants with VEP\n- variant-calling\u002Fvcf-statistics - Ti\u002FTv, het\u002Fhom, and identity QC\n\n## References\n\n- Krusche P, Trigg L, Boutros PC, et al. (GA4GH Benchmarking Team). Best practices for benchmarking germline small-variant calls in human genomes. *Nature Biotechnology* 37:555-560 (2019). DOI 10.1038\u002Fs41587-019-0054-x. Stratified haplotype-aware benchmarking (hap.py\u002Fvcfeval).\n- Zook JM, McDaniel J, Olson ND, et al. An open resource for accurately benchmarking small variant and reference calls. *Nature Biotechnology* 37:561-566 (2019). DOI 10.1038\u002Fs41587-019-0074-6. GIAB truth set + confident regions.\n- DePristo MA, Banks E, Poplin R, et al. A framework for variation discovery and genotyping using next-generation DNA sequencing data. *Nature Genetics* 43:491-498 (2011). DOI 10.1038\u002Fng.806. GATK framework.\n- Van der Auwera GA, Carneiro MO, Hartl C, et al. From FastQ Data to High-Confidence Variant Calls: The Genome Analysis Toolkit Best Practices Pipeline. *Current Protocols in Bioinformatics* 43:11.10.1-11.10.33 (2013). DOI 10.1002\u002F0471250953.bi1110s43.\n- Poplin R, Ruano-Rubio V, DePristo MA, et al. Scaling accurate genetic variant discovery to tens of thousands of samples. *bioRxiv* 201178 (2018). DOI 10.1101\u002F201178. Preprint only (never journal-published); the GVCF\u002Fjoint-genotyping reference.\n- Poplin R, Chang P-C, Alexander D, et al. A universal SNP and small-indel variant caller using deep neural networks. *Nature Biotechnology* 36:983-987 (2018). DOI 10.1038\u002Fnbt.4235. DeepVariant.\n- Yun T, Li H, Chang P-C, et al. Accurate, scalable cohort variant calls using DeepVariant and GLnexus. *Bioinformatics* 36:5582-5589 (2020). DOI 10.1093\u002Fbioinformatics\u002Fbtaa1081.\n- Danecek P, Bonfield JK, Liddle J, et al. Twelve years of SAMtools and BCFtools. *GigaScience* 10:giab008 (2021). DOI 10.1093\u002Fgigascience\u002Fgiab008.\n- Nurk S, Koren S, Rhie A, et al. The complete sequence of a human genome. *Science* 376:44-53 (2022). DOI 10.1126\u002Fscience.abj6987. T2T-CHM13.\n- Aganezov S, Yan SM, et al. A complete reference genome improves analysis of human genetic variation. *Science* 376:eabl3533 (2022). DOI 10.1126\u002Fscience.abl3533. Reference-choice variant-calling payoff.\n",{"name":5,"source":24,"license":15,"workflow":25,"tool_type":26,"depends_on":27,"description":7,"imported_at":38,"source_path":39,"primary_tool":40,"qc_checkpoints":41,"source_repository":50},"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills",true,"cli",[28,29,30,31,32,33,34,35,36,37],"read-qc\u002Ffastp-workflow","read-alignment\u002Fbwa-alignment","alignment-files\u002Falignment-sorting","alignment-files\u002Fduplicate-handling","variant-calling\u002Fvariant-calling","variant-calling\u002Fjoint-calling","variant-calling\u002Fvariant-normalization","variant-calling\u002Ffiltering-best-practices","variant-calling\u002Fvariant-annotation","variant-calling\u002Fvcf-statistics","2026-09-20","workflows\u002Ffastq-to-variants\u002FSKILL.md","bcftools",[42,44,46,48],{"after_qc":43},"Q30 >85%, adapter content \u003C1%",{"after_alignment":45},"Mapping rate >95%, properly paired >90%",{"after_dedup":47},"Duplication rate \u003C30% for WGS, \u003C50% for exome",{"after_calling":49},"Ti\u002FTv ratio ~2.0-2.1 for WGS, ~3.0-3.3 for exome; dbSNP overlap >95% only after annotating the ID column","GPTomics\u002FbioSkills","main","2d1750717747097b602acf30bd09a7cbd4b4c6ea","awesome_skills\u002Fbiology\u002Fbio-workflows-fastq-to-variants","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous","2026-11-09 11:45:36",{"source":8,"skillName":5,"commands":58,"prompt":68,"zipAvailable":25},[59,62,65],{"tool":60,"command":61},"npx","npx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-workflows-fastq-to-variants",{"tool":63,"command":64},"bunx","bunx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-workflows-fastq-to-variants",{"tool":66,"command":67},"pnpm","pnpm dlx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-workflows-fastq-to-variants","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-workflows-fastq-to-variants\u002FSKILL.md",[70,76,80],{"path":71,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":74,"sourceHtmlUrl":75},"examples\u002Fbwa_bcftools_workflow.sh","SCRIPT","脚本",5962,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-workflows-fastq-to-variants\u002Fexamples\u002Fbwa_bcftools_workflow.sh",{"path":77,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":78,"sourceHtmlUrl":79},"examples\u002Fbwa_gatk_workflow.sh",6349,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-workflows-fastq-to-variants\u002Fexamples\u002Fbwa_gatk_workflow.sh",{"path":81,"resourceType":82,"resourceTypeDesc":83,"sizeBytes":84,"sourceHtmlUrl":85},"usage-guide.md","REFERENCE","参考文档",5552,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-workflows-fastq-to-variants\u002Fusage-guide.md",[87,95,102,109,116,123],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":94},"01M7FFFZPC2025JQQHPHDX154J","dei-assessment","Assess diversity, equity, and inclusion with metrics. TRIGGERS - Use when user needs help with dei-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-assessment\u002FSKILL.md",[],[],"2026-11-16 10:05:34",{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":94},"01M7FFFWN8H4WA7A6Y398QKB6J","dei-action-plan","Create DEI action plans with goals and initiatives. TRIGGERS - Use when user needs help with dei-action-plan related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-action-plan\u002FSKILL.md",[],[],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":94},"01M7FFFSHTM0QZRVZ2NRJTJ0PY","culture-fit-assessment","Design culture add assessment processes. TRIGGERS - Use when user needs help with culture-fit-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fculture-fit-assessment\u002FSKILL.md",[],[],{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":113,"categories":114,"keywords":115,"publishedAt":94},"01M7FFFMA12RKEQA38KHJSXXPS","cowork-to-code-bridge","Use an already-installed, independently verified cowork-to-code bridge to run narrowly approved actions on the user's own macOS, Linux, or WSL2 machine through a local file queue.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcowork-to-code-bridge\u002FSKILL.md",[],[],{"skillNo":117,"name":118,"nameZh":6,"description":119,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":120,"categories":121,"keywords":122,"publishedAt":94},"01M7FFFH1F6M8YRGW5V487GH1K","counter-offer-response","Draft counter-offer responses for retention. TRIGGERS - Use when user needs help with counter-offer-response related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcounter-offer-response\u002FSKILL.md",[],[],{"skillNo":124,"name":125,"nameZh":6,"description":126,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":127,"categories":128,"keywords":129,"publishedAt":94},"01M7FFFDGEHV8Y7J9N40HZXW52","continuous-feedback-system","Design continuous feedback systems. TRIGGERS - Use when user needs help with continuous-feedback-system related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcontinuous-feedback-system\u002FSKILL.md",[],[]]