示例#1
0
def average(atm):
    """Average value of atom with those of assigned neighbors"""
    if atm.has_key('deltaAverage'): del(atm['deltaAverage'])
    values = NTlist()
    for a in [atm] + atm.topology():
        if 'delta' in a and not fpconst.isNaN(a['delta']):
            #print '>>', a, a.delta
            values.append(a.delta)
        #end if
    #end for
    #print '>>', atm, values
    if len(values) > 0:
        atm.deltaAverage, sd, n = values.average()
示例#2
0
def colorPhiPsiMacro( projects, minValue=2.0, maxValue=4.0 ):

    fp = open( projects.path('phipsi.mcr' ), 'w')

    fprintf(fp, 'Console off\n')
    fprintf(fp, 'ColorPar Property Min,blue, %7.3f\n', minValue)
    fprintf(fp, 'ColorPar Property Max,red,  %7.3f\n', maxValue)
    for p in projects.entries[1:]:
        fprintf(fp, 'ColorRes object %d, Gray\n', p.id+1)
        fprintf(fp, 'PropRes object %d, -999\n', p.id+1)
        for res in p.molecule.allResidues():
            if res.has_key('phipsiRmsds'):
                if not isNaN(res.phipsiRmsds[0][p.id].value):
                    fprintf( fp, 'PropRes object %d residue %d, %7.3f\n', p.id+1, res.resNum, res.phipsiRmsds[0][p.id].value)
            #end if
        #end for
        fprintf(fp, 'ColorObject %d, property\n', p.id+1)

    #end for
    fprintf(fp, 'Console off\n')
    fp.close()
示例#3
0
def mkYasaraByResidueMacro(projects, keys,
                            minValue = 0.0, maxValue = 1.0, reverseColorScheme = False,
                            path = None
                           ):

#    nTdebug('mkYasaraByResidueMacro: keys: %s, minValue: %s maxValue: %s', keys, minValue, maxValue)

    if path==None:
        stream = sys.stdout
    else:
        stream = open( path, 'w')
    #end if

    fprintf(stream, 'Console off\n')
    fprintf(stream, 'ColorRes All, Gray\n')
    fprintf(stream, 'PropRes All, -999\n')
    if reverseColorScheme:
        fprintf(stream, 'ColorPar Property Min,red,%f\n', minValue)
        fprintf(stream, 'ColorPar Property Max,blue,%f\n', maxValue)
    else:
        fprintf(stream, 'ColorPar Property Min,blue,%f\n', minValue)
        fprintf(stream, 'ColorPar Property Max,red,%f\n', maxValue)

    for p in projects:
        for res in p.molecule.allResidues():
            value = getDeepByKeysOrAttributes(res, *keys)
    #        if res.has_key(property) and res[property] != None and not isNaN(res[property]):
            if value != None and not isNaN(value):
                fprintf(stream, 'PropRes object %d Residue %d, %.4f\n', p.id+1, res.resNum, value)
        #end for

    fprintf(stream, 'ColorAll Property\n')
    fprintf(stream, 'Console on\n')

    if path:
        stream.close()
示例#4
0
def isNoneorNaN(value):
    if value == None:
        return True
    return isNaN(value)
示例#5
0
def isNoneorNaN(value):
    if value == None:
        return True
    return isNaN(value)