論文
MiDAS 4: A global catalogue of full-length 16S rRNA gene sequences and taxonomy for studies of bacterial communities in wastewater treatment plants
https://www.nature.com/articles/s41467-022-29438-7
數(shù)據(jù)鏈接
https://figshare.com/articles/dataset/Dueholm2021a_data_zip/16566408/1
代碼鏈接
https://github.com/msdueholm/MiDAS4
今天的推文我們重復(fù)一下論文中的Figure2
我試了下論文中提供的數(shù)據(jù)恶座,這個(gè)數(shù)據(jù)量有點(diǎn)大,運(yùn)行要好長(zhǎng)時(shí)間斧账,這里的示例數(shù)據(jù)我們不用論文中的數(shù)據(jù)了榕暇,用自己隨便構(gòu)造的
最基本的進(jìn)化樹可視化
library(ggtree)
library(treeio)
tree <- read.tree("data/20220829/fig2.nwk")
ggtree(tree)+
geom_tiplab()
準(zhǔn)備表示分組的數(shù)據(jù)荡碾,這里需要用到一個(gè)列表格式的數(shù)據(jù)
groupInfo<-list(group1=c("A","B","C","D","E"),
group2=c("F","G","H","I","J","K","L","M"))
然后使用groupOTU()
函數(shù)將分組信息和進(jìn)化樹組合到一起
tree01<-groupOTU(tree,groupInfo)
對(duì)結(jié)果進(jìn)行展示
ggtree(tree01,aes(color=group))+
geom_tiplab(show.legend=F,offset = 1)+
geom_tippoint(aes(shape=group),
show.legend = F,
size=5)
這里 color=group
的group是默認(rèn)生成的便监,不用改
更改配色
ggtree(tree01,aes(color=group),size=2)+
geom_tiplab(show.legend=F,offset = 1)+
geom_tippoint(aes(shape=group),
show.legend = F,
size=5)+
scale_color_manual(values = c("#fb8d63","#69c0a2"))
封面圖
ggtree(tree01,
aes(color=group),
size=2,
layout = "circular",
branch.length = "none")+
geom_tiplab(show.legend=F,offset = 1)+
geom_tippoint(aes(shape=group),
show.legend = F,
size=5)+
scale_color_manual(values = c("#fb8d63","#69c0a2")) -> p1
p1
ggtree(tree01,aes(color=group),size=2)+
geom_tiplab(show.legend=F,offset = 1)+
geom_tippoint(aes(shape=group),
show.legend = F,
size=5)+
scale_color_manual(values = c("#fb8d63","#69c0a2")) -> p2
p2
library(patchwork)
p1+theme(legend.position = "none")+
p2+theme(legend.position = "none")
示例數(shù)據(jù)和代碼可以給推文點(diǎn)贊 點(diǎn)擊在看 最后留言獲取
歡迎大家關(guān)注我的公眾號(hào)
小明的數(shù)據(jù)分析筆記本
小明的數(shù)據(jù)分析筆記本 公眾號(hào) 主要分享:1枪狂、R語(yǔ)言和python做數(shù)據(jù)分析和數(shù)據(jù)可視化的簡(jiǎn)單小例子星持;2抢埋、園藝植物相關(guān)轉(zhuǎn)錄組學(xué)、基因組學(xué)督暂、群體遺傳學(xué)文獻(xiàn)閱讀筆記揪垄;3、生物信息學(xué)入門學(xué)習(xí)資料及自己的學(xué)習(xí)筆記损痰!