【问题标题】:Phylogenetic ancestor reconstruction: specify model of unidirectional character state change [ape][phytools]系统发育祖先重建:指定单向字符状态变化的模型 [ape] [phytools]
【发布时间】:2015-03-05 17:09:36
【问题描述】:

假设我有一个系统发育树和我的树的一些字符数据。我知道一个字符是单向的:从 0 到 1 的转换率为正,但从 1 到 0 的转换率为零(例如,0 是二倍体,1 是多倍体)。假设我想对我的树进行祖先重建。我知道我可以使用 Ape 包中的 Ace 或 phytools 包中的 make.simmap 进行祖先重建,但我不知道如何指定单向字符更改的模型。

例子:

require(ape)
require(phytools)

# Generate example tree
set.seed(100)
tree<-rtree(10, rooted=T, tip.label=letters[1:10])
# Example characters
characters<-sample(0:1, 10, replace=T)
names(characters)<-letters[1:10]

# Equal-rates model
mod=matrix(c(0,1,1,0),2)
simmap<-make.simmap(tree, characters, model=mod)
plotSimmap(simmap) # Works fine


# My attempt at a unidirectional model: rate of change from 1 to 0 set to zero
mod = matrix(c(0,0,1,0),2)
simmap<-make.simmap(tree, characters, model=mod) # Gives me error; Error in eigen(mat) : infinite or missing values in 'x'

有人知道该怎么做吗?

【问题讨论】:

    标签: r phylogeny ape-phylo


    【解决方案1】:

    您上面的代码在我使用 R 版本 3.1.2 (2014-10-31) 时运行良好——Windows 下的“南瓜头盔”和新安装的猿和 phytools 版本。 make.simmap 帮助文档讨论了以前版本中的一些错误。

    mod = matrix(c(0,0,1,0),2)
    simmap<-make.simmap(tree, characters, model=mod)
    make.simmap is sampling character histories conditioned on the transition matrix
    #Q =
    #           0         1
    #0 -0.8271365 0.8271365
    #1  0.0000000 0.0000000
    #(estimated using likelihood);
    #and (mean) root node prior probabilities
    #pi =
    #  0   1 
    #0.5 0.5 
    #Done.
    

    【讨论】:

    • 谢谢,我正在使用带有新安装版本的 ape 和 phytools 的 Linux,但它似乎不适合我。我使用了使用 1e-10 而不是 0 的解决方法,这很草率但可以完成工作。我会再弄乱一点,看看我是否不能让它正常工作
    • 我刚刚在 Debian Wheezy 下安装了 ape 和 phytools(使用 R 3.1.2 x86_64 中的 install.packages),你的代码又对我很好。 hth
    猜你喜欢
    • 2023-03-18
    • 2013-09-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-01
    • 1970-01-01
    相关资源
    最近更新 更多