当前位置: 首页>>代码示例>>Python>>正文


Python Tree.add_child方法代码示例

本文整理汇总了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]
开发者ID:MikeTrizna,项目名称:ete,代码行数:23,代码来源:tree_basis.py

示例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
开发者ID:MikeTrizna,项目名称:ete,代码行数:32,代码来源:test_scale.py

示例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()
开发者ID:MikeTrizna,项目名称:ete,代码行数:33,代码来源:test_treeview.py

示例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
开发者ID:MikeTrizna,项目名称:ete,代码行数:33,代码来源:create_trees_from_scratch.py


注:本文中的ete_dev.Tree.add_child方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。