BAMMtools 分析BAMM输出结果及可视化
对于BAMM的输出结果分析处理,作者给出了一套完整的工作流程来进行分析和可视化,需要用到的是R包BAMMtools。
参考官网的第八章节:http://bamm-project.org/postprocess.html
下面先用鲸鱼的性状进化分析数据演示
###个人知识储备过少,这一部分很多内容都不理解,有些概念也无法区分(如marginal odds和marginal shift probability),基本上是硬着头皮过一遍,实在无法理解和操作的直接跳过了,基本上没有参考性

1.Test for convergence using the MCMC output with the coda
package for R
BAMM的全称是Bayesian Analysis of Macroevolutionary Mixtures,使用的方法就是贝叶斯,运行后首先就要看看运行是否收敛了。
先绘制对数似然轨迹图(log-likelihood trace)也就是马氏链轨迹图法

选择对前20%的数据丢弃。
用coda包来检查有效事件数
一般这些数值最低需要达到200,这需要提高运行代数。

2.Load event data with getEventData(....)
载入BAMM分析后最重要的数据

3.Generate a phylorate plot with plot.bammdata(....)
绘制进化速率图

如果输入plot.bammdata(...) ,Rstudio会告诉你没有这个函数……

4.Compute the 95% credible set of rate shift configurations using credibleShiftSet
提取在置信区间95%以内的结果集

5.Extract the rate shift configuration with the highest posterior probability with getBestShiftConfiguration
获取后验概率最高的配置
结果如下

当置信区间集合中存在大量配置,所有转换点的置信度都比较低的时候可以使用以下替代方式。
这时,速率转换点得到配置是沿着分支最大边际概率获取的,类似于最大分支可信树的概念,结果可能跟上面获取的‘最佳’结果并不相同。大多数数据集中不推荐使用后一种方式获取。
ps:如果沦落到这种地步可能首先就得考虑数据本身是不是有问题了吧……

6.Visualize random samples from the posterior distribution of rate shifts using plot.bammshifts
为了更直观的来接不同配置,这里将后验和相关配置绘制出来。
同样可以利用ape包来绘制,大同小异,这里不赘述了、

7.Generate phylorate plots for the distinct rate shift configurations in your 95% credible set using plot.credibleshiftset
见5(ps:这顺序够乱的,早知道按下面详解的顺序了)
由于鲸鱼性状的数据实在太糟糕了,后面调用鲸鱼物种多样化速率的数据来操作

8.Evaluate evidence for diversification shifts on each branch with marginalOddsRatioBranches
为直观显示配置的边际概率情况,将枝长转化为对应的边际概率后绘制

计算与观察给定分支上的一个或多个速率转移相关的边际后先验比值比。
绘制后可以得到和上面一样的图

9.Plot rates through time with plotRateThroughTime(...)
阴影为置信区间

获取特定分支的速率图

10.Compute clade-specific marginal distributions of rates with getCladeRates(...)
使用BAMMtools估算枝特异性率,要计算物种形成、灭绝或性状进化的总体速率,可以使用函数getCladeRates,该函数计算焦点分支的平均速率。

11.Macroevolutionary cohort analysis
就是看哪些分支具有相近的进化速率
矩阵越红越相近

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