MGHome page

GWAS course

Course map

0 of 64 steps done

Start with step 0.1Install R

Saved in this browser only.

Step A.1

Module A · Genotype imputation · step 1 of 10

A.1Why imputation works: haplotypes

In short

We see why the alleles at nearby DNA sites can be predicted from each other. People share long stretches of the same chromosome copy, so a few measured sites point to the unmeasured ones in between. We also download the module A data with one R command.

Do this

You should see: Course data are ready: 22 files verified.

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.

1source("R/course.R")2download_course_data(destination = "data/course/module_a", release = list(  archive_url = "https://github.com/mgentiluomo/GWAS_training_session/releases/download/module-a-2026.1/module-a-data-2026.1.zip",  manifest_url = "https://github.com/mgentiluomo/GWAS_training_session/releases/download/module-a-2026.1/MANIFEST.tsv",  archive_sha256 = "623e15a87a3f9a8e4fd743b6b31ff352840e841fbea2921f004a9e0df123770b",  manifest_sha256 = "46d63ba77ddbc7fd8e079064d12781e79c2f95809900669b1c42fd3aece74ac4"))
  1. Note 1: Load the course download function.
  2. Note 2: Download the module A data, check them and put them in data/course/module_a.

You need

LD pruning at step 3.4 helps, but it is not required. The reading needs no data.

The code steps A.7 to A.9 need the module A data. Get them now, once:

  1. Request the password on the data access page. The same email gives the password of the course data and the password of module A.
  2. Open your project in RStudio and run the command below in the Console. It downloads the module A data, checks them, asks for the password and puts them in the folder data/course/module_a. Like the course data of step 0.7, the data are an encrypted archive (opens in a new tab).

The password window says "Course data password:". Enter the module A password from the email, not the course data password.

Do not open or extract the ZIP file with File Explorer or Finder. They cannot open this kind of encrypted file. The command does everything.

You do not change any file of your project. Your project stays as you downloaded it at step 0.3.

What we do

Reading, about 4 minutes. You can come back to it later.

Learn the idea behind imputation: long shared stretches of chromosome, called haplotypes.

Why

You inherit one copy of each chromosome from each parent. The sequence of alleles along one copy is called a haplotype (opens in a new tab).

Chromosomes are passed on in large blocks. Recombination cuts and rejoins them only a few times per chromosome in each generation. So people who are distantly related share long stretches of the same haplotype. Everybody in a population is distantly related to everybody else.

Because of this, alleles at nearby sites are not independent. If you know the alleles at a few sites, you can often predict the alleles at the sites in between. This non-random association between alleles at nearby sites is called linkage disequilibrium (LD (opens in a new tab)). You met LD at step 3.4, when we pruned variants that carry the same information.

Imputation uses the same idea in the opposite direction. Pruning removes sites that we can predict from their neighbours. Imputation adds sites that we can predict from their neighbours. It uses a reference panel (opens in a new tab): a large group of people whose whole genome was sequenced. If the measured sites of your sample match a stretch in the panel, the panel tells us what lies in the gaps.

Illustration in preparation

Alt text: Teaching schematic: Why imputation works: haplotypes.

Expected result

Show the expected result

You can explain why a few measured sites can predict the sites between them.

The command prints Course data are ready: 22 files verified. The folder data/course/module_a holds imputed, reference_panel, genetic_map, true_genotypes and R.

If something goes wrong

If something goes wrong

If the idea is not clear, read the glossary entries for haplotype and LD, then read the step again.

"The password is wrong": you probably entered the course data password. Run the command again and enter the module A password from the email.

"The download stopped before the end": the connection was slow or broken. Run the same command again.

"Existing course data at data/course/module_a could not be verified": an earlier attempt left the folder incomplete. Run the command again with overwrite = TRUE after destination = "data/course/module_a". The old folder is kept as a dated backup.

Quick check

Why can imputation predict a site that the array did not measure, but not a site where nobody in the reference panel carries the variant?

Show the answer

Imputation copies alleles from matching haplotypes in the reference panel. If no reference haplotype carries the variant, there is nothing to copy. Imputation can only predict variants that exist in the panel.

Files created

The folder data/course/module_a (22 files) and data/course/module_a.MANIFEST.tsv, the list of the files with their checksums.

Checksums and licence of the module A data: release module-a-2026.1 (opens in a new tab). You do not download anything there: the command above does it.