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
今天的推文重复一下论文中的Figure3,涉及到4个图,普通箱线图,分组箱线图,箱线图分面,最后一个知识点是如何将这5个图组合到一起
library(ggplot2)
My_Theme <- theme(
panel.background = element_blank(),
title = element_text(size = 7),
text = element_text(size = 6))
部分示例数据集
image.png
读取数据集
library(readxl)
dat01<-read_excel("data/20220627/Fig3.xlsx",
sheet = "3a")
作图代码
p1 <- ggplot(data = dat01, aes(x = group)) +
geom_boxplot(alpha=0.6,
notch = TRUE,
notchwidth = 0.5,
aes(y=hsq, fill=kind)) +
coord_cartesian(ylim = c(0,0.5)) +
labs(y = expression(paste("cis-",h^2)),
x=NULL, title=NULL) +
theme(legend.position="top",
legend.title=element_blank(),
axis.text.x = element_text(color = c("#4a1486",
"#4a1486",
"#cb181d",
"#cb181d"),
vjust = 0.5,
hjust = 0.5,
angle = 15))+
My_Theme+
scale_fill_manual(values=c("#4a1486","#cb181d"))+
theme(axis.line = element_line())
p1
image.png
作图代码
dat02<-read_excel("data/20220627/Fig3.xlsx",
sheet = "3b")
head(dat02)
p2 <- ggplot(data = dat02, aes(x = group)) +
geom_boxplot(alpha=0.8,
notch = TRUE,
notchwidth = 0.5,
aes(y=acc, fill=Model)) +
coord_cartesian(ylim = c(0,1.2)) +
labs(title = NULL, x=NULL,
y=expression(paste(R^2,"/cis-",h^2))) +
theme(legend.position="top",
axis.text.x = element_text(color = c("#4a1486",
"#4a1486",
"#cb181d",
"#cb181d"),
vjust = 0.5,
hjust = 0.5,
angle = 15))+
My_Theme+
scale_fill_manual(values=c("#feb24c","#41b6c4"))+
theme(axis.line = element_line())
p2
dat03<-read_excel("data/20220627/Fig3.xlsx",
sheet = "3c")
head(dat03)
p3 <- ggplot(data = dat03, aes(x = model)) +
geom_boxplot(alpha=0.8,
notch = TRUE,
notchwidth = 0.5,
aes(y=acc, fill=model)) +
facet_wrap(~race, ncol=2)+
labs(title = NULL, x=NULL,
y=expression(paste(R^2,"/cis-",h^2))) +
coord_cartesian(ylim = c(0,1.2)) +
theme(axis.text.x = element_text(color = c("#238b45",
"#2171b5"),
vjust = 0.5,
hjust = 0.5,
angle = 15),
legend.position="none") +
My_Theme+
scale_fill_manual(values=c("#238b45","#2171b5"))+
theme(axis.line = element_line(),
panel.spacing.x = unit(0,'lines'),
strip.background = element_rect(color="white"))
p3
这里两个小知识点,
panel.spacing.x = unit(0,'lines')
strip.background = element_rect(color="white")
image.png
dat04<-read_excel("data/20220627/Fig3.xlsx",
sheet = "3d")
head(dat04)
gtex.colors <- read_excel("data/20220627/gtex_colors.xlsx")
gtex.colors
myColors <- gtex.colors$V2
names(myColors) <- gtex.colors$V1
colScale <- scale_fill_manual(name = "gtex.colors", values = myColors)
p4 <- ggplot(data = dat04, aes(x = tissue, fill=tissue)) +
geom_boxplot(alpha=0.8,
notch = TRUE,
notchwidth = 0.5,
aes(y=cor)) +
theme(axis.text.x = element_text(angle = 90, hjust = 1),
legend.position="none",
axis.title.y = element_text(hjust=1))+
My_Theme+
coord_cartesian(ylim = c(-0.25,1))+
colScale +
labs(x = "GTEx V7 tissue",
y = "Correlation between cis-regulated gene \nexpression and plasma protein SOMAmers ",
title=NULL)+
theme(axis.line = element_line())
p4
image.png
library(ggpubr)
p <- ggarrange(ggarrange(p1, p2,
p3,
ncol = 3, labels = c("a", "b","c"),
widths = c(0.29,0.4,0.31)),
p4,
nrow = 2, heights = c(0.5,0.5),
labels = c(NA,"d"))
p
image.png
示例数据和代码可以自己到论文中获取