PEATDB/Ekin/Titration.py
def assignGhosts(self, pkainfo, calculatedspans, titrpkas, pdbfile):
        """Rough attempt to assign titrations using calculated
           spans for all titr grps and exp fits"""
        ghosts = {}

        from pKaTool.Ghosts.CSP_explicit import CSP_coulomb
        import pKaTool.Ghosts.utilities_CSP as CSPutils
        CC = CSP_coulomb(None, None)
        coordmol, chargemol = CC.parseCoordCharges(pdbfile, pdb=True)

        #get titr residue coords first
        titrcoords = {}
        for res in titrpkas:
            ch,resnum,rescode = res.split(':')
            r = int(resnum)
            try:
                atom = CSPutils.distanceAtoms[rescode]
                titrcoords[res] = coordmol[ch][r][atom]
            except:
                pass

        #iterate over spans and get matching exp fits
        for res in calculatedspans:
            #calculated titr spans for this residue
            calcspans = calculatedspans[res]
            #get largest span
            mx = max(calcspans.values())
            tmax = calcspans.keys()[calcspans.values().index(mx)]
            #print res, tmax, mx
            ch,resnum = res.split(':')
            resnum = int(resnum)
            atom='N'
            coord = coordmol[ch][resnum][atom]

            #find exp fits for this residue
            for d in pkainfo:
                F = pkainfo[d]
                r = int(F['resnum'])
                rescode = F['res']
                if r != resnum:
                    continue
                pks = [i for i in F.keys() if 'pK' in i]
                ghosts[d]={}
                ghosts[d]['resnum']=r
                ghosts[d]['res']=F['res']
                for p in pks:
                    pka=F[p][p]
                    expspan=F[p]['span']
                    assignedspan=0
                    for t in calcspans:
                        cspan = calcspans[t]
                        if abs(cspan) < assignedspan:
                            continue
                        if not titrcoords.has_key(t): continue
                        titrpka = titrpkas[t]
                        xx,distance = CSPutils.getDistance(coord, titrcoords[t])
                        if self.filterGhost(cspan, expspan, titrpka, pka, distance) == True:
                            print distance
                            print 'assigned %s to %s' %(res,t)
                            ghosts[d][p]=t
                            s = 'span' + p.strip('pKa')
                            ghosts[d][s] = expspan
                            assignedspan = abs(cspan)

        return ghosts
Rough attempt to assign titrations using calculated
           spans for all titr grps and exp fits
Rough attempt to assign titrations using calculated
spans for all titr grps and exp fits
Rough attempt to assign titrations using calculated spans for all titr grps and exp fits
def assignGhosts(self, pkainfo, calculatedspans, titrpkas, pdbfile):
        ghosts = {}
        from pKaTool.Ghosts.CSP_explicit import CSP_coulomb
        import pKaTool.Ghosts.utilities_CSP as CSPutils
        CC = CSP_coulomb(None, None)
        coordmol, chargemol = CC.parseCoordCharges(pdbfile, pdb=True)
        titrcoords = {}
        for res in titrpkas:
            ch,resnum,rescode = res.split(':')
            r = int(resnum)
            try:
                atom = CSPutils.distanceAtoms[rescode]
                titrcoords[res] = coordmol[ch][r][atom]
            except:
                pass
        for res in calculatedspans:
            calcspans = calculatedspans[res]
            mx = max(calcspans.values())
            tmax = calcspans.keys()[calcspans.values().index(mx)]
            ch,resnum = res.split(':')
            resnum = int(resnum)
            atom='N'
            coord = coordmol[ch][resnum][atom]
            for d in pkainfo:
                F = pkainfo[d]
                r = int(F['resnum'])
                rescode = F['res']
                if r != resnum:
                    continue
                pks = [i for i in F.keys() if 'pK' in i]
                ghosts[d]={}
                ghosts[d]['resnum']=r
                ghosts[d]['res']=F['res']
                for p in pks:
                    pka=F[p][p]
                    expspan=F[p]['span']
                    assignedspan=0
                    for t in calcspans:
                        cspan = calcspans[t]
                        if abs(cspan) < assignedspan:
                            continue
                        if not titrcoords.has_key(t): continue
                        titrpka = titrpkas[t]
                        xx,distance = CSPutils.getDistance(coord, titrcoords[t])
                        if self.filterGhost(cspan, expspan, titrpka, pka, distance) == True:
                            print distance
                            print 'assigned %s to %s' %(res,t)
                            ghosts[d][p]=t
                            s = 'span' + p.strip('pKa')
                            ghosts[d][s] = expspan
                            assignedspan = abs(cspan)
        return ghosts
def assignGhosts ( self , pkainfo , calculatedspans , titrpkas , pdbfile ) : ghosts = { } from pKaTool . Ghosts . CSP_explicit import CSP_coulomb import pKaTool . Ghosts . utilities_CSP as CSPutils CC = CSP_coulomb ( None , None ) coordmol , chargemol = CC . parseCoordCharges ( pdbfile , pdb = True ) titrcoords = { } for res in titrpkas : ch , resnum , rescode = res . split ( ':' ) r = int ( resnum ) try : atom = CSPutils . distanceAtoms [ rescode ] titrcoords [ res ] = coordmol [ ch ] [ r ] [ atom ] except : pass for res in calculatedspans : calcspans = calculatedspans [ res ] mx = max ( calcspans . values ( ) ) tmax = calcspans . keys ( ) [ calcspans . values ( ) . index ( mx ) ] ch , resnum = res . split ( ':' ) resnum = int ( resnum ) atom = 'N' coord = coordmol [ ch ] [ resnum ] [ atom ] for d in pkainfo : F = pkainfo [ d ] r = int ( F [ 'resnum' ] ) rescode = F [ 'res' ] if r != resnum : continue pks = [ i for i in F . keys ( ) if 'pK' in i ] ghosts [ d ] = { } ghosts [ d ] [ 'resnum' ] = r ghosts [ d ] [ 'res' ] = F [ 'res' ] for p in pks : pka = F [ p ] [ p ] expspan = F [ p ] [ 'span' ] assignedspan = 0 for t in calcspans : cspan = calcspans [ t ] if abs ( cspan ) < assignedspan : continue if not titrcoords . has_key ( t ) : continue titrpka = titrpkas [ t ] xx , distance = CSPutils . getDistance ( coord , titrcoords [ t ] ) if self . filterGhost ( cspan , expspan , titrpka , pka , distance ) == True : print distance print 'assigned %s to %s' % ( res , t ) ghosts [ d ] [ p ] = t s = 'span' + p . strip ( 'pKa' ) ghosts [ d ] [ s ] = expspan assignedspan = abs ( cspan ) return ghosts
Rough attempt to assign titrations using calculated
spans for all titr grps and exp fits
Rough attempt to assign titrations using calculated spans for all titr grps and exp fits
"""Rough attempt to assign titrations using calculated
           spans for all titr grps and exp fits""" #get titr residue coords first #iterate over spans and get matching exp fits #calculated titr spans for this residue #get largest span #print res, tmax, mx #find exp fits for this residue
self
pkainfo
calculatedspans
titrpkas
pdbfile