在python

时间:2017-09-01 13:03:41

标签: python render ete3

我尝试在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

渲染功能似乎不起作用,但我不知道问题出在哪里。有人有线索吗?这可能是版本的问题吗?

谢谢!

0 个答案:

没有答案