系统发育(进化)树绘制小结

1.分析软件

很多很多软件,最常用的有:

  • MEGA
  • PHYLIP

构建进化树一般的步骤是:序列比对,构树(距离法,独立元素法),Booststrap验证。

通常如果是fasta序列,选用方法和软件直接构建就好。

如果要从vcf或hapmap等格式文件构建,则需要做一些处理。可以用类似SNPhylo的流程来处理,它支持VCF,HapMap和简单SNP数据格式作为输入。当你下载安装的时候,你会发现它用的也是PHYLIP,只是在构树前期做了一些文件的格式转换。

2.进化树美化和注释

一般来说,软件都会得到初始的进化树图和树文件,我们肯定不满足于原始的图形,需要做一些个性化处理。

注意事项:

  • 树文件一般是nwk格式(Newick),输出bootstrap值,是按括号冒号等格式来存储信息的。所以名称最好不要带有中英文括号、冒号等信息,否则发生意想不到的错误,如:
(((((Vietnam (Zaodao):0.1446564049,(((珍汕97:0.05176177621,RONGDAO4::IRGC63820-1:0.05245232582):......

中文最好也不要有。实在不能改名,可以一开始用自定义编号绘图,然后把对应的真实名称标注上去也行。

> tree <- read.tree(inname,fileEncoding = 'UTF-8')
Error in FUN(X[[i]], ...) : 
  numbers of left and right parentheses in Newick string not equal

2.1 iTOL美化

可视化功能挺强大的一个网站https://itol.embl.de/
美化图形需要做的主要就是注释,比如物种的分类、多图形整合等。

先注册登录,然后上传树文件,在原始树的基础上,再进行注释,网页面板只能做一些简单的注释。鼠标点击图形也可查看节点、分枝等属性,右击即可设置属性。

image.png
若想做一些较为复杂的注释,需要额外写注释文件。具体注释文件的格式可查看它提供的demo:https://itol.embl.de/help/example_data.zip,试试各种注释文件是怎么做的,依葫芦画瓢(注释文件是用鼠标直接拖入图中的)。比如下面进化树,我用了三层注释:
image.png
第一层:

TREE_COLORS			
SEPARATOR TAB			
DATA			
SP1	range	#FF0000	test
SP2	range	#FF0000	test
SP3	range	#FF0000	test
SP4	range	#FF0000	test

第二层和第三层类似,只是分类标准不同:

DATASET_COLORSTRIP
#lines starting with a hash are comments and ignored during parsing
#select the separator which is used to delimit the data below (TAB,SPACE or COMMA).This separator must be used throught this file (except in the SEPARATOR line, which uses space).

#SEPARATOR TAB
SEPARATOR SPACE
#SEPARATOR COMMA

#label is used in the legend table (can be changed later)
DATASET_LABEL color_strip2

#dataset color (can be changed later)
COLOR #ff0000

#optional settings

#all other optional settings can be set or changed later in the web interface (under 'Datasets' tab)

#maximum width
STRIP_WIDTH 25

#left margin, used to increase/decrease the spacing to the next dataset. Can be negative, causing datasets to overlap.
MARGIN 0

#border width; if set above 0, a black border of specified width (in pixels) will be drawn around the color strip 
BORDER_WIDTH 1
BORDER_COLOR #000

#show internal values; if set, values associated to internal nodes will be displayed even if these nodes are not collapsed. It could cause overlapping in the dataset display.
SHOW_INTERNAL 0

#In colored strip charts, each ID is associated to a color. Color can be specified in hexadecimal, RGB or RGBA notation
#Internal tree nodes can be specified using IDs directly, or using the 'last common ancestor' method described in iTOL help pages
#Actual data follows after the "DATA" keyword
DATA
#ID1 value1
#ID2 value2 
SP1 #00FFFF COL#00FFFF
SP2 #8A2BE2 COL#8A2BE2
SP3 #89d399 COL#89d399
SP4 #89d399 COL#89d399
SP5 #89d399 COL#89d399
.......

标签可以替换:

#use this template to change the leaf labels, or define/change the internal node names (displayed in mouseover popups)
#lines starting with a hash are comments and ignored during parsing
#=================================================================#
#                    MANDATORY SETTINGS                           #
#=================================================================#
#select the separator which is used to delimit the data below (TAB,SPACE or COMMA).This separator must be used throughout this file (except in the SEPARATOR line, which uses space).
SEPARATOR TAB
#SEPARATOR SPACE
#SEPARATOR COMMA
#Internal tree nodes can be specified using IDs directly, or using the 'last common ancestor' method described in iTOL help pages
#=================================================================#
#       Actual data follows after the "DATA" keyword              #
#=================================================================#
DATA

#NODE_ID,LABEL

SP1	HanS
SP2	JiaA
SP3	Jiayou2
......

实在不想看的,在网上多查查。也有一些工具来专门生成注释文件的,如[table2itol](https://github.com/mgoeker/table2itol),曲线救国,我是不想去弄了。

2.2 ggtree

网红教授的成名作,利用R图层迭加实现。
基础图ggtree(read.tree("tree.nwk"))
主要图层如下:

geom_cladelabel	使用条形和文本标签注释分支
geom_hilight	突出显示带矩形的分支
geom_label2	geom_label的修改版本,支持子集
geom_nodelab	节点标签的图层,可以是文本或图像
geom_nodepoint	使用符号点注释内部节点
geom_point2	geom_point的修改版本,支持子集
geom_rootpoint	用符号点注释根节点
geom_text2	geom_text的修改版本,支持子集
geom_tiplab	尖端标签层,可以是文本或图像
geom_tippoint	用符号点注释外部节点
geom_tree	树结构层,支持多种布局

和iTOL差不太多,只是一个GUI,一个用代码,都是需要使用成本。

现在很烦这种调图调参的细节问题,我相信我一定能学会,只是很浪费时间,又不是专门做这个的,不感兴趣不想搞。干啥都要成本,不想打工……,工具人。

https://www.cnblogs.com/tsingke/p/5320202.html
https://www.jianshu.com/p/492a05a3be95
https://www.dazhuanlan.com/2020/04/30/5eaa3f6c22804/

原文地址:https://www.cnblogs.com/jessepeng/p/13880629.html