論文
The flying spider-monkey tree fern genome provides insights into fern evolution and arborescence
https://www.nature.com/articles/s41477-022-01146-6#Sec44
數(shù)據(jù)下載鏈接
https://doi.org/10.6084/m9.figshare.19125641
看了論文,提供了論文中所有樹圖的原始樹文件衡奥,雖然沒有提供代碼蜻拨,應(yīng)該能利用原始數(shù)據(jù)模仿出來
今天的推文重復(fù)一下論文中的Figure4b
首先是讀取樹文件
library(ggtree)
library(treeio)
tree<-read.newick("data/20220512/phylogenetic trees/Fig4b_resequencing_tree.nwk",
node.label = "support")
最基本的樹
ggtree(tree)
去掉枝長信息
ggtree(tree,branch.length = "none")
添加文字標(biāo)簽
ggtree(tree,branch.length = "none")+
geom_tiplab(size=1.5)
添加表示Bootstrap值的點(diǎn)
ggtree(tree,branch.length = "none")+
geom_tiplab(size=1.5)+
geom_nodepoint(aes(size=support,x=x-0.5))
變成環(huán)形
ggtree(tree,
branch.length = "none",
layout = "circular")+
geom_tiplab(size=3)+
geom_nodepoint(aes(size=support,x=x-0.5),
color="#8f8fc3")
原文中的圖好像還在文字間添加了虛線段
ggtree(tree,
branch.length = "none",
layout = "circular")+
geom_tiplab(size=3,align = TRUE,offset = 1)+
geom_nodepoint(aes(size=support,x=x-0.5),
color="#8f8fc3")
添加色塊
ggtree(tree,
branch.length = "none",
layout = "circular")+
geom_nodepoint(aes(size=support,x=x-0.5),
color="#8f8fc3")+
geom_strip(taxa1 = "YN-8",
taxa2 = "XZ-4",
offset = 1.5,
barsize = 12,
extend = 0.5,
color="#7c90c8")+
geom_tiplab(size=3,align = TRUE,offset = 1)
把所有色塊加上
ggtree(tree,
branch.length = "none",
layout = "circular")+
geom_nodepoint(aes(size=support,x=x-0.5),
color="#8f8fc3")+
geom_strip(taxa1 = "YN-8",
taxa2 = "YN-3",
offset = 2,
barsize = 20,
extend = 0.5,
color="#7c90c8",
label = "YN",
offset.text = 3)+
geom_strip(taxa1 = "XZ-4",
taxa2 = "XZ-2",
offset = 2,
barsize = 20,
extend = 0.5,
color="#549e34",
label = "XZ",
offset.text = 3)+
geom_strip(taxa1 = "Nepal-12",
taxa2 = "Nepal-8",
offset = 2,
barsize = 20,
extend = 0.5,
color="#ebcc5f",
label = "Nepal",
offset.text = 3)+
geom_strip(taxa1 = "FJ-11",
taxa2 = "FJ-5",
offset = 2,
barsize = 20,
extend = 0.5,
color="#c3e5f5",
label = "FJ/TW",
offset.text = 3)+
geom_strip(taxa1 = "HN-12",
taxa2 = "HN-5",
offset = 2,
barsize = 20,
extend = 0.5,
color="#e95639",
label = "HN",
offset.text = 3)+
geom_strip(taxa1 = "GX-5",
taxa2 = "SC-6",
offset = 2,
barsize = 20,
extend = 0.5,
color="#e5914c",
label = "GX/SC/GZ",
offset.text = 3)+
geom_tiplab(size=3,align = TRUE,offset = 1)
最外圈的文字方向和字體顏色暫時(shí)不知道如何用代碼來調(diào)節(jié),出圖后編輯
最后是調(diào)整圖例位置
ggtree(tree,
branch.length = "none",
layout = "circular")+
geom_nodepoint(aes(size=support,x=x-0.5),
color="#8f8fc3")+
geom_strip(taxa1 = "YN-8",
taxa2 = "YN-3",
offset = 2,
barsize = 20,
extend = 0.5,
color="#7c90c8",
label = "YN",
offset.text = 3)+
geom_strip(taxa1 = "XZ-4",
taxa2 = "XZ-2",
offset = 2,
barsize = 20,
extend = 0.5,
color="#549e34",
label = "XZ",
offset.text = 3)+
geom_strip(taxa1 = "Nepal-12",
taxa2 = "Nepal-8",
offset = 2,
barsize = 20,
extend = 0.5,
color="#ebcc5f",
label = "Nepal",
offset.text = 3)+
geom_strip(taxa1 = "FJ-11",
taxa2 = "FJ-5",
offset = 2,
barsize = 20,
extend = 0.5,
color="#c3e5f5",
label = "FJ/TW",
offset.text = 3)+
geom_strip(taxa1 = "HN-12",
taxa2 = "HN-5",
offset = 2,
barsize = 20,
extend = 0.5,
color="#e95639",
label = "HN",
offset.text = 3)+
geom_strip(taxa1 = "GX-5",
taxa2 = "SC-6",
offset = 2,
barsize = 20,
extend = 0.5,
color="#e5914c",
label = "GX/SC/GZ",
offset.text = 3)+
geom_tiplab(size=3,align = TRUE,offset = 1)+
theme(legend.position = c(0.05,0.15))
示例數(shù)據(jù)可以到論文中去下載
歡迎大家關(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í)筆記撼嗓!