论文
Plasma proteome analyses in individuals of European and African ancestry identify cis-pQTLs and models for proteome-wide association studies
https://www.nature.com/articles/s41588-022-01051-w
本地pdf s41588-022-01051-w.pdf
代码链接
https://zenodo.org/record/6332981#.YroV0nZBzic
https://github.com/Jingning-Zhang/PlasmaProtein/tree/v1.2
今天的推文重复一下论文中的Extended Data Fig. 2
读取数据
library(readxl)
eqtls <- read_excel("data/20220627/ExtendedFig2.xlsx",
sheet = "dat")
eqtls.2 <- read_excel("data/20220627/ExtendedFig2.xlsx",
sheet = "leg")
第一个小图a
library(latex2exp)
library(ggplot2)
im1 <- ggplot(eqtls, aes(x = 1:49,y=V2, size=sample)) +
geom_point(alpha=1,color = eqtls$cls)+
theme(plot.title = element_text(hjust = 0.5,size = 7),
axis.title.x = element_text(size = 6),
axis.title.y = element_text(size = 6),
panel.background = element_blank(),
axis.text.x = element_blank(),
axis.line = element_line(color = "black",size = 0.5),
legend.text = element_text(size = 6),
legend.title = element_text(size = 6),
axis.text = element_text(size = 6)) +
labs(title = "Overlap with eQTLs (GTEx V8)", x="Tissues",y="Proportion")+
scale_x_continuous(breaks = NULL)+
coord_cartesian(ylim = c(0,0.5)) + scale_fill_manual(values = as.character(eqtls$cls))
im1
这里新接触到一个R包latex2exp
,用来添加比较复杂的文本公式之类的很方便,需要好好学习一下
第二个小图b
im2 <- ggplot(eqtls, aes(x = 1:49,y=V3, size=sample)) +
geom_point(alpha=1,color = eqtls$cls)+
theme(plot.title = element_text(hjust = 0.5,size = 7),
axis.title.x = element_text(size = 6),
axis.title.y = element_text(size = 6),
panel.background = element_blank(),
axis.text.x = element_blank(),
axis.line = element_line(color = "black",size = 0.5),
legend.text = element_text(size = 6),
legend.title = element_text(size = 6),
axis.text = element_text(size = 6)) +
labs(title = "Colocalization with eQTLs (GTEx V8)", x="Tissues",y="Proportion")+
scale_x_continuous(breaks = NULL)+
coord_cartesian(ylim = c(0,0.25)) +
scale_fill_manual(values = as.character(eqtls$cls))
im2
贡献的图例
im3 <- ggplot(eqtls.2, aes(x = 1:49,y = V3)) +
geom_point(aes(color = tissues)) +
scale_color_manual(name = "GTEx V8 tissues",
values = myColors) +
theme(
legend.key = element_blank(),
legend.key.size = unit(2, "mm"),
panel.border = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
title = element_text(size = 7),
text = element_text(size = 6)
) +
guides(color=guide_legend(ncol = 1))
im3
library(ggpubr)
pm3 <- as_ggplot(get_legend(im3))
pm3
这里新接触到一个知识点是 ggplot2作图的图例可以单独提取出来然后和其他图去拼图
最后是拼图
p <- ggarrange(ggarrange(im1, im2,
nrow = 2, labels = c("a", "b"),
heights = c(0.5,0.5)),
pm3,
ncol = 2,
labels = c(NA, NA),
widths = c(0.7,0.3)
)
p
示例数据和代码可以自己到论文中获取,或者给本篇推文点赞,点击在看,然后留言获取
欢迎大家关注我的公众号
小明的数据分析笔记本
小明的数据分析笔记本 公众号 主要分享:1、R语言和python做数据分析和数据可视化的简单小例子;2、园艺植物相关转录组学、基因组学、群体遗传学文献阅读笔记;3、生物信息学入门学习资料及自己的学习笔记!