我尝试在 python 中使用 ete3 渲染树。这是我的基本代码:
from ete3 import Tree, TreeStyle
t = Tree( "((a,b),c);" )
circular_style = TreeStyle()
circular_style.mode = "c" # draw tree in circular mode
circular_style.scale = 20
t.render("mytree.png", w=183, units="mm", tree_style=circular_style)
我收到此错误消息:
Traceback (most recent call last):
File "test.py", line 9, in <module>
t.render("mytree.png", w=183, units="mm", tree_style=circular_style)
File "/usr/local/bioinfo/src/python/current/lib/python2.7/site-packages/ete3/coretype/tree.py", line 1362, in render
units=units, dpi=dpi)
File "/usr/local/bioinfo/src/python/current/lib/python2.7/site-packages/ete3/treeview/drawer.py", line 104, in render_tree
tree_item, n2i, n2f = render(t, img)
File "/usr/local/bioinfo/src/python/current/lib/python2.7/site-packages/ete3/treeview/qt4_render.py", line 302, in render
render_node_content(node, n2i, n2f, img)
File "/usr/local/bioinfo/src/python/current/lib/python2.7/site-packages/ete3/treeview/qt4_render.py", line 628, in render_node_content
node_ball = _CircleItem(node)
File "/usr/local/bioinfo/src/python/current/lib/python2.7/site-packages/ete3/treeview/qt4_render.py", line 84, in __init__
self.setBrush(QtGui.QBrush(QtGui.QColor(self.node.img_style["fgcolor"])))
TypeError: unable to convert a Python 'str' object to a C++ 'QString' instance
似乎渲染功能不起作用,但我看不出问题出在哪里。有人有线索吗?会不会是版本问题?
谢谢!