MGHome page

Module 5 · 7 steps

Population structure

Project the study onto a 1000 Genomes reference and choose the principal components.

GWAS course

Course map

0 of 64 steps done

Start with step 0.1Install R

Saved in this browser only.

In this module

Before you start
You need the full checkpoint at step 4.6. The first code chunk checks the files that this module needs.
Where the module ends
The checkpoint at step 5.7.

The notebook is a Quarto file (.qmd). Open it in RStudio from the project folder.

At a glance

What you will do. You compare your study samples with a reference set of people from known world regions. You calculate a few numbers for each person that describe their genetic background. You then remove the few samples whose background is very different from the rest.

What you will learn.

  • Why differences in ancestry (opens in a new tab) between cases and controls can create false results.
  • How a principal component (opens in a new tab) (PC) summarises genetic variation in one number per person.
  • How to place study samples on reference axes and draw them in a plot.
  • How to flag ancestry outliers with one fixed rule.
  • How to choose and justify the number of PCs for the later analysis.

How long it takes. About 60 minutes. The slowest step is 5.4, which runs PLINK three times.

Your progress: 0 of 7 steps done

Saved in this browser only. Nothing is sent anywhere.

Steps

  1. 5.1Why ancestry mattersLearn how population structure can mislead an association study.
  2. 5.2Prepare variants for reference PCAFind the sites that are present in both the reference subset and the cleaned study.
  3. 5.3Match build, position and allelesCheck that the shared variants are really the same variants in both files, before the projection.
  4. 5.4Reference PCA and study projectionCalculate the PCs in the reference only.
  5. 5.5Plot the reference and projected studyDraw three plots of the first three reference axes: PC1 against PC2, PC1 against PC3 and PC2 against PC3.
  6. 5.6Define an ancestry-matched cohortApply a rule, fixed in advance, to the first four projected PCs.
  7. 5.7Cohort PCs and how many to includeCalculate new PCs in the retained study cohort, look at the eigenvalues and save the full state.

Recap

  • You compared the study with a GRCh38 reference subset of 1,062 samples.
  • You kept 48,614 shared sites, and all of them matched on chromosome, position and alleles.
  • You placed 1,844 study samples on the reference axes and drew the plot.
  • You applied the six-standard-deviation rule and excluded 33 outlier records.
  • 1,811 samples and 238,513 variants remain, with ten cohort PCs ready for the association model.

Next: module 6, where you run the association test and use these PCs as covariates.