本文整理汇总了Python中ete_dev.Tree.add_child方法的典型用法代码示例。如果您正苦于以下问题:Python Tree.add_child方法的具体用法?Python Tree.add_child怎么用?Python Tree.add_child使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ete_dev.Tree
的用法示例。
在下文中一共展示了Tree.add_child方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Tree
# 需要导入模块: from ete_dev import Tree [as 别名]
# 或者: from ete_dev.Tree import add_child [as 别名]
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]
示例2: TreeStyle
# 需要导入模块: from ete_dev import Tree [as 别名]
# 或者: from ete_dev.Tree import add_child [as 别名]
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
示例3: Tree
# 需要导入模块: from ete_dev import Tree [as 别名]
# 或者: from ete_dev.Tree import add_child [as 别名]
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()
示例4: Tree
# 需要导入模块: from ete_dev import Tree [as 别名]
# 或者: from ete_dev.Tree import add_child [as 别名]
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