I've encountered an issue that I'm hoping someone can help with. I constructed a phylogenetic tree using BEAST1 and then extracted the Maximum Credibility Tree using treeannotator. I'm trying to import it into R for editing, but I run into an error when using the read.beast() function from the treeio package:

MCC_tree <- read.beast("/home/MyPC/Downloads/MCC_beast.tre")
Error in FUN(X[[i]], ...) : 
  numbers of left and right parentheses in Newick string not equal

Interestingly, when I attempt to visualize the tree using figtree, it works fine. Likewise, importing into R using read.nexus() works without issues. However, I want to use read.beast() specifically because I need to annotate the "posterior", which I can't do when I import it using read.nexus().

Has anyone encountered a similar issue or have any suggestions on how to resolve this?

Thank you in advance!


1 Answer 1

  1. if you read it into FigTree then in the export in Nexus and perform a "save all trees" it should then read into read.beast().
  2. Use the beast file output before you performed tree annotator operation.

1 or 2. should be read directly into read.beast(). I would try option 2 first.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.