我试图用Rphylopars软件包计算脂肪酸数据集和系统发育树之间的表型协方差矩阵。
我能够加载数据集和系统发育;但是,当我试图运行测试时,我会得到错误消息
类(树)中的错误<- "phylo“:尝试将属性设置为NULL”
这是测试的代码
phy <- read.tree("combined_trees.txt")
plot(phy)
phy$tip.label
FA_data <- read.csv("fatty_acid_example_data.csv", header = TRUE, na.strings = ".")
head(FA_data)
str(FA_data)
PPE <- phylopars(trait_data = FA_data$fatty1_continuous, tree = FA_data$phy)不知道还有什么信息可以帮助解决这个问题。数据集和系统发育没有错误地加载。
发布于 2021-08-30 18:01:22
在教程中,树和特征数据是由simtraits()函数联合模拟的,因此它们最终都是单个列表的元素。在您的情况下(这将是典型的真实数据案例),树和特征数据来自不同的来源,所以您很可能想要。
PPE <- phylopars(trait_data = FA_data, tree = phy)如果FA_data包含与phy中的提示名匹配的第一列species,否则只包含要使用的数值数据(可能只有单个fatty_acid1列)。
作为比较,simtraits()返回的数据结构如下(使用str()):
List of 4
$ trait_data:'data.frame': 45 obs. of 5 variables:
..$ species: chr [1:45] "t7" "t8" "t2" "t3" ...
..$ V1 : num [1:45] 1.338 0.308 1.739 2.009 2.903 ...
..$ V2 : num [1:45] -2.002 -0.115 -0.349 -4.452 NA ...
..$ V3 : num [1:45] -1.74 NA 1.09 -2.54 -1.19 ...
..$ V4 : num [1:45] 2.496 2.712 1.198 1.675 -0.117 ...
$ tree :List of 4
..$ edge : int [1:28, 1:2] 29 29 28 28 27 27 26 26 25 25 ...
..$ edge.length: num [1:28] 0.0941 0.0941 0.6233 0.7174 0.0527 ...
..$ Nnode : int 14
..$ tip.label : chr [1:15] "t7" "t8" "t2" "t3" ...
..- attr(*, "class")= chr "phylo"
..- attr(*, "order")= chr "postorder"
...您可以看到,simtraits()返回一个列表,其中包含(除其他外) (1)一个数据框架,其中species为第一列,其他列为数值列,(2)系统发育树。
你
https://stackoverflow.com/questions/68987568
复制相似问题