MGHome page

GWAS course

Course map

0 of 64 steps done

Start with step 0.1Install R

Saved in this browser only.

Step 7.3

Module 7 · Plots and reporting · step 3 of 8

7.3Manhattan plot

Commands tested on Windows

In short

We draw a Manhattan plot, which shows the strength of each result at its position along chromosomes 1 to 22, and label the lead variant of each region. We also check that eight variants have p-values below 5 × 10⁻⁸ (0.00000005) to confirm the count of results with very small p-values.

Do this

You should see: There are three regions with very small p-values, on chromosomes 3, 9 and 12.

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.

1stats <- guided_summary_stats(cfg)2plot_data <- data.frame(CHROM = suppressWarnings(as.numeric(stats$chromosome)),  POS = stats$base_pair_location, P = stats$p_value)3leads <- region_leads(plot_data$CHROM, plot_data$POS, plot_data$P)plot_data$LABEL <- NA_character_plot_data$LABEL[leads$index] <- guided_variant_labels(cfg, leads$chromosome, leads$position, stats$variant_id[leads$index])# Optional: suggestive = TRUE adds a dotted line at 5e-5. label_leads = FALSE hides the rs numbers.# max_labels sets how many regions get a label (the regions with the smallest p-values come first).4save_plot(guided_path(cfg, "7.3", "manhattan.png"), function() plot_manhattan(plot_data, "Simulated GWAS: age, sex and ten PCs",  suggestive = FALSE, label_leads = TRUE, max_labels = 3))5save_plot(guided_path(cfg, "7.3", "manhattan_suggestive.png"), function() plot_manhattan(plot_data, "Simulated GWAS: age, sex and ten PCs",  suggestive = TRUE, label_leads = TRUE, max_labels = 3))6stopifnot(sum(stats$p_value[valid_p(stats$p_value)] < 5e-8) == 8L)
  1. Note 1: Read the saved association summary table.
  2. Note 2: Prepare the chromosome, position and p-value columns.
  3. Note 3: Find the lead variant of each region below 5e-8 and look up its rs number.
  4. Note 4: Save the plot of results along the chromosomes.
  5. Note 5: Save a second picture with the optional suggestive line switched on.
  6. Note 6: Check that eight variants have p-values below 0.00000005.

You need

The summary statistics file from step 6.8. If R says that the file is missing, run step 6.8 first.

What we do

Draw a Manhattan plot of the association results along the autosomes. The plot reads the summary statistics file made at step 6.8.

Why

A Manhattan plot (opens in a new tab) shows every tested variant as one point. The horizontal axis shows the chromosome and the position. The vertical axis shows -log10(p), so smaller p-values are higher. Nearby high points are often correlated through LD, so they may be one single signal. The position tells us where the evidence is, not which gene causes the effect.

The red dashed line marks the usual genome-wide threshold of 5e-8, which is -log10(p) of about 7.30. The plot can also show a dotted line at 5e-5, which is -log10(p) of about 4.30. Results between the two lines are called suggestive. A suggestive result is worth a second look, but it is not solid evidence. With so many tests, many results reach 5e-5 by chance alone. Only results above the red line count as genome-wide significant. The plot labels the lead variant of each region above the red line with its rs number. An rs number is the public name of a variant in the dbSNP database. The lead variant is the one with the smallest p-value in its region.

All positions use the GRCh38 (opens in a new tab) genome build. The plot gives alternate chromosomes different colours. The chromosome labels and the order of the positions give the same information, so colour is not the only clue.

Illustration in preparation

Alt text: Autosomal association peaks exceed the genome-wide threshold of 5e-8 on chromosomes 3, 9 and 12. The lead variant of each peak is labelled with its rs number.
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.

Expected result

Show the expected result

There are three regions with very small p-values, on chromosomes 3, 9 and 12. Together they hold eight variants below 5e-8. The lead variants carry the labels rs1994750 on chromosome 3, rs10820598 on chromosome 9 and rs7953249 on chromosome 12. The moderate region that we planted does not reach this usual threshold. Tests on the sex chromosomes and mitochondrial DNA (MT) stay in the result table, but this figure shows only the autosomes. R saves two pictures as PNG files and prints the path of each one. The second picture is the same plot with the dotted suggestive line at 5e-5 switched on. It does not show the pictures in the console. To see it, open the file from the Files pane of RStudio (click the file name, then choose "View File").

The tested PLINK version is set in config.R and recorded in software_versions.txt. Validation: the executable chunks, the comparisons with the expected results and the final plot checks passed on Windows.

If something goes wrong

If something goes wrong

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

Quick check

Do four nearby significant variants always mean four independent causal effects?

Show the answer

No. Because of LD, several tested variants can point to the same single signal.

Files created

s7-3_manhattan.png and s7-3_manhattan_suggestive.png.