3

I'm looking for a function to run a Miami Plot (GWAS) which looks like this:

Miami Plot (GWAS) example

I will have data for 2 different GWASes. To simulate the plot, you can use this dataset (https://cran.r-project.org/web/packages/qqman/vignettes/qqman.html):

require(qqman)
head(gwasResults)

Any help will be really appreciated! Thanks a lot!

zx8754
  • 52,746
  • 12
  • 114
  • 209
Gianmarco M
  • 71
  • 1
  • 6
  • 1
    You can use https://github.com/YinLiLin/R-CMplot as a resource. There are various custom plots of this kind using ggplot. – Mr.Rlover Sep 27 '19 at 17:03

3 Answers3

2

You could do something similar to this

library(qqman)
par(mfrow=c(2,1))
par(mar=c(0,5,3,3))
manhattan(gwasResults,ylim=c(0,10),cex=2.2,cex.lab=2.5,font.lab=2,font.axis=2,cex.axis=1.6,las=2,font=4)
par(mar=c(5,5,3,3))
manhattan(gwasResults,ylim=c(10,0),cex=2.2,cex.lab=2.5,font.lab=2,font.axis=2,cex.axis=1.6,las=2,font=4,xlab="",xaxt="n")
dev.off()

Miami plot (GWAS) in R Miami plot (GWAS) in R

DuDa
  • 3,718
  • 4
  • 16
  • 36
DSTO
  • 265
  • 1
  • 9
1

You can try

library(tidyverse)
library(ggfastman)
data("gwas_data")
gwas_data %>% 
  mutate( gr= "Study 1") %>% 
  mutate(pvalue=-log10(pvalue)) %>% 
  # rbind a second study with pvalues with other sign.
  bind_rows(., mutate(., gr= "Study 2",
                      pvalue = -pvalue)) %>% 
  # plot the points 
  fast_manhattan(., build = "hg18", speed = "fast",log10p = F, dodge_x = T,pointsize = 2.1, pixels = c(1000,500)) + 
  # add significance line
  geom_hline(data= . %>% group_by(gr) %>% slice(1), aes(yintercept = ifelse(pvalue>0, -log10(5e-08),log10(5e-08))),color ="deeppink") + 
  facet_wrap(~gr, scales = "free_y",ncol = 1,strip.position = "right")+
  scale_y_continuous(expression(-log[10](italic(p))),breaks= seq(-90,80,10), labels = abs(seq(-90,80,10)), expand = c(0.01, 0))

enter image description here

Roman
  • 17,008
  • 3
  • 36
  • 49
0

The R package for creating mirrored Manhattan plots is hudson (https://github.com/anastasia-lucas/hudson) and the function is hudson::gmirror. Example (available in GitHub)

library(hudson)
data(gwas.t)
data(gwas.b)
gmirror(top=gwas.t, bottom=gwas.b, tline=0.05/nrow(gwas.t), bline=0.05/nrow(gwas.b), 
toptitle="GWAS Comparison Example: Data 1", bottomtitle = "GWAS Comparison Example: Data 2", 
highlight_p = c(0.05/nrow(gwas.t),0.05/nrow(gwas.b)), highlighter="green")
Gianmarco M
  • 71
  • 1
  • 6