Introduction to GWAS & Genomic Selection
Understand how SNP markers connect to phenotypes, why plant breeders use statistical models instead of single-gene logic, and how GWAS and genomic selection differ in goal and design.
1 · What is GWAS?
Genome-Wide Association Study (GWAS) is a statistical approach that scans the entire genome of many individuals — plants, animals, or humans — to find regions of DNA (SNP markers) that are statistically associated with a trait of interest.
In plant breeding, that trait might be grain yield in sorghum, flowering time in rice, or drought tolerance in maize. Instead of looking at one gene at a time, GWAS tests hundreds of thousands of SNPs simultaneously, asking: "Is this marker position significantly more different between high-yielding and low-yielding plants than we'd expect by chance?"
Complex agronomic traits — yield, drought tolerance, disease resistance — are controlled by dozens or hundreds of small-effect genes scattered across the genome. Classical single-gene mapping (QTL studies) finds large-effect loci but misses the polygenic architecture. GWAS, run across diverse germplasm panels, identifies the full landscape of trait-associated loci at fine resolution, making it possible to design marker-assisted breeding or — better — full genomic selection models.
The core logic of GWAS
Imagine you have 300 sorghum lines. Each line has been genotyped at 50,000 SNP positions and phenotyped for grain yield. For every SNP, you run a linear regression:
# For each SNP marker j (j = 1 … 50,000): y = μ + β_j · x_j + ε # where: # y = phenotype (e.g. grain yield, kg/ha) # μ = overall mean # β_j = allele substitution effect at SNP j # x_j = marker genotype (0, 1, or 2 copies of alt allele) # ε = residual error
The test asks: is β_j significantly different from zero? If yes, that SNP is "associated" with yield. A Manhattan plot then visualises the −log₁₀(p-value) for every SNP across every chromosome, and peaks show candidate regions.
One critical complexity: populations have structure — related individuals share both alleles and environments. This inflates false positives. Modern GWAS accounts for this with a kinship matrix (the K matrix) or principal components (Q matrix) added to the model. This is called the Q+K or mixed model approach, which we cover in Lesson 4.
2 · What is Genomic Selection?
Genomic Selection (GS), introduced by Meuwissen, Hayes and Goddard in 2001, is a method that uses marker data from across the entire genome to predict the breeding value of an individual — without needing to phenotype it in a field trial.
The workflow has two phases:
- Training phase: A reference population (genotyped + phenotyped) is used to fit a statistical model that links marker genotypes to observed phenotypes.
- Prediction phase: The fitted model predicts the Genomic Estimated Breeding Value (GEBV) for new candidates that have only been genotyped.
Traditional breeding cycles take 5–10 years per generation: grow, cross, evaluate. Genomic selection can compress this to 1–2 years by selecting the best parents using predicted GEBVs before field trials are even completed. For a crop like sorghum — important for food security in semi-arid environments — GS accelerates genetic gain per unit time, which is the fundamental currency of a breeding programme.
The GBLUP model
The most widely used GS model is GBLUP (Genomic Best Linear Unbiased Prediction). It assumes all SNP effects are normally distributed with equal variance — a ridge regression in marker space:
# GBLUP model: y = Xβ + Zu + ε # where: # y = phenotype vector (n individuals) # β = fixed effects (e.g. environment, block) # u = random genomic effects ~ N(0, Gσ²_g) # G = genomic relationship matrix (GRM) # ε = residual ~ N(0, Iσ²_e) # # u is the GEBV vector — the breeding value we want to predict
In R, the rrBLUP package implements GBLUP via the mixed.solve() function. The BGLR package extends this to Bayesian models (BayesA, BayesB, BayesC, BayesR) that allow locus-specific effect variances — more powerful when a few large-effect QTL exist.
3 · Understanding Marker Data
Both GWAS and GS require genotype data: a matrix where rows are individuals and columns are SNP markers. Each cell holds the count of the alternate allele (0, 1, or 2), called additive dosage coding.
| Format | Description | Used in |
|---|---|---|
| VCF / BCF | Raw variant calls from GATK or bcftools. Contains genotype calls, quality scores, and allele frequencies. | Upstream of GWAS/GS |
| PLINK (.bed/.bim/.fam) | Binary format optimised for large SNP panels. Standard input for PLINK, GEMMA, and many GWAS tools. | GWAS pipelines |
| HapMap (.hmp.txt) | TASSEL-native format; encodes genotypes as nucleotide pairs (AA, AT, TT). Common in crop genomics. | TASSEL, GAPIT |
| Numeric matrix (012) | Rows = individuals, columns = SNPs; values 0/1/2. Direct input for rrBLUP and BGLR in R. | rrBLUP, BGLR, GAPIT |
| dosage / HDF5 | Continuous dosage (0–2) from imputed or sequencing data; used for large panels. | Imputed WGS / GBS |
At each SNP position, each individual has two alleles (diploid). If the reference allele is A and the alternate is T: an AA individual scores 0, an AT individual scores 1, and a TT individual scores 2. This integer coding converts diploid biology into a number that directly enters the linear model as a predictor. Missing genotypes are typically imputed (replaced with the mean dosage at that locus) before analysis.
Typical SNP panel sizes
- GBS (Genotyping-by-Sequencing): 5,000–200,000 SNPs depending on genome size and coverage.
- SNP arrays: 9K, 50K, 90K chips exist for wheat, maize, sorghum.
- Whole-genome sequencing (WGS): Millions of SNPs; usually thinned by LD pruning for GS.
- Sorghum context: The sorghum genome is ~730 Mb. GBS panels of 10,000–100,000 SNPs are commonly used in GS research.
4 · GWAS vs Genomic Selection — Key Differences
| Dimension | GWAS | Genomic Selection |
|---|---|---|
| Primary goal | Find specific loci associated with a trait (discovery) | Predict breeding values of unphenotyped individuals (prediction) |
| Hypothesis | Test each SNP individually; correction for multiple testing | All SNPs contribute simultaneously; no individual test |
| Output | p-values, effect sizes, candidate gene regions | Predicted GEBVs for each individual |
| Trait architecture assumed | Works best with few large-effect loci | Works for complex polygenic traits (many small effects) |
| Practical breeding use | MAS (Marker-Assisted Selection) for major genes | Genome-wide selection; rapid cycling; recurrent selection |
| R packages | GAPIT3, GEMMA, TASSEL | rrBLUP, BGLR, sommer |
In your thesis on Sorghum bicolor, you use genomic selection (not GWAS), specifically rrBLUP and BGLR to estimate GEBVs and then weight them into Best Progeny Values (BPV) for recurrent selection decisions. GWAS is complementary — it tells you where the genetic signal lives; GS tells you how much each candidate is worth selecting.
5 · The Overall Workflow (This Module)
Across the 10 lessons of this module, you will build the complete pipeline from raw genotype data to a publishable GS analysis:
| Lesson | Topic | Key tools |
|---|---|---|
| 1 | Concepts & data types (this lesson) | — |
| 2 | Genotype QC & filtering | PLINK, R |
| 3 | Population structure & PCA | PLINK, ggplot2 |
| 4 | GWAS with mixed model (Q+K) | GAPIT3, GEMMA |
| 5 | Interpreting GWAS results | Manhattan, QQ plots |
| 6 | Genomic relationship matrices | rrBLUP A.mat() |
| 7 | GBLUP prediction | rrBLUP mixed.solve() |
| 8 | Bayesian GS | BGLR (BayesB, BayesC) |
| 9 | BPV weighting for recurrent selection | rrBLUP, BGLR, custom R |
| 10 | Cross-validation & model comparison | caret, custom CV |
6 · Setting Up Your R Environment
All analyses in this module use R. Install the required packages now so you are ready from Lesson 2 onward.
rrBLUP is the workhorse for GBLUP in plant genomics — fast, well-documented, and directly implements the mixed model used in most GS publications. BGLR (Bayesian Generalised Linear Regression) extends this to a full family of Bayesian shrinkage models. GAPIT3 is the standard GWAS package in crop genomics, automating the Q+K mixed model with multiple GWAS methods (MLM, BLINK, FarmCPU). qqman and CMplot handle the visualisation.
# ── Install core GS / GWAS packages ────────────────────── # rrBLUP: GBLUP, G-matrix, ridge regression install.packages("rrBLUP") # BGLR: Bayesian shrinkage models (BayesA/B/C/R, RKHS) install.packages("BGLR") # GAPIT3: GWAS with mixed model (MLM, BLINK, FarmCPU) if (!requireNamespace("devtools", quietly = TRUE)) install.packages("devtools") devtools::install_github("jiabowang/GAPIT3") # Visualisation install.packages("qqman") # Manhattan + QQ plots install.packages("CMplot") # Circular / rectangular Manhattan install.packages("ggplot2") # General plotting install.packages("tidyverse") # Data wrangling # Data handling install.packages("data.table") # Fast reading of large genotype files install.packages("Matrix") # Sparse matrix support for large GRMs
# ── Verify installation ─────────────────────────────────── library(rrBLUP) library(BGLR) library(ggplot2) library(data.table) cat("rrBLUP version:", packageVersion("rrBLUP"), "\n") cat("BGLR version:", packageVersion("BGLR"), "\n") # Expected output (versions may differ slightly): # rrBLUP version: 4.6.1 # BGLR version: 1.1.1
Create your project folder
# Create the folder structure for this module mkdir -p ~/genomic-selection-bpv/{data/raw,data/processed,results,scripts} # Move into the project folder cd ~/genomic-selection-bpv # Confirm the structure tree . # Expected output: . ├── data │ ├── processed │ └── raw ├── results └── scripts
If tree is not installed, run sudo apt install tree first. On Windows with WSL or Git Bash, use find . -type d as an alternative.
7 · Exercises
You have 200 sorghum lines genotyped at 80,000 SNPs. You want to predict which unphenotyped lines from a new cross will have the highest grain yield. Should you run GWAS or genomic selection? Explain your reasoning in two sentences.
Show answer
A sorghum line at SNP position 5:12345678 has the genotype TT. The reference allele at this position is C and the alternate allele is T. What numeric dosage value (0, 1, or 2) would this individual receive in the marker matrix? Why?
Show answer
Install rrBLUP and run the verification code from Section 6. Then load the package and inspect the mixed.solve help page with ?mixed.solve. What are the three main arguments the function requires? Write them below.
Show answer
mixed.solve() are: y (the phenotype vector — the response variable), Z (the design matrix linking observations to random effects — typically the marker matrix M), and K (the optional kinship or covariance matrix for the random effects). When K is provided, GBLUP is performed using the genomic relationship matrix G.
Run the code below to simulate a small genotype matrix. Inspect its dimensions and content. What does each row and column represent? What is the range of values you see?
# Simulate a marker matrix: 10 individuals × 20 SNPs set.seed(42) n_ind <- 10 # number of individuals n_snp <- 20 # number of SNP markers # Sample genotypes: 0, 1, or 2 (additive dosage) M <- matrix( sample(0:2, n_ind * n_snp, replace = TRUE, prob = c(0.5, 0.3, 0.2)), # minor allele freq ~0.25 nrow = n_ind, ncol = n_snp ) # Name rows (individuals) and columns (SNPs) rownames(M) <- paste0("IND", 1:n_ind) colnames(M) <- paste0("SNP", 1:n_snp) # Inspect dim(M) # should be 10 x 20 M[1:5, 1:6] # preview first 5 rows, 6 columns table(M) # counts of 0, 1, 2 across all cells
Show answer
table(M) call will show roughly 50% zeros, 30% ones, and 20% twos — matching the sampling probabilities set in the code.