软件介绍:
MEGACC 是 MEGA 的命令行版本,能在无图形界面的环境里进行进化分析,软件地址:https://www.megasoftware.net/
ggtree是Y叔开发的R包,主要用于进化树结果的可视化,软件地址:https://bioconductor.org/packages/release/bioc/html/ggtree.html
plink格式的数据进化树分析步骤:
1,计算亲缘关系距离矩阵
plink --file aa --allow-extra-chr --chr-set 60 --distance 1-ibs square flat-missing --genome --out IBSdis
2,整理结果
将id结果和亲缘关系结果分别整理为megacc支持的格式:
id名称格式:
亲缘关系矩阵格式:
3,将上面的两个文件整理为megacc支持的格式
上面是ID信息,下面是半三角的关系矩阵:
4,使用megacc计算进化树,得到nwk文件
megacc -a infer_NJ_distances.mao -d ibs_dismatrix.meg -o mega_IBSout
5,使用ggtree绘制进化树
library(ggtree)
tree = read.tree("mega_IBSout.nwk")
# 正常的图
tiff("tree1_plot.tiff",width = 12, height = 8, units = "in",compression = "lzw",res=300)
ggtree(tree, ladderize = FALSE, branch.length = "none") + geom_tiplab2(size=.1) + theme(legend.position = "right")
dev.off()
# 圆圈图
tiff("tree2_plot.tiff",width = 12, height = 8, units = "in",compression = "lzw",res=300)
ggtree(tree, layout="fan", ladderize = FALSE, branch.length = "none") + geom_tiplab2(size=.3) + theme(legend.position = "right")
dev.off()
结果:
也可以添加分组信息: