論文
Environmentally robust cis-regulatory changes underlie rapid climatic adaptation
https://www.biorxiv.org/content/10.1101/2022.08.29.505745v1
2022.08.29.505745v1.full.pdf
還沒有發(fā)表,論文的數(shù)據(jù)和代碼都公開
https://github.com/malballinger/BallingerMack_NYBZase_2022
今天的推文我們重復(fù)一下論文中的Figure3C
這里赏馇保基圖實現(xiàn)是借助R包 ggalluvial
幫助文檔
或者直接通過命令查看help(package="ggalluvial")
首先是自己構(gòu)造數(shù)據(jù)的一個簡單例子
library(ggalluvial)
as.data.frame(Titanic)
dat01<-data.frame(first=c("A","A","C"),
second=c("B","D","E"),
third=c("F","G","F"),
n=c(15,30,20))
dat01$first<-factor(dat01$first,
levels = c("C","A"))
ggplot(data=dat01,
aes(axis1=first,axis2=second,axis3=third,
y=n))+
geom_alluvium(aes(fill=second),
#size=3,
#color="white",
width = 0.1,
aes.bind = "flows")+
geom_stratum(fill=c("red","blue","green",'yellow',
'orange',"blue","green"),
#color="white",
#size=3,
width=0.1)+
geom_label(stat = "stratum", aes(label = after_stat(stratum)))+
scale_x_continuous(breaks = c(1,2),
labels = c("first","second"),
expand = expansion(mult = c(0,0)))+
theme_void()
加載需要用到的R包
library(tidyverse)
library(readr)
library(ggplot2)
library(ggalluvial)
library(latex2exp)
論文中的數(shù)據(jù)和圖
fig3c1<-read_csv("figure3c1.csv")
fig3c1
cp2 <- c("#FC7945", "#4AB08C", "#482870",
"gray", "#FC7945", "#4AB08C",
"#482870", "gray")
fig3c1$category_warm<-factor(fig3c1$category_warm,
levels = c("Amb&Conserved",
"TRANS_ONLY",
"Cis&Trans",
"CIS_ONLY"))
fig3c1$category_cold<-factor(fig3c1$category_cold,
levels = c("Amb&Conserved",
"TRANS_ONLY",
"Cis&Trans",
"CIS_ONLY"))
fig3c1 %>%
ggplot(aes(y = n, axis1 = category_warm, axis2 = category_cold)) +
geom_alluvium(aes(fill= category_warm, color = category_warm),
size = 0.7, alpha = 0.6,
curve_type = "cubic", width = 1/4,
show.legend = FALSE,
aes.bind = "flows") +
geom_stratum(
color = cp2, fill = cp2,
alpha = 0.99, width = 1/4, show.legend = FALSE) +
scale_fill_manual(breaks = c("Amb&Conserved", "Cis&Trans", "TRANS_ONLY", "CIS_ONLY"),
values = c("darkgray", "#29AF7F", "#3B0F6F", "#FC4E07"),
labels = c("Conserved", "Cis + Trans", "Trans", "Cis")) +
scale_color_manual(breaks = c("Amb&Conserved", "Cis&Trans", "TRANS_ONLY", "CIS_ONLY"),
values = c("darkgray", "#29AF7F", "#3B0F6F", "#FC4E07"),
labels = c("Conserved", "Cis + Trans", "Trans", "Cis")) +
scale_x_continuous(breaks = 1:2, labels = c("Warm", "Cold"), expand = c(0.025,0.025)) +
scale_y_continuous(limits = c(0,1400), breaks = seq(0, 1400, 400),
expand = c(0,0)) +
theme_classic() +
theme(panel.grid = element_blank(),
axis.title = element_blank(),
axis.text = element_text (size = 10,
family = "sans"),
plot.margin = unit(c(0,1.5,0,0),'cm'))+
coord_cartesian(clip="off")+
annotate(geom="text",
x=2.15,y=225,
label=TeX(r"(\textit{cis})"),
hjust=0,
color="#FC7945")+
annotate(geom="text",
x=2.15,y=621.5,
label=TeX(r"(\textit{cis & trans})"),
hjust=0,
color= "#4AB08C")+
annotate(geom="text",
x=2.15,y=892,
label=TeX(r"(\textit{trans})"),
hjust=0,
color="#482870")+
annotate(geom="text",
x=2.15,y=1186,
label="conserved\nambiguous",
hjust=0,
color="gray")
歡迎大家關(guān)注我的公眾號
小明的數(shù)據(jù)分析筆記本
小明的數(shù)據(jù)分析筆記本 公眾號 主要分享:1、R語言和python做數(shù)據(jù)分析和數(shù)據(jù)可視化的簡單小例子澜躺;2瞒斩、園藝植物相關(guān)轉(zhuǎn)錄組學(xué)增拥、基因組學(xué)啄巧、群體遺傳學(xué)文獻(xiàn)閱讀筆記;3掌栅、生物信息學(xué)入門學(xué)習(xí)資料及自己的學(xué)習(xí)筆記秩仆!