etetoolkit / ete

Python package for building, comparing, annotating, manipulating and visualising trees. It provides a comprehensive API and a collection of command line tools, including utilities to work with the NCBI taxonomy tree.
http://etetoolkit.org
GNU General Public License v3.0
798 stars 214 forks source link

load/write sequence in newick format=1 forgets root node internal name #242

Closed jmichalon closed 8 years ago

jmichalon commented 8 years ago

Hi,

If I have a Tree() with an internal name on root node, that name is not written when using the write() method in fomat=1. Looking at the example at http://etetoolkit.org/docs/latest/tutorial/tutorial_trees.html#writing-newick-trees we clearly see that the label "Root" is there at load, but not at write. Working around by adding a fake root ontop does the job for me.

Using ete3-3.0.0b35 from pip.

jhcepas commented 8 years ago

use write(..., format_root_node=True) Not default for backwards compatibility: http://etetoolkit.org/docs/latest/reference/reference_tree.html#ete3.TreeNode.write

jmichalon commented 8 years ago

Oops sorry for the noise… maybe worth updating the example then :P Thanks for your superfast answer!

jhcepas commented 8 years ago

no problem, we really need to review the tutorial and examples to reflect all these new options

fungs commented 5 years ago

I stumbled over the same issue. Especially when you are rerooting etc. the default behaviour can be an issue. Can the be a format flag which is most flexible with everything (like internal labels, support, root label etc.)?