Independent phenotypic plasticity axes define distinct obesity sub-types
https://www.nature.com/articles/s42255-022-00629-2#Sec15
s42255-022-00629-2.pdf
论文中没有公开代码,但是所有作图数据都公开了,我们可以试着用论文中提供的数据模仿论文中的图
今天的推文重复一下论文中的Fig3b 差异表达火山图,之前也有推文介绍过火山图,今天的推文主要学习的一个知识点是利用latex2exp
这个R包添加文本,包括
ggplot()+
geom_point(aes(x=1,y=1))+
labs(x=TeX(r"(\overset${ABCDEF}{abcde}$)"))
image.png
image.png
library(readr)
df<-read_tsv("data/20220921/fig3b.txt")
head(df)
colnames(df)
df %>%
mutate(change=case_when(
log2FoldChange > 1 & pvalue < 0.05 ~ "Up",
log2FoldChange < -1 & pvalue < 0.05 ~ "Down",
TRUE ~ "Not Sig"
)) -> new.df
table(new.df$change)
new.df %>%
filter(-log10(pvalue)>8) -> new.text.label
这里没有找到论文中差异表达的标准,这里是我随便写的
library(ggplot2)
library(ggrepel)
library(latex2exp)
ggplot(data=new.df,aes(x=log2FoldChange,y=-log10(pvalue)))+
geom_point(aes(color=change))+
scale_color_manual(values = c("Down"="#3a53a4",
"Not Sig"="#aaaaaa",
"Up"="#7acde4"),
labels=c("Down"=TeX(r"(\textit{Nnat}${^+}$${^/}$${^-}$${^p}$-\textit{Heavy} depleted)"),
"Not Sig"="Not Significant",
"Up" = TeX(r"(\textit{Nnat}${^+}$${^/}$${^-}$${^p}$-\textit{Heavy} enriched)")))+
theme_classic()+
theme(legend.position = c(0.2,0.9),
legend.text.align = 0,
legend.title = element_blank())+
geom_text_repel(data=new.text.label,
aes(x=log2FoldChange,y=-log10(pvalue),
label=mgi_symbol))+
labs(x=TeX(r"(\overset${\textit{Nnat}{^+}{^/}{^-}{^p}-\textit{Lean}$ versus $\textit{Nnat}{^+}{^/}{^-}{^p}-\textit{Giant}}{(log{_2}$ fold $change)}$)"),
y=TeX(r"(-log${_1}{_0}$ {(}\textit{P}{ value}{)})"))
image.png
p1<-ggplot(data=new.df,aes(x=log2FoldChange,y=-log10(pvalue)))+
geom_point(aes(color=change))+
scale_color_manual(values = c("Down"="#3a53a4",
"Not Sig"="#aaaaaa",
"Up"="#7acde4"),
labels=c("Down"=TeX(r"(\textit{Nnat}${^+}$${^/}$${^-}$${^p}$-\textit{Heavy} depleted)"),
"Not Sig"="Not Significant",
"Up" = TeX(r"(\textit{Nnat}${^+}$${^/}$${^-}$${^p}$-\textit{Heavy} enriched)")))+
theme_classic()+
theme(legend.position = c(0.2,0.9),
legend.text.align = 0,
legend.title = element_blank())+
geom_text_repel(data=new.text.label,
aes(x=log2FoldChange,y=-log10(pvalue),
label=mgi_symbol))+
labs(x=TeX(r"(\overset${\textit{Nnat}{^+}{^/}{^-}{^p}-\textit{Lean}$ versus $\textit{Nnat}{^+}{^/}{^-}{^p}-\textit{Giant}}{(log{_2}$ fold $change)}$)"),
y=TeX(r"(-log${_1}{_0}$ {(}\textit{P}{ value}{)})"))
p2<-ggplot(data=new.df,aes(x=log2FoldChange,y=-log10(pvalue)))+
geom_point(aes(color=change))+
scale_color_manual(values = c("Down"="red",
"Not Sig"="#aaaaaa",
"Up"="darkgreen"),
labels=c("Down"=TeX(r"(\textit{Nnat}${^+}$${^/}$${^-}$${^p}$-\textit{Heavy} depleted)"),
"Not Sig"="Not Significant",
"Up" = TeX(r"(\textit{Nnat}${^+}$${^/}$${^-}$${^p}$-\textit{Heavy} enriched)")))+
theme_classic()+
theme(legend.position = c(0.2,0.9),
legend.text.align = 0,
legend.title = element_blank())+
geom_text_repel(data=new.text.label,
aes(x=log2FoldChange,y=-log10(pvalue),
label=mgi_symbol))+
labs(x=TeX(r"(\overset${\textit{Nnat}{^+}{^/}{^-}{^p}-\textit{Lean}$ versus $\textit{Nnat}{^+}{^/}{^-}{^p}-\textit{Giant}}{(log{_2}$ fold $change)}$)"),
y=TeX(r"(-log${_1}{_0}$ {(}\textit{P}{ value}{)})"))
library(patchwork)
pdf(file = "Rplot03.pdf",width = 14.1,height = 6)
p1+p2
dev.off()