Answers.Body: <ol>
  <li>if you read it into FigTree then in the export in Nexus and perform a &quot;save all trees&quot;  it should then read into <code>read.beast()</code>.</li>
  <li>Use the beast file output before you performed tree annotator operation.</li>
  </ol>
  <p>1 or 2. should be read directly into <code>read.beast()</code>.
  I would try option 2 first.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-10-12T12:11:18.287Z
Answers.LastActivityDate: 2023-10-12T13:23:07.753Z
Answers.LastEditDate: 2023-10-12T13:23:07.753Z
Answers.UserDisplayName: M__
Body: <p>I've encountered an issue that I'm hoping someone can help with. I constructed a phylogenetic tree using <strong>BEAST1</strong> and then extracted the Maximum Credibility Tree using treeannotator. I'm trying to import it into <strong>R</strong> for editing, but I run into an error when using the <code>read.beast()</code> function from the <strong>treeio</strong> package:</p>
  <pre><code>MCC_tree &lt;- read.beast(&quot;/home/MyPC/Downloads/MCC_beast.tre&quot;)
  Error in FUN(X[[i]], ...) : 
    numbers of left and right parentheses in Newick string not equal
  </code></pre>
  <p>Interestingly, when I attempt to visualize the tree using figtree, it works fine. Likewise, importing into R using <code>read.nexus()</code> works without issues. However, I want to use <code>read.beast()</code> specifically because I need to annotate the &quot;posterior&quot;, which I can't do when I import it using <code>read.nexus()</code>.</p>
  <p>Has anyone encountered a similar issue or have any suggestions on how to resolve this?</p>
  <p>Thank you in advance!</p>
  
Tags: <r><phylogenetics><phylogeny><bioconductor><ggtree>
Title: Error importing Maximum Credibility Tree from BEAST into R using treeio's read.beast()
ThreadText: # Error importing Maximum Credibility Tree from BEAST into R using treeio's read.beast()
  
  (Asked by: username_0 on 2023-10-12)
  
  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!
  
  **Tags:** r, phylogenetics, phylogeny, bioconductor, ggtree
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-10-12. Score: 0
  
  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.
  
  
  ---
  
  