Hi,
I am trying to use ete2 on a toy PhyloXml file, but failed to plot the phylogeny tree. Here is the PhyloXml file (
https://github.com/homopolymer/PyroTools/blob/master/wiki/61_otus.phyloxml).
I use the following code to display the tree along with the internal branch labels.
#---begin--
from ete2 import Phyloxml
from ete2 import Tree, TreeStyle, NodeStyle, faces, AttrFace
# load xml file
project = Phyloxml()
project.build_from_file('61_otus.phyloxml')
# get the phylogeny tree
tree=project.get_phylogeny()[0]
# define layout function
def layout(node):
N = AttrFace("name", fsize=14, fgcolor="black")
faces.add_face_to_node(N, node, 0)
# set tree style
ts=TreeStyle()
ts.layout_fn=layout
tree.show(tree_style=ts)
#---finish---
Here are the error messages when running the above script. I don't know what's wrong here. Sincerely appreciate if someone could give a hint or help.
#------------see below--------------------------------
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ete2-2.3.1-py2.7.egg/ete2/coretype/tree.py", line 1335, in show
tree_style=tree_style, win_name=name)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ete2-2.3.1-py2.7.egg/ete2/treeview/drawer.py", line 76, in show_tree
tree_item, n2i, n2f = render(t, img)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ete2-2.3.1-py2.7.egg/ete2/treeview/qt4_render.py", line 268, in render
update_node_faces(n, n2f, img)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ete2-2.3.1-py2.7.egg/ete2/treeview/qt4_face_render.py", line 389, in update_node_faces
faceblock[position] = _FaceGroupItem(all_faces, node, as_grid=as_grid)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ete2-2.3.1-py2.7.egg/ete2/treeview/qt4_face_render.py", line 101, in __init__
self.update_columns_size()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ete2-2.3.1-py2.7.egg/ete2/treeview/qt4_face_render.py", line 143, in update_columns_size
width = f._width() + f.margin_right + f.margin_left
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ete2-2.3.1-py2.7.egg/ete2/treeview/faces.py", line 310, in _width
return self.get_bounding_rect().width()
AttributeError: 'NoneType' object has no attribute 'width'