Importing Newick phylogenetic tree with ade4::newick2phylog() fails with moderate size tree
0
0
Entering edit mode
2.0 years ago
ido.idobar ▴ 10

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

phylogenetic Newick ade4 R ape • 752 views