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
791 stars 214 forks source link

SVGFace error #346

Open biofilos opened 6 years ago

biofilos commented 6 years ago

I am trying to replicate the procedure posted here (https://groups.google.com/forum/#!topic/etetoolkit/rPNdMWzCirk), but I get the error ` from ete3 import Tree, SVGFace t = Tree("((A, B), (C, D));") f = SVGFace("svg.svg", width=10) f2 = SVGFace("svg.svg", height=10) f3 = SVGFace("svg.svg", height=20, width=10)

(t&"A").add_face(f, 1, 'branch-right') (t&"C").add_face(f2, 1, 'branch-right') t.add_face(f3, 0, 'branch-top') t.show() --------------------------------------------------------------------------- TypeError Traceback (most recent call last)

in () 7 (t&"C").add_face(f2, 1, 'branch-right') 8 t.add_face(f3, 0, 'branch-top') ----> 9 t.show() ~/anaconda3/lib/python3.6/site-packages/ete3/coretype/tree.py in show(self, layout, tree_style, name) 1333 from ..treeview import drawer 1334 drawer.show_tree(self, layout=layout, -> 1335 tree_style=tree_style, win_name=name) 1336 1337 def render(self, file_name, layout=None, w=None, h=None, \ ~/anaconda3/lib/python3.6/site-packages/ete3/treeview/drawer.py in show_tree(t, layout, tree_style, win_name) 74 """ Interactively shows a tree.""" 75 scene, img = init_scene(t, layout, tree_style) ---> 76 tree_item, n2i, n2f = render(t, img) 77 scene.init_values(t, img, n2i, n2f) 78 ~/anaconda3/lib/python3.6/site-packages/ete3/treeview/qt4_render.py in render(root_node, img, hide_root) 266 virtual_leaves += 1 267 --> 268 update_node_faces(n, n2f, img) 269 270 rot_step = float(arc_span) / virtual_leaves ~/anaconda3/lib/python3.6/site-packages/ete3/treeview/qt4_face_render.py in update_node_faces(node, n2f, img) 387 as_grid = False 388 --> 389 faceblock[position] = _FaceGroupItem(all_faces, node, as_grid=as_grid) 390 391 # all temp and fixed faces are now referenced by the faceblock, so ~/anaconda3/lib/python3.6/site-packages/ete3/treeview/qt4_face_render.py in __init__(self, faces, node, as_grid) 99 self.h = 0 100 # updates the size of this grid --> 101 self.update_columns_size() 102 103 def set_min_column_widths(self, column_widths): ~/anaconda3/lib/python3.6/site-packages/ete3/treeview/qt4_face_render.py in update_columns_size(self, norender) 137 f.update_pixmap() 138 elif f.type == "item" and not norender: --> 139 f.update_items() 140 elif f.type == "text" and f.rotation: 141 f.tight_text = False ~/anaconda3/lib/python3.6/site-packages/ete3/treeview/faces.py in update_items(self) 2230 if not self.width: 2231 self.xscale = self.yscale -> 2232 self.item.scale(self.xscale, self.yscale) 2233 2234 def _width(self): TypeError: scale(self): too many arguments` Any help debugging the issue would be greatly appreciated Thank you
biofilos commented 6 years ago

If I change my environment from anaconda (which I used for the example above) to virtualenv (Python 3.6.4), the image is generated, but the svg is still rendered as a bitmap

jhcepas commented 6 years ago

Yes, that's a limitation of the SVG redering options in Qt. I am not sure if there is any easy way to solve it...

On 16 April 2018 at 02:04, Juan Felipe Ortiz notifications@github.com wrote:

If I change my environment from anaconda (which I used for the example above) to virtualenv (Python 3.6.4), the image is generated, but the svg is still rendered as a bitmap

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/etetoolkit/ete/issues/346#issuecomment-381448932, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJ_SmASzlK8MR7GI24i27tF4aDeNNUdks5to-AqgaJpZM4TVs-W .

Jeremias-Brand commented 6 years ago

Hi Guys,

I am having the same issue. I'm working with anaconda 4.3 on Windows 10. Switching to a virtual env based on python 3.6.4 as the original poster suggests did not fix my issue.:


TypeError Traceback (most recent call last)

in () 8 (t&"C").add_face(f2, 1, 'branch-right') 9 t.add_face(f3, 0, 'branch-top') ---> 10 t.show() 11 #t.render("svg_face_example.svg") ~\Anaconda3\envs\ete3-p36\lib\site-packages\ete3\coretype\tree.py in show(self, layout, tree_style, name) 1333 from ..treeview import drawer 1334 drawer.show_tree(self, layout=layout, -> 1335 tree_style=tree_style, win_name=name) 1336 1337 def render(self, file_name, layout=None, w=None, h=None, \ ~\Anaconda3\envs\ete3-p36\lib\site-packages\ete3\treeview\drawer.py in show_tree(t, layout, tree_style, win_name) 74 """ Interactively shows a tree.""" 75 scene, img = init_scene(t, layout, tree_style) ---> 76 tree_item, n2i, n2f = render(t, img) 77 scene.init_values(t, img, n2i, n2f) 78 ~\Anaconda3\envs\ete3-p36\lib\site-packages\ete3\treeview\qt4_render.py in render(root_node, img, hide_root) 266 virtual_leaves += 1 267 --> 268 update_node_faces(n, n2f, img) 269 270 rot_step = float(arc_span) / virtual_leaves ~\Anaconda3\envs\ete3-p36\lib\site-packages\ete3\treeview\qt4_face_render.py in update_node_faces(node, n2f, img) 387 as_grid = False 388 --> 389 faceblock[position] = _FaceGroupItem(all_faces, node, as_grid=as_grid) 390 391 # all temp and fixed faces are now referenced by the faceblock, so ~\Anaconda3\envs\ete3-p36\lib\site-packages\ete3\treeview\qt4_face_render.py in __init__(self, faces, node, as_grid) 99 self.h = 0 100 # updates the size of this grid --> 101 self.update_columns_size() 102 103 def set_min_column_widths(self, column_widths): ~\Anaconda3\envs\ete3-p36\lib\site-packages\ete3\treeview\qt4_face_render.py in update_columns_size(self, norender) 137 f.update_pixmap() 138 elif f.type == "item" and not norender: --> 139 f.update_items() 140 elif f.type == "text" and f.rotation: 141 f.tight_text = False ~\Anaconda3\envs\ete3-p36\lib\site-packages\ete3\treeview\faces.py in update_items(self) 2230 if not self.width: 2231 self.xscale = self.yscale -> 2232 self.item.scale(self.xscale, self.yscale) 2233 2234 def _width(self): TypeError: scale(self): too many arguments
Jeremias-Brand commented 6 years ago

I have now also tested the SVGFace function on my virtual machine running Ubuntu - with the same results. SVG rendering is a great additon to the ete3 framework and would be useful to me so I hope we can find a solution to this problem. Thanks for your help.