Closed kfuku52 closed 1 year ago
Hi @kfuku52 ,
your tree has a root edge read.newick
seems not to handle well.
Something like nwk_txt <- gsub(":0;", ";", nwk_txt)
might work. But why not using read.tree
?
Regards,
Klaus
Thank you for your response. I switched to read.tree()
but just wanted to report it here just in case if this is not intended behavior.
Thanks @kfuku52 for bringing this to my attention & @KlausVigo for your comments. read.newick
is now basically redundant & I should probably synonymize it with read.tree
. As I comment in the help file: "The function read.newick
is almost completely redundant with read.tree
. At the time of development, it was more 'robust' than read.tree
in that it didn't fail if the tree contained so-called 'singles' (nodes with only one descendant); however, read.tree
can now handle singleton nodes without difficulty."
OTOH, I kind of like that it exists as a totally independently coded Newick parser within R.
In fact, the reason I decided to use read.newick()
in a script several years ago was because it was more robust than read.tree()
at that time. I recently tried to reuse that script and encountered the above problem. I agree that the current implementation shouldn't be completely obsolete. If you decide to synonymize them, it would be great if the current implementation could be kept available, perhaps as a legacy mode like read.newick(legacy=TRUE)
.
I was working on 10k trees and got core dumps in around 200 trees in the step of
read.newick()
. ape'sread.tree()
worked well in the identical trees. The R version I tested was 4.1.1. Here is a reproducible example, and I would appreciate it if you could give me any suggestions to solve the problem.Reproducible example
STDOUT