系統發育(進化)樹繪制小結


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/


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM