我正在寻找运行如下所示的Miami Plot(GWAS)的函数:
我将获得2个不同GWAS的数据。要模拟该图,可以使用以下数据集(https://cran.r-project.org/web/packages/qqman/vignettes/qqman.html):
require(qqman)
head(gwasResults)
任何帮助将不胜感激!非常感谢!
答案 0 :(得分:1)
你可以做类似的事情
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()
R 中的迈阿密图 (GWAS)
答案 1 :(得分:0)
你可以试试
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))
答案 2 :(得分:-1)
用于创建镜像曼哈顿图的R包为hudson
(https://github.com/anastasia-lucas/hudson),函数为hudson::gmirror
。
示例(在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")