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


Python LoadTree.getTipNames方法代码示例

本文整理汇总了Python中cogent.LoadTree.getTipNames方法的典型用法代码示例。如果您正苦于以下问题:Python LoadTree.getTipNames方法的具体用法?Python LoadTree.getTipNames怎么用?Python LoadTree.getTipNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cogent.LoadTree的用法示例。


在下文中一共展示了LoadTree.getTipNames方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: BigTreeSingleTests

# 需要导入模块: from cogent import LoadTree [as 别名]
# 或者: from cogent.LoadTree import getTipNames [as 别名]
class BigTreeSingleTests(TestTree):
    """using the big-tree for single-tree tests"""
    def setUp(self):
        self.name = 'big tree - '
        self.otu_names = ['Horse', 'TombBat', 'Rhino', 'Pig', 'AsianElep',
                     'SpermWhal', 'Cat', 'Gorilla', 'Orangutan',
                     'bandicoot', 'Hedgehog', 'Sloth', 'HairyArma',
                     'Manatee', 'GoldenMol', 'Pangolin']
        self.otu_names.sort()
        self.newick = '((((((((FlyingFox,DogFaced),((FreeTaile,LittleBro),(TombBat,RoundEare))),(FalseVamp,LeafNose)),(((Horse,Rhino),(Pangolin,(Cat,Dog))),(Llama,(Pig,(Cow,(Hippo,(SpermWhal,HumpbackW))))))),(Mole,Hedgehog)),(TreeShrew,(FlyingLem,((Jackrabbit,(FlyingSqu,(OldWorld,(Mouse,Rat)))),(Galago,(HowlerMon,(Rhesus,(Orangutan,(Gorilla,(Human,Chimpanzee)))))))))),(((NineBande,HairyArma),(Anteater,Sloth)),(((Dugong,Manatee),((AfricanEl,AsianElep),(RockHyrax,TreeHyrax))),(Aardvark,((GoldenMol,(Madagascar,Tenrec)),(LesserEle,GiantElep)))))),(caenolest,(phascogale,(wombat,bandicoot))));'
        self.newick_reduced = '(((((TombBat,(((Horse,Rhino),(Pangolin,Cat)),(Pig,SpermWhal))),Hedgehog),(Orangutan,Gorilla)),((HairyArma,Sloth),((Manatee,AsianElep),GoldenMol))),bandicoot);'
        self.tree = LoadTree(treestring = self.newick)
    
    def test_getEdgeNames(self):
        """testing (well, exercising at least), getedgenames"""
        # Fell over on small tree because "stem descended from root
        # joiner was a tip"
        a,b = self.otu_names[:2]
        clade = self.tree.getEdgeNames(a, b, True, False)
    
    def test_getTipNames(self):
        """testing (well, exercising at least), getTipNames"""
        a,b = self.otu_names[:2]
        tips = self.tree.getTipNames()
        self.assertEqual(len(tips), 55)
开发者ID:carze,项目名称:clovr-base,代码行数:27,代码来源:test_tree2.py

示例2: test_making_from_list

# 需要导入模块: from cogent import LoadTree [as 别名]
# 或者: from cogent.LoadTree import getTipNames [as 别名]
 def test_making_from_list(self):
     tipnames_with_spaces = ['a_b','a b',"T'lk"]
     tipnames_with_spaces.sort()
     t = LoadTree(tip_names=tipnames_with_spaces)
     result = t.getTipNames()
     result.sort()
     assert result == tipnames_with_spaces
开发者ID:carze,项目名称:clovr-base,代码行数:9,代码来源:test_tree2.py

示例3: load_de_numericized_newick_tree

# 需要导入模块: from cogent import LoadTree [as 别名]
# 或者: from cogent.LoadTree import getTipNames [as 别名]
def load_de_numericized_newick_tree(tree_in,before="'",after="'",root=False):
    from cogent.core.tree import PhyloNode
    from cogent import LoadTree
    import os.path
    
    if os.path.isfile(tree_in):
        tree = LoadTree(tree_in)
    else:
        tree = LoadTree(treestring=tree_in)
    terminals = tree.getTipNames()
    rename_dict = {}
    for tip in terminals:
        rename_dict[tip] = before + str(tip) + after
    tree.reassignNames(rename_dict)
    if root:
        tree = tree.rootAtMidpoint()
    treestring = tree.getNewick(with_distances=True)
    
    return treestring
开发者ID:tanaes,项目名称:codiversification,代码行数:21,代码来源:annotate_nodes_with_sig_values.py


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