title: Writing bootstrapped phylogenetic trees generated with Biopython to a file using Bio.Phylo.write()
body: <p>I have a problem exporting BioPython Tree objects (from <code>Bio.Phylo</code>) with bootstrap values. The trees are created directly within my BioPython script based on distance matrices.</p>
  
  <p>The trees basically look good, but when I use the <code>Bio.Phylo.write()</code> function to export them to a file (Newick, NEXUS or phyloXML-format), the bootstrap-support values seem to get exported in a faulty format.  </p>
  
  <p>The tree topology can be displayed nicely e.g. with ITOL or Dendroscope, but the bootstrap-values can not be displayed.</p>
  
  <p>Examples of tree objects and the resulting newick and phyloxml files are shown below. What can I do to export the trees with correct (readable) bootstrap values?</p>
  
  <hr>
  
  <p><strong>Example:</strong></p>
  
  <p>this is what the tree-objects look like in BioPython (example tree with 5 "species" named A-F):</p>
  
  <pre class="lang-py prettyprint-override"><code>Tree(rooted=False)
      Clade(branch_length=0, confidence=100.0, name='Inner3')
          Clade(branch_length=-0.0791666666667, name='A')
          Clade(branch_length=0.0375, confidence=10.0, name='Inner2')
              Clade(branch_length=0.0625, name='C')
              Clade(branch_length=0.104166666667, confidence=40.0, name='Inner1')
                  Clade(branch_length=-0.15, name='D')
                  Clade(branch_length=0.15, name='B')
          Clade(branch_length=0.0791666666667, name='E')
  </code></pre>
  
  <p>when I export this to newick format (--><code>Bio.Phylo.write(mytree,outfile,"newick")</code>), the file ends up like this:</p>
  
  <pre><code>(A:-0.07917,(C:0.06250,(D:-0.15000,B:0.15000)Inner140.00:0.10417)Inner210.00:0.03750,E:0.07917)Inner3100.00:0.00000;
  </code></pre>
  
  <p>As you can see, the confidence values get concatenated with the inner branch labels and thus unreadable (e.g. "Inner140.00" for name="Inner1" and confidence=40.0). </p>
  
  <p>In phyloXML-format, the tree-files look like this:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;phyloxml xmlns="http://www.phyloxml.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.phyloxml.org http://www.phyloxml.org/1.10/phyloxml.xsd"&gt;  
  &lt;phylogeny rooted="false"&gt;
  &lt;clade&gt;
    &lt;name&gt;Inner3&lt;/name&gt;
    &lt;branch_length&gt;0&lt;/branch_length&gt;
    &lt;confidence type="unknown"&gt;100.0&lt;/confidence&gt;
    &lt;clade&gt;
      &lt;name&gt;A&lt;/name&gt;
      &lt;branch_length&gt;-0.0791666666667&lt;/branch_length&gt;
    &lt;/clade&gt;
    &lt;clade&gt;
      &lt;name&gt;Inner2&lt;/name&gt;
      &lt;branch_length&gt;0.0375&lt;/branch_length&gt;
      &lt;confidence type="unknown"&gt;10.0&lt;/confidence&gt;
      &lt;clade&gt;
        &lt;name&gt;C&lt;/name&gt;
        &lt;branch_length&gt;0.0625&lt;/branch_length&gt;
      &lt;/clade&gt;
      &lt;clade&gt;
        &lt;name&gt;Inner1&lt;/name&gt;
        &lt;branch_length&gt;0.104166666667&lt;/branch_length&gt;
        &lt;confidence type="unknown"&gt;40.0&lt;/confidence&gt;
        &lt;clade&gt;
          &lt;name&gt;D&lt;/name&gt;
          &lt;branch_length&gt;-0.15&lt;/branch_length&gt;
        &lt;/clade&gt;
        &lt;clade&gt;
          &lt;name&gt;B&lt;/name&gt;
          &lt;branch_length&gt;0.15&lt;/branch_length&gt;
        &lt;/clade&gt;
      &lt;/clade&gt;
    &lt;/clade&gt;
    &lt;clade&gt;
      &lt;name&gt;E&lt;/name&gt;
      &lt;branch_length&gt;0.0791666666667&lt;/branch_length&gt;
    &lt;/clade&gt;
  &lt;/clade&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p>This looks much better, but the confidence values still aren't recognized by tree vizualization tools such as ITOL (possibly due to the confidence type="unknown" labels?)</p>
  
  <p>What can I do? Modifying the final result files seems risky (what if I actually want leaf labels with keywords such as "inner"?)</p>
  
  <p>Also, I would like to restrict myself to the BioPython modules, as adding additional external Python modules as dependencies makes the tool complicated to implement for cooperation partners.</p>