本文整理汇总了Python中skbio.TreeNode.append方法的典型用法代码示例。如果您正苦于以下问题:Python TreeNode.append方法的具体用法?Python TreeNode.append怎么用?Python TreeNode.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类skbio.TreeNode
的用法示例。
在下文中一共展示了TreeNode.append方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setup_linked_list
# 需要导入模块: from skbio import TreeNode [as 别名]
# 或者: from skbio.TreeNode import append [as 别名]
def _setup_linked_list(self, kwargs_list):
last_node = None
for idx, kwargs in enumerate(kwargs_list):
new_node = TreeNode(**kwargs)
if last_node is not None:
new_node.append(last_node)
last_node = new_node
return last_node
示例2: test_missing_tip_name
# 需要导入模块: from skbio import TreeNode [as 别名]
# 或者: from skbio.TreeNode import append [as 别名]
def test_missing_tip_name(self):
"""DndParser should produce the correct tree when missing a name"""
obs = TreeNode.from_newick(missing_tip_name)
exp = TreeNode()
exp.append(TreeNode())
exp.append(TreeNode())
exp.children[0].append(TreeNode(name='a'))
exp.children[0].append(TreeNode(name='b'))
exp.children[1].append(TreeNode(name='c'))
exp.children[1].append(TreeNode())
self.assertEqual(str(obs), str(exp))
示例3: test_nonames
# 需要导入模块: from skbio import TreeNode [as 别名]
# 或者: from skbio.TreeNode import append [as 别名]
def test_nonames(self):
"""DndParser should produce the correct tree when there are no names"""
obs = TreeNode.from_newick(no_names)
exp = TreeNode()
exp.append(TreeNode())
exp.append(TreeNode())
exp.children[0].append(TreeNode())
exp.children[0].append(TreeNode())
exp.children[1].append(TreeNode())
exp.children[1].append(TreeNode())
self.assertEqual(str(obs), str(exp))
示例4: test_gops
# 需要导入模块: from skbio import TreeNode [as 别名]
# 或者: from skbio.TreeNode import append [as 别名]
def test_gops(self):
"""Basic TreeNode operations should work as expected"""
p = TreeNode()
self.assertEqual(str(p), ';\n')
p.name = 'abc'
self.assertEqual(str(p), 'abc;\n')
p.length = 3
self.assertEqual(str(p), 'abc:3;\n') # don't suppress branch from root
q = TreeNode()
p.append(q)
self.assertEqual(str(p), '()abc:3;\n')
r = TreeNode()
q.append(r)
self.assertEqual(str(p), '(())abc:3;\n')
r.name = 'xyz'
self.assertEqual(str(p), '((xyz))abc:3;\n')
q.length = 2
self.assertEqual(str(p), '((xyz):2)abc:3;\n')
示例5: test_minimal
# 需要导入模块: from skbio import TreeNode [as 别名]
# 或者: from skbio.TreeNode import append [as 别名]
def test_minimal(self):
"""DndParser should produce the correct minimal tree"""
obs = TreeNode.from_newick(minimal)
exp = TreeNode()
exp.append(TreeNode())
self.assertEqual(str(obs), str(exp))