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


Python Constants.nodeInfoGen方法代码示例

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


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

示例1: getPRMLadder

# 需要导入模块: import Constants [as 别名]
# 或者: from Constants import nodeInfoGen [as 别名]
def getPRMLadder(seq, ambigAA='X', addEnds=True, ambigEdges=None):
    prmLadder = []
    nodeGen = Constants.nodeInfoGen(seq, considerTerminalMods=True, addTerminalNodes=addEnds, ambigEdges=ambigEdges, ambigAA=ambigAA)
    for node in nodeGen:
        prmLadder.extend([node['prm']])
    
    return prmLadder
开发者ID:adevabhaktuni,项目名称:LADS,代码行数:9,代码来源:Analytics.py

示例2: getPRMLadder

# 需要导入模块: import Constants [as 别名]
# 或者: from Constants import nodeInfoGen [as 别名]
def getPRMLadder(seq, startMass, ambigAA='X', ambigEdges=None, epsilon=1, addEnds=True, considerTerminalMods=True):
    nodeGen = Constants.nodeInfoGen(seq, startMass=startMass, addTerminalNodes=addEnds, considerTerminalMods=considerTerminalMods)
    seqIndex = 1
    PRMLadder = []
    
    while True:
        try:
            node = nodeGen.next()
            PRMLadder.extend([node['prm']])
        except KeyError:
            if seq[seqIndex - 1] == ambigAA:
                edge = ambigEdges[0]
                ambigEdges = ambigEdges[1:]
                if np.abs(edge[0] - (PRMLadder[-1] if len(PRMLadder) > 0 else startMass)) < epsilon:
                    PRMLadder.extend([edge[1]])
                    PRMLadder.extend(getPRMLadder(seq=seq[seqIndex:], startMass=edge[1], ambigAA=ambigAA, ambigEdges=ambigEdges, epsilon=epsilon, addEnds=False))
                    break
                else:
                    print 'ERROR: Ambiguous edges do not correspond to ambiguous regions of sequence for PRM =', PRMLadder[-1] if len(PRMLadder) > 0 else startMass, 'and ambiguous edges', edge  
                    return False
            else:
                raise ValueError('Unknown amino acid found %s' % node['lattAA'])
        except StopIteration:
            break
    
    return PRMLadder
开发者ID:adevabhaktuni,项目名称:LADS,代码行数:28,代码来源:ProbNetwork.py

示例3: getAllAAs

# 需要导入模块: import Constants [as 别名]
# 或者: from Constants import nodeInfoGen [as 别名]
def getAllAAs(seq, ambigAA='X', ambigEdges=None):
    AAs = []
    nodeGen = Constants.nodeInfoGen(seq, considerTerminalMods=True, ambigEdges=ambigEdges)
    for node in nodeGen:
        AAs.extend([node['formAA']])
   
    AAs.extend([node['lattAA']])
    return AAs
开发者ID:adevabhaktuni,项目名称:LADS,代码行数:10,代码来源:Analytics.py

示例4: getFilteredPRMLadder

# 需要导入模块: import Constants [as 别名]
# 或者: from Constants import nodeInfoGen [as 别名]
def getFilteredPRMLadder(seq, specs, filterRule, ambigAA='X', addEnds=True, ambigEdges=None):
    prmLadder = []
    nodeGen = Constants.nodeInfoGen(seq, considerTerminalMods=True, addTerminalNodes=addEnds, ambigEdges=ambigEdges, ambigAA=ambigAA)
    for node in nodeGen:
        addToLadder = False
        for spec in specs:
            if node['prm'] == 0 or node['prm'] == spec.pm or filterRule(node, spec):
                addToLadder = True
            
        if addToLadder:
            prmLadder += [node['prm']]
    
    return prmLadder
开发者ID:adevabhaktuni,项目名称:LADS,代码行数:15,代码来源:Analytics.py

示例5: getScoreStats

# 需要导入模块: import Constants [as 别名]
# 或者: from Constants import nodeInfoGen [as 别名]
def getScoreStats(specs, peptide, ambigEdges=None, ppmstd=5):

    prmStats = {'All Evidence': 0, 'Majority Evidence': 0, 'None Evidence': 0}
    nodeGen = Constants.nodeInfoGen(peptide, considerTerminalMods=True, ambigEdges=ambigEdges)
    prevNodeMass = 0
    totalMinNodeScore = 100000

    specScoreStats = {}
    for i in range(len(specs)):
        specScoreStats[i] = {'Score': 0, 'Negative': 0, 'Min Node Score': 100000}
        
    for node in nodeGen:
        numPos = 0
        totalNodeScore = 0
        
        for i, spec in enumerate(specs):
            if prevNodeMass == 0:
                specScoreStats[i]['Score'] += spec.getPriorScore(prm=0, formAA=None, lattAA=node['formAA'])

            score = spec.getNodeScore(prm=node['prm'], formAA=node['formAA'], lattAA=node['lattAA'])
            specScoreStats[i]['Score'] += score
            totalNodeScore += score
            
            if score > 0:
                numPos += 1
            if score < 0:
                specScoreStats[i]['Negative'] += 1
            if score < specScoreStats[i]['Min Node Score']:
                specScoreStats[i]['Min Node Score'] = score

        if numPos == len(specs):
            prmStats['All Evidence'] += 1
        if 2*numPos >= len(specs):
            prmStats['Majority Evidence'] += 1
        if numPos == 0:
            prmStats['None Evidence'] += 1
        if totalNodeScore < totalMinNodeScore:
            totalMinNodeScore = totalNodeScore

        prevNodeMass = node['prm']

    for i, spec in enumerate(specs):
        specScoreStats[i]['Score'] += spec.getPriorScore(prm=spec.pm, formAA=node['lattAA'], lattAA=None)

    scores = [specScoreStats[i]['Score'] for i in specScoreStats]
    totalPathScore = sum(scores)
    maxPathScore = max(scores)
    minPathScore = min(scores)
        
    return {'Total Path Score': totalPathScore, 'Total Minimum Node Score': totalMinNodeScore, 'Minimum Path Score': minPathScore, 'Maximum Path Score': maxPathScore, 'Aggregate PRM Score Statistics': prmStats, 'Spectrum Specific Score Statistics': specScoreStats}
