Hi,
I'm trying to use the iNextPD R package to estimate phylogenetic diversity and one of the required input is a phylogenetic tree as a phylog
object, which can be generated with the newick2phylog()
function from ade4 package.
However, when I try this function with my Newick tree (generated by QIIME), R just process the command for hours and occupies all available RAM without proceeding.
I'm not sure if the problem is with my tree file or the function itself, but it does import properly as a phylo
object with read.tree()
function from ape package, so if there's a way to convert an ape::phylo
object to ade4::phylog
object it would be helpful as well.
This is the code that I'm using and the tree file can be downloaded here:
library(ade4)
library(ape)
# importing the tree as a 'phylo' object
tree.phylo <- read.tree("rep_set.tre") # this works
# read the tree as a character string
tree.nw <- scan("rep_set.tre", what="character")
# import the tree as a 'phylog' object
bact.phy <- newick2phylog(tree.nw) # does not finish and leaks memory
Many thanks for your help, Ido