論文
Graph pangenome captures missing heritability and empowers tomato breeding
https://www.nature.com/articles/s41586-022-04808-9#MOESM8
沒有找到論文里的作圖的代碼,但是找到了部分組圖數(shù)據(jù),我們可以用論文中提供的原始數(shù)據(jù)模仿出論文中的圖
今天的推文重復(fù)一下論文中的 Extended Data Fig7a

image.png
部分示例數(shù)據(jù)截圖

image.png
將數(shù)據(jù)整理成作圖需要的格式
library(tidyverse)
table(dat01$type)
dat01 %>%
filter(type=="cis_gwas") -> dat01.gwas
dim(dat01.gwas)
dat01 %>%
filter(type == "cis_local") -> dat01.local
dim(dat01.local)
left_join(dat01.gwas,dat01.local,by="ID") -> dat
作圖代碼
這里沒有搞清楚他用來映射顏色的數(shù)據(jù)是什么,這里我就直接用x軸的數(shù)據(jù)映射顏色了
library(ggplot2)
library(paletteer)
library(latex2exp)
help(package="latex2exp")
ggplot(data=dat,aes(x=h2.x,y=h2.y))+
geom_point(aes(color=h2.x))+
scale_color_paletteer_c(palette="ggthemes::Blue-Green Sequential",
direction = -1,
name="n neighbours")+
theme_bw()+
theme(panel.grid = element_blank(),
legend.position = c(0.8,0.2))+
geom_abline(slope = 1,intercept = 0,lty="dashed")+
scale_x_continuous(limits = c(0,1),
breaks = seq(0,1,by=0.25))+
scale_y_continuous(limits = c(0,1),
breaks = seq(0,1,by=0.25))+
labs(x=TeX(r"(\textit{h}$^2$ {(\textit{cis})} { GWAS})"),
y=TeX(r"(\textit{h}$^2$ {(\textit{cis})} { local})"))

image.png
今天的推文沒啥新知識(shí)點(diǎn),熟悉下ggplot2的基本語法,熟悉下latex2exp這個(gè)R包用來添加文本的語法
拼圖
library(patchwork)
p+
scale_color_paletteer_c("ggthemes::Red-Green Diverging",
direction = -1) +
p

image.png
示例數(shù)據(jù)和代碼可以自己到論文中獲取,或者給本篇推文點(diǎn)贊,點(diǎn)擊在看,然后留言獲取
歡迎大家關(guān)注我的公眾號(hào)
小明的數(shù)據(jù)分析筆記本
小明的數(shù)據(jù)分析筆記本 公眾號(hào) 主要分享:1、R語言和python做數(shù)據(jù)分析和數(shù)據(jù)可視化的簡單小例子;2、園藝植物相關(guān)轉(zhuǎn)錄組學(xué)、基因組學(xué)、群體遺傳學(xué)文獻(xiàn)閱讀筆記;3、生物信息學(xué)入門學(xué)習(xí)資料及自己的學(xué)習(xí)筆記!