开发者ID:adevabhaktuni,项目名称:LADS,代码行数:52,代码来源:Discriminator.py

示例6: addToCounts

# 需要导入模块: import Constants [as 别名]
# 或者: from Constants import nodeInfoGen [as 别名]
 def addToCounts(self, spec):
     try: 
         nodes = Constants.nodeInfoGen(spec.seq, considerTerminalMods=True, addTerminalNodes=True)
         for nodeInfo in nodes:
             Inds = self.getInds(spec, nodeInfo, getIons=True if ProbNetwork.getTerminus(nodeInfo) == 2 else False)
             for dist in self._dists:
                 try:
                     for attr in self._counts[dist].keys():
                         conds = self._config[dist][attr]
                         attrLoc = (Inds[attr],) + tuple(Inds[cond] for cond in conds)
                         self._counts[dist][attr][attrLoc] += 1
                 except KeyError:
                     pass
                 
     except AttributeError:
         print 'No counts matrix detected. Not in training mode!'   
开发者ID:adevabhaktuni,项目名称:LADS,代码行数:18,代码来源:ProbNetwork.py

示例7: getTagScore

# 需要导入模块: import Constants [as 别名]
# 或者: from Constants import nodeInfoGen [as 别名]
def getTagScore(spec, subSeq, startMass, deNovoTerm, ambigEdges=None, addTerminalNodes=True, verbose=False):
    nodeGen = Constants.nodeInfoGen(subSeq, startMass=startMass, ambigEdges=ambigEdges, addTerminalNodes=addTerminalNodes)

    nodes = list(nodeGen)
    if addTerminalNodes:
        if deNovoTerm == 'N':
            nodes = nodes[1:]

        if deNovoTerm == 'C':
            nodes = nodes[:-1]

    if verbose:
        print nodes
    score = 0
    for node in nodes:
        score += spec.getNodeScore(**node)

    return score
开发者ID:adevabhaktuni,项目名称:LADS,代码行数:20,代码来源:AlignDeNovoSequenceToReference.py

示例8: displayConfColoredSequence

# 需要导入模块: import Constants [as 别名]
# 或者: from Constants import nodeInfoGen [as 别名]
 def displayConfColoredSequence(self, G, masterFrame, path, seq, ambigEdges=None):
     nodeGen = Constants.nodeInfoGen(seq, addTerminalNodes=False, considerTerminalMods=True, ambigEdges=ambigEdges)
     prevNode = None
     for i, node in enumerate(nodeGen):
         print node, path[i+1]
         node['prm'] = path[i+1]
         confScore = An.getAAConfidence(G, prevNode=prevNode, nextNode=node)
         prevNode = node
         hexColor = self.getHexString(np.array([1-confScore, confScore, 0]))
         if prevNode == None and seq[len(node['formAA'])] in Constants.NTermMods:
             Label(masterFrame, text=node['formAA']+seq[len(node['formAA'])], fg='white', bg=hexColor).pack(side=LEFT)
         else:
             Label(masterFrame, text=node['formAA'], fg='white', bg=hexColor).pack(side=LEFT)
     
     confScore = An.getAAConfidence(G, prevNode=prevNode, nextNode=None)
     hexColor = self.getHexString(np.array([1-confScore, confScore, 0]))
     if seq[-1] in Constants.CTermMods:
         Label(masterFrame, text=node['lattAA']+seq[-1], fg='white', bg=hexColor).pack(side=LEFT)
     else:
         Label(masterFrame, text=node['lattAA'], fg='white', bg=hexColor).pack(side=LEFT)
开发者ID:adevabhaktuni,项目名称:LADS,代码行数:22,代码来源:LADSGUI.py

示例9: getLADSPScore

# 需要导入模块: import Constants [as 别名]
# 或者: from Constants import nodeInfoGen [as 别名]
def getLADSPScore(seq, dtaPath, PNet, ppm=5, ambigEdges=None, ambigAA='X', ambigPenalty=20):
    pairs = DataFile.getMassIntPairs(dtaPath)
    precMass = DataFile.getPrecMassAndCharge(dtaPath)[0]
    epsilon = ppm * precMass * 10 ** -6
    spec = PN.Spectrum(PNet, precMass, Nmod=0, Cmod=0, epsilon=epsilon, spectrum=pairs)
    spec.initializeNoiseModel()
    nodeGen = Constants.nodeInfoGen(seq, considerTerminalMods=True, ambigEdges=ambigEdges)
    pScore = 0
    node = nodeGen.next()
    pScore += spec.getNodeScore(**node)
    pScore += spec.getPriorScore(prm=0, formAA=None, lattAA=node['formAA'])
    if node['formAA'] == ambigAA:
        pScore -= ambigPenalty
        
    for node in nodeGen:
        pScore += spec.getNodeScore(**node)
        if node['formAA'] == ambigAA:
            pScore -= ambigPenalty
            
    pScore += spec.getPriorScore(prm=precMass- Constants.mods['H+'] - Constants.mods['H2O'], formAA=node['lattAA'], lattAA=None)
    if node['lattAA'] == ambigAA:
        pScore -= ambigPenalty
    
    return pScore  
开发者ID:adevabhaktuni,项目名称:LADS,代码行数:26,代码来源:Analytics.py


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