R 系统发育祖先重建:指定单向性状状态变化模型[ape][phytools]
假设我有一个系统发育树和一些特征数据。我知道有一个字符是单向的:从0到1的转换速率是正的,但是从1到0的转换速率是零(例如,0是二倍体,1是多倍体)。假设我想重建我的树的祖先。我知道我可以使用Ape包中的Ace,或者phytools包中的make.simmap来进行祖先重建,但我不知道如何指定单向角色更改的模型 例如:R 系统发育祖先重建:指定单向性状状态变化模型[ape][phytools],r,phylogeny,ape-phylo,R,Phylogeny,Ape Phylo,假设我有一个系统发育树和一些特征数据。我知道有一个字符是单向的:从0到1的转换速率是正的,但是从1到0的转换速率是零(例如,0是二倍体,1是多倍体)。假设我想重建我的树的祖先。我知道我可以使用Ape包中的Ace,或者phytools包中的make.simmap来进行祖先重建,但我不知道如何指定单向角色更改的模型 例如: require(ape) require(phytools) # Generate example tree set.seed(100) tree<-rtree(10,
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'
require(ape)
需要(植物醇)
#生成示例树
种子集(100)
tree使用R版本3.1.2(2014-10-31)——Windows下的“南瓜头盔”,以及新安装的ape和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.
mod=矩阵(c(0,0,1,0),2)
SimmapThank,我正在使用Linux和新安装的ape和phytools版本,它似乎不适合我。我使用了使用1e-10而不是0的变通方法,这是一种草率的方法,但可以完成工作。我会再胡闹一点,看看我是否能让它正常工作。我只是在Debian Wheezy下安装了ape和phytools(使用R 3.1.2 x86_64中的install.packages),你的代码对我来说又很好。嗯