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


Python Util.debugMessage方法代码示例

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


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

示例1: _processNode

# 需要导入模块: from hgu import Util [as 别名]
# 或者: from hgu.Util import debugMessage [as 别名]
def _processNode(node, parentApo, rank, depth, isPrimaryPath):
    """
    Generate part of records for an anatomy node, and all its children.
    """

    if Util.debugging():
        Util.debugMessage([
            "In _processnode.",
            "Node: " + node.getPublicId() + " '" +
            node.getComponentName() + "'",
            "Rank: " + str(rank) + "  Depth: " + str(depth)])

    # Generate record for this node.
    anatApo = AnadPartOfDb.AnadPartOfDbRecord()
    anatApo.setOid(rank)
    anatApo.setSpecies(node.getSpecies())
    anatApo.setNodeOid(node.getOid())
    anatApo.setSequence(rank)
    anatApo.setDepth(depth)
    anatApo.setIsPrimaryPath(isPrimaryPath)

    # Gather stage range of anatomy node
    nodeStartStage, nodeEndStage = Nodes.getStageWindowForNodeOid(node.getOid())
    StartStage = Stages.getByOid(nodeStartStage.getOid())
    EndStage = Stages.getByOid(nodeEndStage.getOid())

    if parentApo != None:
        anatApo.setParentApoOid(parentApo.getOid())
        anatApo.setFullPath(parentApo.getFullPath() + "." +
                            node.getComponentName())
        anatApo.setFullPathOids(parentApo.getFullPathOids() + "." +
                            str(node.getOid()))
        anatApo.setFullPathEmapas(parentApo.getFullPathEmapas() + "." +
                            str(node.getPublicId()))
        anatApo.setFullPathJsonHead(parentApo.getFullPathJsonHead() + 
                                '{\"attr\": { \"ext_id\": \"' + node.getPublicId() + 
                                '\", \"id\": \"li.node.BRANCH.Abstract.id' + str(node.getOid()) + 
                                '\", \"name\": \"' + node.getComponentName() + 
                                '\", \"start\": \"' + StartStage.getName() +
                                '\", \"end\": \"' + EndStage.getName() +
                                '\"}, \"data\": \"' + node.getComponentName() + 
                                '\", \"state\": \"open\", \"children\": [')
        anatApo.setFullPathJsonTail(parentApo.getFullPathJsonTail() + ']}')
    else:
        anatApo.setFullPath(node.getComponentName())
        anatApo.setFullPathOids(str(node.getOid()))
        anatApo.setFullPathEmapas(str(node.getPublicId()))
        anatApo.setFullPathJsonHead(
                                '{\"attr\": { \"ext_id\": \"' + node.getPublicId() + 
                                '\", \"id\": \"li.node.BRANCH.Abstract.id' + str(node.getOid()) + 
                                '\", \"name\": \"' + node.getComponentName() + 
                                '\", \"start\": \"' + StartStage.getName() +
                                '\", \"end\": \"' + EndStage.getName() +
                                '\"}, \"data\": \"' + node.getComponentName() + 
                                '\", \"state\": \"open\", \"children\": [')
        anatApo.setFullPathJsonTail(']}')

        
    # Gather stage range of anatomy node
    anatApo.setNodeStartStageOid(nodeStartStage.getOid())
    anatApo.setNodeEndStageOid(nodeEndStage.getOid())

    # Path start and end stages may be narrower than node start and
    # end stages.  Used to reason about what parts of the tree to display
    # for what stages.
    pathStartStage = nodeStartStage
    pathEndStage   = nodeEndStage
    
    if parentApo:
        parentPathStartStage = Stages.getByOid(parentApo.getPathStartStageOid())
        parentPathEndStage   = Stages.getByOid(parentApo.getPathEndStageOid())
    
        if pathStartStage.getSequence() < parentPathStartStage.getSequence():
            pathStartStage = parentPathStartStage
        
        if pathEndStage.getSequence() > parentPathEndStage.getSequence():
            pathEndStage = parentPathEndStage
    
    anatApo.setPathStartStageOid(pathStartStage.getOid())
    anatApo.setPathEndStageOid(pathEndStage.getOid())

    if pathStartStage.getSequence() > pathEndStage.getSequence():
        Util.fatalError(["Bad path stage range"])

    # part of record fully populated.  Add it to database and to this module's
    # knowledge base.
    anatApo.insert()
    _addToKnowledge(anatApo, deferReverse = True)
    # Other globals populated after everything has been created.

    rank += 1

    # Generate records, recursively, depth first, left to right, for all
    # its children.
    childIsPrimary = isPrimaryPath and node.isPrimary()
    childRels = Relationships.getByParentOid(node.getOid())
    
    for childRel in childRels:
        childOid = childRel.getChildOid()
        
#.........这里部分代码省略.........
开发者ID:ma-tech,项目名称:Anatomy,代码行数:103,代码来源:PartOfs.py


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