-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slow conversion between data.tree and Newick format #92
Comments
That is indeed a bit slow :-( |
Apparently, recursive programming is not ideal inside R :-(, e.g. http://dirk.eddelbuettel.com/blog/2011/09/08/#rcpp_for_recursion So, there should be some workaround possible ("memoization") but that would sort-of destroy the whole approach of the data.tree package. So, pass everything to C? |
As we are talking a few hundred nodes, recursion is not the problem. Rather, the current If you don't need the height in your Newick, the simplest solution is to avoid it, like so:
If you need the plot height, a workaround is to cache the plot height attribute on the nodes, like so:
Then, instead of providing a heightAttribute function, provide the name of the cached attribute:
I need to figure out whether there is a clean way to fix this for good in the |
This is exactly what I was looking for!! This cut down the time to convert a tree with 5971 tips and 1631 internal nodes, from several(!!) minutes to just 2 secs!:
Perhaps this is the cause of slowdowns in other conversions like For context, I'm trying to convert a json file via In the long term, I wonder how hard it would to implement some parts in rcpp? I'm hoping this can be my go to package for hierarchical data. There really is a lack of tools in R for stuff like json. I'd be willing to spend some time if needed to work on this. Since I really need a way to work with and visualize large json structures, any suggestions for alternatives is fine too.. |
Is there a way to speed up this conversion, specifically with
ToNewick
?The text was updated successfully, but these errors were encountered: