本文整理匯總了Python中ete_dev.Tree.is_root方法的典型用法代碼示例。如果您正苦於以下問題:Python Tree.is_root方法的具體用法?Python Tree.is_root怎麽用?Python Tree.is_root使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ete_dev.Tree
的用法示例。
在下文中一共展示了Tree.is_root方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Tree
# 需要導入模塊: from ete_dev import Tree [as 別名]
# 或者: from ete_dev.Tree import is_root [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]