MGHome page

GWAS course

Course map

0 of 64 steps done

Start with step 0.1Install R

Saved in this browser only.

Step 3.4

Module 3 · Sample quality control · step 4 of 8

3.4LD pruning

Commands tested on Windows

In short

We select common DNA sites that are less strongly correlated with each other. This stops groups of similar sites from weighing too much in the sample checks. The full dataset is kept for the association scan.

Do this

You should see: The .prune.in file lists 69,539 sites.

Command

Module setup, needed before this step

R: module setup

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

Blue: PLINK option · Orange: value you can change · Green: file name

R command

Type or paste into the RStudio console.

1regions <- guided_high_ld(cfg)2run_plink(cfg, c("--pfile", guided_path(cfg, "3.3"), "--chr", "1-22", "--maf", "0.05", "--geno", "0.02",  "--exclude", "bed1", regions, "--indep-pairwise", "200kb", "0.2", "--out", guided_path(cfg, "3.4", "prune")))3pruned <- readLines(paste0(guided_path(cfg, "3.4", "prune"), ".prune.in"))stopifnot(length(pruned) == 69539L)cat(length(pruned), "variants kept by LD pruning\n")# Course bookkeeping: records the counts for the next step. Do not change.guided_artifact_checkpoint(cfg, "3.4", c(paste0(guided_path(cfg, "3.4", "prune"), c(".prune.in", ".prune.out")), regions), parent = "3.3")
  1. Note 1: Write the list of regions where nearby variants are strongly correlated.
  2. Note 2: Select variants with less similar patterns of DNA letters.
  3. Note 3: Check and print how many variants were selected.

You need

State 3.3.

What we do

We select a smaller set of autosomal (opens in a new tab) variants that are less correlated with each other. Removing correlated variants is called pruning for linkage disequilibrium (opens in a new tab) (LD). Autosomes are the chromosomes 1 to 22. We use this set for the heterozygosity check, for the relatedness check and, later, for principal component analysis (opens in a new tab) (PCA). PCA is a method that summarises the genetic differences between people.

Why

Linkage disequilibrium (opens in a new tab) (LD) means that alleles at nearby sites are correlated. A dense region with many correlated sites would count too much, only because the array has many probes (opens in a new tab) there. A probe is the piece of DNA on the array that measures one site.

LD pruning (opens in a new tab) keeps one representative subset of sites. It does not delete the other sites from the association data.

We also leave out the long-range LD regions, where the correlation reaches over very long distances. The GRCh38 intervals are listed in the helper function. They are not a complete catalogue for all studies.

What each option does

Each option, with the modifiers under the option they belong to.
Option or modifierWhat it does
--pfile

Reads the PGEN, PVAR and PSAM input files that share the given name prefix.

--chr

Uses only chromosomes 1 to 22, the autosomes.

--maf

Keeps variants whose less common allele has a frequency of at least 5%.

--geno

Keeps variants with no more than 2% missing calls.

--exclude

Leaves out variants within the listed DNA regions.

Modifier of --exclude: bed1

Reads DNA regions with positions counted from 1 and includes both ends of each region.

--indep-pairwise

Compares genotype patterns at pairs of sites within windows of 200 kb (200,000 DNA bases). It drops one site of every pair with a squared correlation (r²) above 0.2. A larger r² means that the genotypes of the two sites vary together more closely.

--out

Sets the shared beginning of the output file names.

Every command also uses --threads 2 (PLINK runs at most two tasks at the same time) and --memory 2048 (PLINK uses at most about 2 GB of memory).

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

Blue: PLINK option · Orange: value you can change · Green: file name

Terminal equivalent: plain PLINK 2

Select any option to see what it does. Do not paste terminal commands into the R console.

Command

bin/plink2

No option selected. Each underlined part of the command is an option you can open.

Use bin\plink2.exe on Windows.

Expected result

Show the expected result

The .prune.in file lists 69,539 sites. The complete analysis state still has 296,360 variants.

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. Your numbers should be the same.

If something goes wrong

If something goes wrong

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

What this check can reveal

Regions that would otherwise dominate summaries made from correlated markers. The subset that you keep depends on the input samples and on the exact version of the algorithm.

Quick check

Should the later association scan test only the pruned sites?

Show the answer

No. We use pruning only for specific checks and for the PCA. The association scan uses the full set of variants that pass quality control (QC).

Files created

s3-4_high_ld.bed1, .prune.in/.prune.out and the logs.

Under the hood & literature

Under the hood & literature

What the tool computes. --indep-pairwise 200kb 0.2 moves a 200 kb window along each chromosome one variant at a time. In each window it calculates r^2, the squared correlation between the genotype counts (0, 1 or 2) of two variants, from unphased hard calls. For every pair above 0.2 it drops one of the two. .prune.in lists the kept variants and .prune.out the dropped ones. No genotype is deleted.

Why these values. The window, the limit of 0.2 and the 5% frequency filter are conventions, not laws. A looser limit such as 0.5 keeps more variants. Windows counted in variants, with a step above 1, are also widely used. Here the filter leaves 69,539 sites, enough for the checks that follow.

Pitfalls. Some regions, such as the HLA region on chromosome 6, are correlated over very long distances. Pruning thins them but does not remove their pull on principal components, so the course excludes listed regions first. The list belongs to one genome build and is not complete. The pruned set also depends on the samples, the frequency filter and the scan order, so another cohort gives another list. Never use it for the association scan.

References

  1. Price AL et al. (2008) Long-range LD can confound genome scans in admixed populations. Am J Hum Genet 83:132-135. PMID 18606306.
  2. Anderson CA et al. (2010) Data quality control in genetic case-control association studies. Nat Protoc 5:1564-1573. PMID 21085122.
  3. Privé F et al. (2020) Efficient toolkit implementing best practices for principal component analysis of population genetic data. Bioinformatics 36:4449-4457. PMID 32415959.
  4. Chang CC et al. (2015) Second-generation PLINK: rising to the challenge of larger and richer datasets. GigaScience 4:7. PMID 25722852.