0

Hi I'm trying to reorder all of the trees in a multiphylo object which should just be a form of applying a function over a list, which I have done before. However, I can't seem to get the 'reorder' command from the package APE to work with lapply nor treeapply across a multiphylo object. My function does run across the multiphylo object with lapply but does not actually reorder the trees. It seems to just return the original, unordered trees. Any help would be much appreciated!

Example of my code

Edit: It also doesn't seem to just be my data, I've added a line of code to simulate 100 trees and the function also does not reorder the simulated trees properly.

#I normally read my multiphylo object in from a file, but simulate one 
#here as an example
#trees<-read.trees("multiphyloobject.tre")

#Simulate 100 trees
trees<-pbtree(n=100,scale=10,nsim=100)

myfun <- function(x) {  
reorder(x,order="pruningwise")}

ordtrees<-lapply(trees,myfun)
Community
  • 1
  • 1
zc1
  • 13
  • 4
  • It seems as though reorder and reorder.phylo are not working in general. On simulated trees or my data, neither "cladewise" nor "pruningwise" results in a reordering of any tree. I've tried my computer and another, and I have updated packages... – zc1 Aug 11 '16 at 15:00
  • Turns out ladderize in APE will do this and will run across the multiphylo object in the function posted above. – zc1 Aug 11 '16 at 16:50

0 Answers0