pd cannot use ultrametric tree(?)
sagitaninta opened this issue · 1 comments
I don't know if I understand pd()
correctly, but I think I should be able to calculate PD with ultramteric tree. However, when I calculated PD using pd()
function of picante
using my ultrametric tree that I made using upgma()
function from phangorn
, I got the following error message:
Error in ages[n] <- anc.age + phy$edge.length[n] : replacement has length zero
Based on the error message, the problem might be on the internal function node.age
. If I understood the function correctly, it tries to return the age of the nodes based on its branch length, but when it tries to identify the root node using rootN = phy$edge[1, 1]
, I found that my ultrametric tree's root node is not in phy$edge[1, 1]
. Instead, the root node is on the last row of the first column in phy$edge
(maybe something like phy$edge[nrow(phy$edge),1]
). I don't know how to fix this as I am not confident I identify how the function works correctly.
When I tried to calculate the same sample with the same ultrametric tree but do not include root (include.root=FALSE
), the pd()
function works, but it returns the same value of PD that I got when I use pd()
with the same sample but with tree made using neighbor-joining method.
This is an issue with the method used to root the tree, please see help for ape::root