Graph pangenome captures missing heritability and empowers tomato breeding
https://www.nature.com/articles/s41586-022-04808-9
西红柿Nature.pdf
论文里提供了很多代码,链接是
https://github.com/YaoZhou89/TGG
这里有eQTL和WGCNA的代码
今天的推文我们试着复现一下论文中的Figure2b 三元相图
image.png
关于这个图怎么看,可以参考如下链接介绍的很详细
三元相图怎么看怎么画(附R代码示例) https://www.jianshu.com/p/f432a98e9504
一个比较快捷的办法读这个图
目标点离哪个角近,在相应组中的相对比例高
在论文中的图可以看出 SV组中的点很密集,说明SV占主导的比例是比SNP和Indel要高的
image.png
示例数据
image.png
作图代码
l
library(readxl)
#install.packages("ggtern")
library(ggtern)
df<-read_excel("data/20230712/practice.xlsx")
ggtern(data=df,aes(x=x,y=y,z=z))+
geom_mask()+
geom_point(size=15,aes(color=group))+
theme_showarrows()
image.png
library(readxl)
library(ggplot2)
df01<-read_excel("data/20230712/41586_2022_4808_MOESM6_ESM.xlsx",
sheet = "Fig2b",
skip = 1)
dim(df01)
head(df01)
table(df01$Class)
ggtern(data=df01,
aes(x=h2_snps,y=h2_svs,
z=h2_indel,color=Class))+
geom_mask()+
geom_point(size=3)+
theme_custom(col.T = "#dc6c50",
col.L = "#3f7fa7",
col.R = "#62b19a")+
theme_showarrows()+
labs(x="SNP",y="SV",z="Indel")+
theme(panel.background = element_blank(),
legend.key = element_rect(fill="transparent"))+
guides(color=guide_legend(override.aes = list(size=10)))+
scale_color_manual(values = c("SNP dominant"="#528bb0",
"SNP suppressed"="#85b6d2",
"InDel dominant"="#71b9a4",
"InDel suppressed"="#a3cda7",
"SV dominant"="#df7a61",
"SV suppressed"="#eaa778",
"Balanced"="#c8c9ca"),
breaks = c("SNP dominant",
"SNP suppressed",
"InDel dominant",
"InDel suppressed",
"SV dominant",
"SV suppressed",
"Balanced"),
name=NULL,
labels = c("SNP dominant (3,277)",
"SNP suppressed (1,121)",
"InDel dominant (1,444)",
"InDel suppressed (2,634)",
"SV dominant (10,297)",
"SV suppressed (586)",
"Balanced (298)"))
image.png
这里还有很多细节怎么靠代码来修改暂时还搞不明白,还得花时间看ggtern的文档
推文记录的是自己的学习笔记,大概率存在错误!