Description
Internal function FastXtreePhylo, which is called by many functions in PDcalc, relies on phylogenetic trees being coded (in the ape package) in cladewise order. If a tree is not in cladewise order, the mapping of terminal taxa to internal branches (done by FastXtreePhylo) will be incorrect. If the mapping is incorrect, the results of the PD calculation (whatever it is) will be incorrect.
A tree will be in cladewise order automatically when it is read in by the read.tree function in the ape package. So, this will only be a problem if the tree is subsequently altered from this initial state in such a way as to affect cladewise order. The bifurcatr function in PDcalc will break cladewise order. I have recently noticed that extract.clade (ape package) also seems to break cladewise order.
A simple workaround is to write the tree to file (ape::write.tree) and then read it back in again (ape::read.tree).
Since FastXtreePhylo is efficient specifically because it exploits cladewise order, it will probably need to be ultimately replaced with a more robust (and likely slower) solution.