论文
Chromosome-level assemblies of multiple Arabidopsis genomes reveal hotspots of rearrangements with altered evolutionary dynamics
拟南芥NC_panGenome.pdf
分析代码的github主页
论文中组装了7个拟南芥的基因组,做了一些泛基因组相关的分析,数据和大部分代码都公开了,我们试着复现一下其中的图和一些分析过程,今天的推文复现一下论文中的figure5e 柱形图展示富集分析的结果
做完GO富集分析,数据格式如下
数据是excel存储
首先是读取数据
library(readxl)
dat<-read_excel("data/20230318/Source_Data.Figure5/5e/Fig5e.HOT.genes.GO.xlsx")
dat
最基本的柱形图
library(ggplot2)
ggplot(dat,aes(x=Term,y=Count))+
geom_col()
进行一些美化
library(tidyverse)
dat %>%
mutate(Term=str_replace(Term,"GO:[0-9]+~","")) %>%
arrange(desc(Count)) %>%
mutate(Term=factor(Term,levels = Term)) %>%
ggplot(aes(x=Term,y=Count))+
geom_col(aes(fill=PValue))+
theme_bw()+
theme(axis.text.x = element_text(angle = 60,hjust=1),
legend.position = c(0.9,0.4))+
scale_y_continuous(expand = expansion(mult = c(0,0)),
limits = c(0,65))+
scale_fill_gradient(low="blue",high = "red",
name=expression(italic("P-value")))+
labs(x=NULL)
买一送一,再复现一下论文中的Figure5d
fig5d<-read_delim("data/20230318/Source_Data.Figure5/5d/Fig5d.txt",
delim = "t")
library(ggh4x)
fig5d %>%
mutate(region=factor(region,levels = c("SYN","HOR"))) -> fig5d
ggplot(data=fig5d,aes(x=`high-effect-variant-percent`,y=region))+
geom_boxplot(outlier.alpha = 0,
aes(fill=region),
width=0.4)+
theme_bw()+
theme(legend.position = "none",
panel.border = element_blank(),
axis.line = element_line(),
panel.grid = element_blank())+
scale_x_continuous(limits = c(0,15))+
guides(x=guide_axis_truncated(trunc_lower = 0,
trunc_upper = 15),
y=guide_axis_truncated(trunc_lower = 1,
trunc_upper = 2))+
scale_fill_manual(values = c("#2b6aa8","#f39200"))+
labs(x="Deleterious variants (%)",y=NULL)
最后是拼图
library(patchwork)
p2+p1+
plot_layout(widths = c(1,3))
示例数据和代码可以给推文点赞,然后点击在看,最后留言获取
声明:文中观点不代表本站立场。本文传送门:https://eyangzhen.com/156152.html