BAMMtools 分析BAMM輸出結(jié)果及可視化
對(duì)于BAMM的輸出結(jié)果分析處理,作者給出了一套完整的工作流程來進(jìn)行分析和可視化,需要用到的是R包BAMMtools。
參考官網(wǎng)的第八章節(jié):http://bamm-project.org/postprocess.html
下面先用鯨魚的性狀進(jìn)化分析數(shù)據(jù)演示
###個(gè)人知識(shí)儲(chǔ)備過少,這一部分很多內(nèi)容都不理解,有些概念也無法區(qū)分(如marginal odds和marginal shift probability),基本上是硬著頭皮過一遍,實(shí)在無法理解和操作的直接跳過了,基本上沒有參考性

1.Test for convergence using the MCMC output with the?coda
?package for R
BAMM的全稱是Bayesian Analysis of Macroevolutionary Mixtures,使用的方法就是貝葉斯,運(yùn)行后首先就要看看運(yùn)行是否收斂了。
先繪制對(duì)數(shù)似然軌跡圖(log-likelihood trace)也就是馬氏鏈軌跡圖法

選擇對(duì)前20%的數(shù)據(jù)丟棄。
用coda包來檢查有效事件數(shù)
一般這些數(shù)值最低需要達(dá)到200,這需要提高運(yùn)行代數(shù)。

2.Load event data with?getEventData(....)
載入BAMM分析后最重要的數(shù)據(jù)

3.Generate a phylorate plot with?plot.bammdata(....)
繪制進(jìn)化速率圖

如果輸入plot.bammdata(...) ,Rstudio會(huì)告訴你沒有這個(gè)函數(shù)……

4.Compute the 95%?credible set of rate shift configurations?using?credibleShiftSet
提取在置信區(qū)間95%以內(nèi)的結(jié)果集

5.Extract the rate shift configuration with the highest posterior probability with?getBestShiftConfiguration
獲取后驗(yàn)概率最高的配置
結(jié)果如下

當(dāng)置信區(qū)間集合中存在大量配置,所有轉(zhuǎn)換點(diǎn)的置信度都比較低的時(shí)候可以使用以下替代方式。
這時(shí),速率轉(zhuǎn)換點(diǎn)得到配置是沿著分支最大邊際概率獲取的,類似于最大分支可信樹的概念,結(jié)果可能跟上面獲取的‘最佳’結(jié)果并不相同。大多數(shù)數(shù)據(jù)集中不推薦使用后一種方式獲取。
ps:如果淪落到這種地步可能首先就得考慮數(shù)據(jù)本身是不是有問題了吧……

6.Visualize random samples from the posterior distribution of rate shifts using?plot.bammshifts
為了更直觀的來接不同配置,這里將后驗(yàn)和相關(guān)配置繪制出來。
同樣可以利用ape包來繪制,大同小異,這里不贅述了、

7.Generate phylorate plots for the distinct rate shift configurations in your 95% credible set using?plot.credibleshiftset
見5(ps:這順序夠亂的,早知道按下面詳解的順序了)
由于鯨魚性狀的數(shù)據(jù)實(shí)在太糟糕了,后面調(diào)用鯨魚物種多樣化速率的數(shù)據(jù)來操作

8.Evaluate evidence for diversification shifts on each branch with?marginalOddsRatioBranches
為直觀顯示配置的邊際概率情況,將枝長(zhǎng)轉(zhuǎn)化為對(duì)應(yīng)的邊際概率后繪制

計(jì)算與觀察給定分支上的一個(gè)或多個(gè)速率轉(zhuǎn)移相關(guān)的邊際后先驗(yàn)比值比。
繪制后可以得到和上面一樣的圖

9.Plot rates through time with?plotRateThroughTime(...)
陰影為置信區(qū)間

獲取特定分支的速率圖

10.Compute clade-specific marginal distributions of rates with?getCladeRates(...)
使用BAMMtools估算枝特異性率,要計(jì)算物種形成、滅絕或性狀進(jìn)化的總體速率,可以使用函數(shù)getCladeRates,該函數(shù)計(jì)算焦點(diǎn)分支的平均速率。

11.Macroevolutionary cohort analysis
就是看哪些分支具有相近的進(jìn)化速率
矩陣越紅越相近

跳過的一些似乎很重要但是無法理解的部分集中于8.6 Bayes factors for model comparison:
http://bamm-project.org/postprocess.html#bayes-factors-for-model-comparison