导读
上一篇:Phylophlan (一) 下载和安装。使用Phylophlan自带的测试数据,32个细菌的蛋白序列数据,存放在~nsegata-phylophlan/input/example_corynebacteria/文件夹中。使用蛋白数据分析这32个细菌在进化树上的位置关系。
一、输入文件
cd ./input/example_corynebacteria/
ls -alh
# 查看文件,如下:
-rw-r--r-- 1 cheng WST 993973 5月 31 2017 C_accolens_ATCC49725.faa
-rw-r--r-- 1 cheng WST 960388 5月 31 2017 C_accolens_ATCC49726.faa
-rw-r--r-- 1 cheng WST 1155110 5月 31 2017 C_ammoniagenes_DSM20306.faa
-rw-r--r-- 1 cheng WST 950635 5月 31 2017 C_amycolatum_SK46.faa
-rw-r--r-- 1 cheng WST 1122345 5月 31 2017 C_aurimucosum_ATCC700975.faa
-rw-r--r-- 1 cheng WST 1004718 5月 31 2017 C_diphtheriae_NCTC13129.faa
-rw-r--r-- 1 cheng WST 1269305 5月 31 2017 C_efficiens_YS314A.faa
-rw-r--r-- 1 cheng WST 1297573 5月 31 2017 C_efficiens_YS314B.faa
-rw-r--r-- 1 cheng WST 953468 5月 31 2017 C_genitalium_ATCC33030.faa
-rw-r--r-- 1 cheng WST 1122917 5月 31 2017 C_glucuronolyticum_ATCC51866.faa
-rw-r--r-- 1 cheng WST 1096676 5月 31 2017 C_glucuronolyticum_ATCC51867.faa
-rw-r--r-- 1 cheng WST 1325630 5月 31 2017 C_glutamicum_ATCC13032B.faa
-rw-r--r-- 1 cheng WST 1300615 5月 31 2017 C_glutamicum_ATCC13032K.faa
-rw-r--r-- 1 cheng WST 1303860 5月 31 2017 C_glutamicum_R.faa
-rw-r--r-- 1 cheng WST 985711 5月 31 2017 C_jeikeium_ATCC43734.faa
-rw-r--r-- 1 cheng WST 945146 5月 31 2017 C_jeikeium_K411.faa
-rw-r--r-- 1 cheng WST 941388 5月 31 2017 C_kroppenstedtii_DSM44385.faa
-rw-r--r-- 1 cheng WST 988619 5月 31 2017 C_lipophiloflavum_DSM44291.faa
-rw-r--r-- 1 cheng WST 1107897 5月 31 2017 C_matruchotii_ATCC14266.faa
-rw-r--r-- 1 cheng WST 1256303 5月 31 2017 C_matruchotii_ATCC33806.faa
-rw-r--r-- 1 cheng WST 1096831 5月 31 2017 C_pseudogenitalium_ATCC33035.faa
-rw-r--r-- 1 cheng WST 879436 5月 31 2017 C_pseudotuberculosis_1002.faa
-rw-r--r-- 1 cheng WST 882239 5月 31 2017 C_pseudotuberculosis_C231.faa
-rw-r--r-- 1 cheng WST 894331 5月 31 2017 C_pseudotuberculosis_FRC41.faa
-rw-r--r-- 1 cheng WST 880930 5月 31 2017 C_pseudotuberculosis_I19.faa
-rw-r--r-- 1 cheng WST 969612 5月 31 2017 C_resistens_DSM45100.faa
-rw-r--r-- 1 cheng WST 1124033 5月 31 2017 C_striatum_ATCC6940.faa
-rw-r--r-- 1 cheng WST 975616 5月 31 2017 C_tuberculostearicum_SK141.faa
-rw-r--r-- 1 cheng WST 928565 5月 31 2017 C_urealyticum_DSM7109.faa
-rw-r--r-- 1 cheng WST 1288346 5月 31 2017 C_variabile_DSM44702.faa
-rw-r--r-- 1 cheng WST 2447456 5月 31 2017 Streptomyces_outgroup1.faa
-rw-r--r-- 1 cheng WST 3077788 5月 31 2017 Streptomyces_outgroup2.faa
cd ../../
# 回到phylophlan.py主程序路径
time phylophlan.py -u example_corynebacteria --nproc 16
# de novo系统发生/进化分析
# -u:使用用户提供的基因组数据构建系统发生树(进化树)
cd ./output/example_corynebacteria
ls -alh
# 得到两种格式的树文件,如下:
-rw-rw-r-- 1 cheng WST 1437 10月 8 20:19 example_corynebacteria.tree.nwk
-rw-rw-r-- 1 cheng WST 10746 10月 8 20:19 example_corynebacteria.tree.reroot.xml
二、ggtree画进化树
在linux系统中进入R,以example_corynebacteria为R工作环境。
cd ./output/example_corynebacteria
R
开始使用R进行绘图。
绘图代码参考原文:PhyloPhlAn
dir() # 查看工作目录
[1] "example_corynebacteria.tree.nwk"
[2] "example_corynebacteria.tree.reroot.xml"
library(ggplot2) # 加载ggplot2
library(ggtree) # 加载ggtree
tree=read.tree("example_corynebacteria.tree.nwk") # 读取nwk文件
data=fortify(tree)
tregraph=ggtree(tree, layout="rectangular", size=0.8, col="deepskyblue3") +
# 树体:树文件、树形、粗细、颜色
geom_tiplab(size=3, color="purple4", hjust=-0.05) +
# 枝名:大小、颜色、高度
geom_tippoint(size=1.5, color="deepskyblue3") +
# 端点:大小、颜色
geom_nodepoint(color="orange", alpha=1/4, size=2) +
# 末节点:颜色、透明度、大小
theme_tree2() +
# x轴标尺
xlim(NA, max(data$x)*1.3)
# x轴宽度
pdf("tregraph.pdf")
tregraph
dev.off()
打开tregraph.pdf查看结果,如下:
图片.png












网友评论