Manhattan plots and linkage disequilibrium heatmap
1
3
Entering edit mode
23 months ago
anamaria ▴ 160

Hello,

does anyone have code which plots both Manhattan plots and linkage disequilibrium heatmap for one gene.

Like here

Manhattan plot Heatmap • 4.2k views
4
Entering edit mode
23 months ago

Learning how to generate these LD heatmaps can be a bit of a nightmare. The figure that you're showing could have been developed in any one of a number of ways.

## 1, snp.plotter

The closest resemblance looks to be snp.plotter. Here is Figure 1 from the manuscript:

## 2, LDheatmap

There is also another package called LDheatmap - see the tutorial, HERE.

## 3, custom (my solution)

I also have my own custom solution for when my data is stored in PLINK objects. First, export the SNP data from PLINK to HaploView format:

plink --noweb --bfile MyData --chr 5 --from-bp 1000 --to-bp 100000 --snps-only no-DI --recodeHV --out MyData.Haploview ;


In HaploView, I then generate the LD heatmap and export it as a PNG.

As a PNG, I can read this into R. Here, I also read in a PNG of my gene of interest from RefSeq. Multiple plots can be stacked on top of each other and / or side-by-side via the use of mfrow(), passed to par():

par(mar=c(0,0,0,0), mfrow=c(2,1))

plot(1:2, type='n', main="", xlab="", ylab="", xaxt="n", yaxt="n", axes=FALSE)
lim <- par()
rasterImage(gene, lim$usr[1], lim$usr[3], lim$usr[2], lim$usr[4]-0.85)

plot(1:2, type='n', main="", xlab="", ylab="", xaxt="n", yaxt="n", axes=FALSE)
lim <- par()
rasterImage(LD, lim$usr[1]+0.0151, lim$usr[3], lim$usr[2]-0.023, lim$usr[4])


We can also add a legend for the r values, going from 0 to 1:

require(SDMTools)
require(RColorBrewer)
points <- cbind(x=c(1.925, 1.96, 1.96, 1.925), y=c(1.5, 1.5, 1.1, 1.1))
cols=brewer.pal(n=9, name="Greys"),
title=bquote(R^2),
limits=c(0,1))


The other figure that you see here (above my LD heatmap) is also from HaploView - those are the identified haplotypes for each haploblock.

The Manhattan plot can be easily drawn with custom R functions, or use manhattan() from qqman package:

Kevin

2
Entering edit mode

Hi Kevin, thank you so much for this elaborate answer! I keep finding your posts whenever I look for a solution to my problems. :D

0
Entering edit mode

Hi Kevin,

thank you so much for this elaborate answer. It would complicate so much for me if I used genotyped data so instead I did what I described in this post: https://stackoverflow.com/questions/56118669/manhattan-plot-and-linkage-disequilibrium-heatmap-on-one-plot But now the issue is how to align results from Heatmap and Manhattan like it is shown on that first graph which I found online.

1
Entering edit mode

What you are asking seems more like a graphical layout issue. Why not just use PhotoShop, GIMP, or even MS Paint?

0
Entering edit mode

I wish it is like that. I have to adjust to have the same on x axis for Manhattan and Heatmap, to have the same range. When I have that I can align graphs in photoshop or somewhere else

0
Entering edit mode

Yes, that is the main part that requires precision. Is it 'just' for a publication, though? - is it not sufficient to just give the 'feeling' that they are aligned? Figures are just representations of data, and, if they give the required message in whatever way, then that should be sufficient?

In my figure, above, I aligned the gene sequence (introns ans exons) manually, but I still spent a few hours carefully ensuring that each SNP in the LD heatmap roughly lined up.

0
Entering edit mode

Thank you so much, I hope this doesn't look too bad :) https://imgur.com/a/GMZuoXA

1
Entering edit mode

bellissimo! I count different numbers of SNPs between the Manhattan and the LD heatmap, though? This is actually also a difficult case, like mine (above) because the SNPs are evenly-spaced in the LD heatmap, while they are positioned based on bp in the Manhattan. In my case, I literally spent hours stretching my gene figure (above the LD heatmap) such that it was more or less correct. Are your SNPs mostly lined up?

I also had the 'grey' background in my LD heatmap, but got rid of it in GIMP by setting that colour as transparent, and then exporting as a new PNG (converts transparent to white).