作者gsuper (Logit(odds))
看板BioMedInfo
标题[笔记] Phylogenetic diversity 的算法
时间Wed Oct 30 23:24:50 2013
已知一有根演化树 (rooted phylogenetic tree)
8 tips (树梢,尖端) , 4+2 internal nodes (树节)
----------------------------------------------------------
文字档案如下 "123.tree"
(
( (A1:0.01,A2:0.01
):0.45 ,
(B1:0.02,B2:0.02
):0.44
):0.54,
( (C1:0.03,C2:0.03
):0.37 ,
(D1:0.04,D2:0.04
):0.36
):0.60
);
冒号前方是 Node label 或 Internal node
冒号後方是 Distance from lower node to upper (edge length)
**Internal node 似乎也有命名法则 , 放在文末补充
----------------------------------------------------------
画出的树型如下
root
/ \
/ \
/ \
0.54 / \ 0.60
/ \
/ \
/ \
M1 M2
/\ /\
/ \ / \
0.45 / \ 0.44 0.37 / \ 0.36
/ \ / \
/ \ / \
N1 N2 N3 N4
/\ /\ /\ /\
0.01 / \ 0.02 / \ / \ 0.03 / \ 0.04
/ \ / \ / \ / \
A1 A2 B1 B2 C1 C2 D1 D2
--------------------------------------------------------
由文字档案得知 Distance
(A1 to N1) = 0.01 = (A2 to N1)
(B1 to N2) = 0.02 = (B2 to N2)
(C1 to N3) = 0.03 = (C2 to N3)
(D1 to N4) = 0.04 = (D2 to N4)
(N1 to M1) = 0.45
(N2 to M1) = 0.44
(N3 to M2) = 0.37
(N4 to M2) = 0.36
(M1 to root) = 0.54
(M2 to root) = 0.60
任一 tips 往上加至 root 的总和相等 (此 case 为 1)
----------------------------------------------------
PD 计算
假设给资料矩阵 , 共6样本
A1 A2 B1 B2 C1 C2 D1 D2
样本1 1 0 0 0 0 0 0 0
样本2 0.5 0.5 0 0 0 0 0 0
样本3 0.5 0 0.5 0 0 0 0 0
样本4 1 0 1 0 0 0 0 0
样本5 0.3 0 0.7 0 0 0 0 0
样本6 0.3 0 0.2 0 0.1 0 0.4 0
---------------------------------------------------
Ans :
样本1 = 0.01 + 0.45 + 0.54 = 1 (左侧整条相加)
样本2 = (0.01 + 0.01) + 0.45 + 0.54 = 1.01 (由 hit tips 开始往上加 ,
重复路径不重算)
样本3 = 0.01 + 0.02 + 0.45 + 0.44 + 0.54 = 1.56 (验证上述)
样本4 = 同上 (不需要 input proportion data
样本5 = 同上 (不考虑权重关系)
样本6 = A1->N1->M1->root
B1->N2->M1 (M1->root 重复 , 不重复计算)
C1->N3->M2->root
D1->N4->M2 (M2->root 重复 , 不重复计算)
-----------------------------------------------------
Tool::R package::picante
http://phylodiversity.net/skembel/r-workshop/biodivR/SK_Biodiversity_R.html
tree <- read.tree("123.tree")
result <- pd(资料矩阵,tree)
比较麻烦的点 , 是准备 Tree file 这步骤
得各凭本事
-----------------------------------------------------
补充 : internal node 的命名法则 (完整呈献此篇文章的 tree)
(
( (A1:0.01,A2:0.01)
N1:0.45 , (B1:0.02,B2:0.02)
N2:0.44 )
M1:0.54,
( (C1:0.03,C2:0.03)
N3:0.37 , (D1:0.04,D2:0.04)
N4:0.36 )
M2:0.60
)
root;
-----------------------------------------------------
这篇是当笔记用
不然过两下我就忘了怎麽算了
将来若有其他新学到的
也会在此篇继续更新
--
我用名为真心的卡牌说服你
这是我最後一张牌
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.113.239.247
※ 编辑: gsuper 来自: 140.113.239.247 (10/30 23:25)
※ 编辑: gsuper 来自: 140.113.239.247 (10/30 23:26)
※ 编辑: gsuper 来自: 140.113.239.247 (10/30 23:26)
※ 编辑: gsuper 来自: 140.113.239.247 (10/30 23:27)
※ 编辑: gsuper 来自: 140.113.239.247 (10/30 23:28)
※ 编辑: gsuper 来自: 140.113.239.247 (10/30 23:31)
※ 编辑: gsuper 来自: 140.113.239.247 (10/30 23:31)
※ 编辑: gsuper 来自: 140.113.239.247 (10/30 23:33)
※ 编辑: gsuper 来自: 140.113.239.247 (10/30 23:34)
※ 编辑: gsuper 来自: 140.113.239.247 (10/30 23:36)
※ 编辑: gsuper 来自: 140.113.239.247 (10/30 23:37)
※ 编辑: gsuper 来自: 140.113.239.247 (10/30 23:38)
※ 编辑: gsuper 来自: 140.113.239.247 (10/30 23:38)
※ 编辑: gsuper 来自: 140.113.239.247 (10/30 23:46)
※ 编辑: gsuper 来自: 140.113.239.247 (10/30 23:47)
※ 编辑: gsuper 来自: 140.113.239.247 (10/30 23:51)
※ 编辑: gsuper 来自: 140.113.239.247 (10/30 23:52)
※ 编辑: gsuper 来自: 140.113.239.247 (10/31 00:57)
※ 编辑: gsuper 来自: 140.113.239.247 (10/31 00:58)
※ 编辑: gsuper 来自: 140.113.239.247 (10/31 00:58)
1F:推 Godkin: 11/02 02:44
UniFrac distance
a beta distance between two samples based on phylogenetic tree
Asample Bsample
Bacteria1 0.3 0
Bac2 0 0.2
Bac3 0.5 0.8
Bac4 0.2 0
资料矩阵是 proportion
我改天继续更新这篇
※ 编辑: gsuper 来自: 219.70.232.197 (02/07 22:46)