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


Python LoadTree.getNodeNames方法代码示例

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


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

示例1: MatchNodes

# 需要导入模块: from cogent import LoadTree [as 别名]
# 或者: from cogent.LoadTree import getNodeNames [as 别名]
 def MatchNodes(self):
     #print "YAY"
     self.correctForFastMLNameChanges() #performs the correction on the output string if necessary
     #print "NAY"
     TerminiStringToNodeName_D = {}
     #a termini string is prepared for each internal node, that is, all termini under the internal node sorted an placed into a single string
     
     for NodeKey in self.UpperKey_L:
         TerminiStringToNodeName_D['-'.join(sorted(self.Nodes_D[NodeKey]['terminal']))] = NodeKey
     
     #prepares a cogent tree object for the fastML output
     FH = getInputTempFile(self.FastMLOutputTreeString)
     
     FastMLCogentTree = LoadTree(FH.name)
     
     
     self.FastMLToOriginalMatchedNodes_D = {}
     
     #for each cogent node in the FastML cogent tree
     for FastMLCogentNodeKey in FastMLCogentTree.getNodeNames():
         
         #a termini string is prepared for the fastML node
         FastMLCogentNode = FastMLCogentTree.getNodeMatchingName(FastMLCogentNodeKey)
         FastMLTermini_L = [tip.Name for tip in FastMLCogentNode.iterTips()]
         
         #if it has more than 0 termini under the node
         if len(FastMLTermini_L) > 0:
             #A fastML termini string is prepared, and this termini string will be the same termini string as the equivalent cogent node
             FastMLTerminiString = '-'.join(sorted(FastMLTermini_L))
             self.FastMLToOriginalMatchedNodes_D[FastMLCogentNodeKey] = TerminiStringToNodeName_D[FastMLTerminiString]
             
         #if it has no termini under it, then the node itself is a terminus and has the same name in FastML and Cogent
         else:
             self.FastMLToOriginalMatchedNodes_D[FastMLCogentNodeKey] = FastMLCogentNodeKey
开发者ID:JeremyBAdams,项目名称:Adaptation3D,代码行数:36,代码来源:fastmltree.py


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