MGHome page

GWAS course

Course map

0 of 64 steps done

Start with step 0.1Install R

Saved in this browser only.

Step 5.1

Module 5 · Population structure · step 1 of 7

5.1Why ancestry matters

Commands tested on Windows

In short

We count the reference samples in each labelled group. These groups help us compare inherited genetic backgrounds and understand how differences between cases and controls can create false disease associations.

Do this

You should see: This supplied subset has 1,062 samples labelled EUR, AFR, EAS and SAS.

Command

Module setup, needed before this step

R: module setup

source("R/guided.R")cfg <- guided_init()

R command

Type or paste into the RStudio console.

1reference <- file.path(cfg$data_dir, "pca_reference", "ref1000g_grch38")reference_samples <- guided_table(paste0(reference, ".psam"))2table(reference_samples$SuperPop)
  1. Note 1: Read the reference sample table.
  2. Note 2: Count the samples in each reference group.

You need

The saved state from the end of module 4. You also need the supplied GRCh38 reference subset (opens in a new tab), which comes with the course package.

What we do

Learn how population structure (opens in a new tab) can mislead an association study. Then look at the reference samples we will use.

Why

Cases and controls may be recruited from groups with different ancestry. Ancestry means the broad genetic background that a person inherits from their forebears. Then the allele frequency (opens in a new tab) (how common an allele is in a group) can differ between cases and controls, even at sites that have nothing to do with the disease. This is called confounding (opens in a new tab): a hidden factor is associated with both the group and the genetics.

A principal component (PC) is a single number per person that summarises one main direction of genetic variation across many sites. Principal component analysis (PCA) is the method that finds these directions. PCA only describes patterns. Its axes are not diagnoses, nationality or ethnicity. The reference labels are background information, not a ranking of people. We define an ancestry-matched teaching cohort before we look at any association p-values.

PLINK terminal equivalent. Optional: you do not need it for the course.

Not applicable: this step needs no PLINK command. The R chunk is the complete command.

R reads or calculates the displayed values without changing the genotype files.

The chunk reads the sample table of the reference (a .psam file (opens in a new tab)) and counts the samples in each group.

Expected result

Show the expected result

This supplied subset has 1,062 samples labelled EUR, AFR, EAS and SAS. The labels describe where the reference samples were collected. The table shows only the groups present in this subset, not every possible 1000 Genomes group.

The tested PLINK version is defined in config.R and recorded in software_versions.txt. Validation: executable chunks and the expected counts passed on Windows.

If something goes wrong

If something goes wrong

Stop at the first error message. Check the input file named in the message and the previous step. Keep the command and the console log. Do not use files from a different dataset version. See troubleshooting (opens in a new tab).

Quick check

Can an allele-frequency difference between cases and controls appear because their ancestry differs, even when the site has no effect on the disease?

Show the answer

Yes. Ancestry can influence both which group a person is in and which alleles that person carries.

Files created

None.