from ete_dev import Tree # Creates an empty tree and populates it with some new # nodes t = Tree() A = t.add_child(name="A") B = t.add_child(name="B") C = A.add_child(name="C") D = A.add_child(name="D") print t # /-C # /--------| #---------| \-D # | # \-B print 'is "t" the root?', t.is_root() # True print 'is "A" a terminal node?', A.is_leaf() # False print 'is "B" a terminal node?', B.is_leaf() # True print 'B.get_tree_root() is "t"?', B.get_tree_root() is t # True print 'Number of leaves in tree:', len(t) # returns number of leaves under node (3) print 'is C in tree?', C in t # Returns true print "All leaf names in tree:", [node.name for node in t]
from ete_dev import Tree # Creates an empty tree and populates it with some new # nodes t = Tree() A = t.add_child(name="A") B = t.add_child(name="B") C = A.add_child(name="C") D = A.add_child(name="D") print t # /-C # /--------| #---------| \-D # | # \-B print 'is "t" the root?', t.is_root() # True print 'is "A" a terminal node?', A.is_leaf() # False print 'is "B" a terminal node?', B.is_leaf() # True print 'B.get_tree_root() is "t"?', B.get_tree_root() is t # True print 'Number of leaves in tree:', len( t) # returns number of leaves under node (3) print 'is C in tree?', C in t # Returns true print "All leaf names in tree:", [node.name for node in t]
from ete_dev import Tree, TreeStyle, NodeStyle, PhyloTree, faces from ete_dev.treeview.faces import * from ete_dev.treeview.main import random_color, _NODE_TYPE_CHECKER, FACE_POSITIONS sys.path.insert(0, os.path.join(ETEPATH, "examples/treeview")) import face_grid, bubble_map, item_faces, node_style, node_background, face_positions, face_rotation, seq_motif_faces, barchart_and_piechart_faces sys.path.insert(0, os.path.join(ETEPATH, "examples/phylogenies")) import phylotree_visualization main_tree = Tree() main_tree.dist = 0 t, ts = face_grid.get_example_tree() t_grid = TreeFace(t, ts) n = main_tree.add_child() n.add_face(t_grid, 0, "aligned") t, ts = bubble_map.get_example_tree() t_bubble = TreeFace(t, ts) n = main_tree.add_child() n.add_face(t_bubble, 0, "aligned") t, ts = item_faces.get_example_tree() t_items = TreeFace(t, ts) n = main_tree.add_child() n.add_face(t_items, 0, "aligned") t, ts = node_style.get_example_tree() t_nodest = TreeFace(t, ts) n = main_tree.add_child()
from ete_dev import Tree t = Tree() # Creates an empty tree A = t.add_child(name="A") # Adds a new child to the current tree root # and returns it B = t.add_child(name="B") # Adds a second child to the current tree # root and returns it C = A.add_child(name="C") # Adds a new child to one of the branches D = C.add_sister(name="D") # Adds a second child to same branch as # before, but using a sister as the starting # point R = A.add_child(name="R") # Adds a third child to the # branch. Multifurcations are supported # Next, I add 6 random leaves to the R branch names_library is an # optional argument. If no names are provided, they will be generated # randomly. R.populate(6, names_library=["r1", "r2", "r3", "r4", "r5", "r6"]) # Prints the tree topology print t # /-C # | # |--D # | # /--------| /-r4 # | | /--------| # | | /--------| \-r3 # | | | | # | | | \-r5 # | \--------| # ---------| | /-r6 # | | /--------| # | \--------| \-r2
ts = TreeStyle() ts.mode = "c" ts.arc_span = 360 ts.layout_fn = layout ts.show_leaf_name = False ts.show_border = True ts.draw_guiding_lines = False ts.show_scale = True #ts.scale = 60 t = Tree() t.dist = 0 t.size = 0, 0 for x in xrange(100): n = t.add_child() n = n.add_child() n = n.add_child() n2 = n.add_child() n3 = n.add_child() n4 = n2.add_child() n5 = n3.add_child() # n.size = (10, 10) # n2.size = (10, 70) # n3.size = (40, 40) # n4.size = (10, 10) #n2.size = 10 #n3.size = 10 #n5.size = 10 #n2.dist = 0.1 #n2.size = 1
ts = TreeStyle() ts.mode = "c" ts.arc_span = 360 ts.layout_fn = layout ts.show_leaf_name = False ts.show_border = True ts.draw_guiding_lines = False ts.show_scale = True #ts.scale = 60 t = Tree() t.dist = 0 t.size = 0,0 for x in xrange(100): n = t.add_child() n = n.add_child() n = n.add_child() n2 = n.add_child() n3 = n.add_child() n4 = n2.add_child() n5 = n3.add_child() # n.size = (10, 10) # n2.size = (10, 70) # n3.size = (40, 40) # n4.size = (10, 10) #n2.size = 10 #n3.size = 10 #n5.size = 10 #n2.dist = 0.1 #n2.size = 1
from ete_dev import Tree t = Tree() # Creates an empty tree A = t.add_child(name="A") # Adds a new child to the current tree root # and returns it B = t.add_child(name="B") # Adds a second child to the current tree # root and returns it C = A.add_child(name="C") # Adds a new child to one of the branches D = C.add_sister(name="D") # Adds a second child to same branch as # before, but using a sister as the starting # point R = A.add_child(name="R") # Adds a third child to the # branch. Multifurcations are supported # Next, I add 6 random leaves to the R branch names_library is an # optional argument. If no names are provided, they will be generated # randomly. R.populate(6, names_library=["r1","r2","r3","r4","r5","r6"]) # Prints the tree topology print t # /-C # | # |--D # | # /--------| /-r4 # | | /--------| # | | /--------| \-r3 # | | | | # | | | \-r5 # | \--------| # ---------| | /-r6 # | | /--------| # | \--------| \-r2