← Về thư mục
📄 / / profiles / r-and-d / raw_evidence / OpenAI4S / skills / bioskills / bio-population-genetics-plink-basics / references / usage-guide.md

PLINK Basics - Usage Guide

Overview

PLINK is the workhorse for genotype data management and quality control, but it is a stateful rewriter of allele bookkeeping rather than a calculator: PLINK 1.x re-derives the A1 (effect) allele as the minor allele on every load, so effect estimates and PRS weights silently lose their allele anchor unless the alleles are pinned, while PLINK 2.0 tracks genuine REF/ALT. The QC decisions that matter most are not the thresholds but the order (variant missingness before sample missingness), the controls-only HWE convention (automatic in 1.9, manual in 2.0), and the case/control differential-missingness confounder that injects false association.

Prerequisites

Quick Start

Tell your AI agent what you want to do: - "Convert this VCF to a PLINK fileset, keeping REF/ALT honest" - "Run standard GWAS QC on my genotypes in the correct order" - "Apply controls-only HWE filtering with mid-p" - "Find related individuals with KING and prune to unrelated" - "Check reported sex against X heterozygosity after splitting PAR" - "Test for differential missingness between cases and controls" - "Merge two genotype datasets and resolve strand flips"

Example Prompts

Conversion

"Convert imputed.vcf.gz to a PLINK 2.0 pgen fileset preserving dosages, then export a biallelic BED with the reference allele pinned from the GRCh38 FASTA."

Quality control

"Run QC on cohort.bed: variant missingness at 0.02, then sample missingness at 0.02, MAF 0.01, and controls-only HWE at 1e-6 with mid-p."

Sample-level QC

"Compute KING kinship and remove one of each pair closer than second-degree, and flag heterozygosity outliers beyond 3 SD on LD-pruned SNPs."

Confounder checks

"Run a differential-missingness test between my cases and controls and give me the list of variants to drop before GWAS."

What the Agent Will Do

  1. Identify the input format and target, and choose PLINK 1.9 vs 2.0 from the operation (PED/MAP and --genome force 1.9; dosages and KING favor 2.0).
  2. Convert format, preserving REF/ALT where possible and applying --keep-allele-order on any BED export.
  3. Apply QC in the order that avoids dropping good samples: variant missingness, then sample missingness, MAF, and controls-only HWE with mid-p.
  4. Run sample-level QC: sex check after PAR split, heterozygosity outliers on LD-pruned SNPs, and KING relatedness pruning.
  5. Check the differential-missingness confounder before any association.
  6. Report which samples and variants were removed at each step and why, so the filtering is auditable.

Tips