PEATDB/Ekin/Titration.py
def mappKas(self, DB, col, pkainfo,names=None,spansfile=None,
                        nucleus='H',calculatespans=True):
        """Create mapping of pKas to nearby titratable groups, we use the
           dict of extracted pKas, but also requires the DB for structural info"""

        self.getProtNames(DB)
        path = os.getcwd()
        for prot in DB.getRecs():
            name = self.protnames[prot]
            fname = name.replace(' ','').replace('(','').replace(')','')
            if names != None and name not in names:
                continue
            if not DB[prot].has_key(col):
                continue
            #structure
            struct = DB[prot].Structure
            pdbname = fname+'.pdb'
            from PEATDB.Actions import DBActions
            DBActions.writePDB(struct, pdbname)
            #ekin project with exp data
            E = DB[prot][col]

            #actual titr grp pKa values we get from labbook
            try:
                titrpkas = DB.getLabbookSheet(name+'.pKas').data
                print 'got experimental pKa values for %s' %name
            except:
                print 'failed to get pKa values for %s' %name
            titrpkas = self.convertpkadict(titrpkas)
            print titrpkas

            #call CSP analysis
            if calculatespans==True:
                import pKaTool.Ghosts.Chemical_shift as ChemShift
                C = ChemShift.CSP(pdbname, method='Coulomb', pKaDict=titrpkas, nucleus=nucleus)
                calcspans = C.getSpanDict()
                self.savePickle(calcspans, os.path.join(path,fname+'_'+nucleus+'_spans.pickle'))
            else:
                calcspans = self.loadPickle(fname+'_'+nucleus+'_spans.pickle')

            #assign ghosts - we use the spans dict to match our exp fits
            G = self.assignGhosts(pkainfo[name], calcspans, titrpkas, pdbname)
            self.savePickle(G, fname+'_'+nucleus+'_ghosts.pickle')
            self.ghostStats(G)
            '''#save csp curves to an ekinproject
            Ecsp = self.dict2Ekin(csps)
            Ecsp.saveProject('csps')
            #compare CSP curves to our actual curves
            rmsds = self.compareCSPCurves(E, Ecsp)'''

        return
Create mapping of pKas to nearby titratable groups, we use the
           dict of extracted pKas, but also requires the DB for structural info
Create mapping of pKas to nearby titratable groups, we use the
dict of extracted pKas, but also requires the DB for structural info
Create mapping of pKas to nearby titratable groups we use the dict of extracted pKas but also requires the DB for structural info
def mappKas(self, DB, col, pkainfo,names=None,spansfile=None,
                        nucleus='H',calculatespans=True):
        self.getProtNames(DB)
        path = os.getcwd()
        for prot in DB.getRecs():
            name = self.protnames[prot]
            fname = name.replace(' ','').replace('(','').replace(')','')
            if names != None and name not in names:
                continue
            if not DB[prot].has_key(col):
                continue
            struct = DB[prot].Structure
            pdbname = fname+'.pdb'
            from PEATDB.Actions import DBActions
            DBActions.writePDB(struct, pdbname)
            E = DB[prot][col]
            try:
                titrpkas = DB.getLabbookSheet(name+'.pKas').data
                print 'got experimental pKa values for %s' %name
            except:
                print 'failed to get pKa values for %s' %name
            titrpkas = self.convertpkadict(titrpkas)
            print titrpkas
            if calculatespans==True:
                import pKaTool.Ghosts.Chemical_shift as ChemShift
                C = ChemShift.CSP(pdbname, method='Coulomb', pKaDict=titrpkas, nucleus=nucleus)
                calcspans = C.getSpanDict()
                self.savePickle(calcspans, os.path.join(path,fname+'_'+nucleus+'_spans.pickle'))
            else:
                calcspans = self.loadPickle(fname+'_'+nucleus+'_spans.pickle')
            G = self.assignGhosts(pkainfo[name], calcspans, titrpkas, pdbname)
            self.savePickle(G, fname+'_'+nucleus+'_ghosts.pickle')
            self.ghostStats(G)
        return
def mappKas ( self , DB , col , pkainfo , names = None , spansfile = None , nucleus = 'H' , calculatespans = True ) : self . getProtNames ( DB ) path = os . getcwd ( ) for prot in DB . getRecs ( ) : name = self . protnames [ prot ] fname = name . replace ( ' ' , '' ) . replace ( '(' , '' ) . replace ( ')' , '' ) if names != None and name not in names : continue if not DB [ prot ] . has_key ( col ) : continue struct = DB [ prot ] . Structure pdbname = fname + '.pdb' from PEATDB . Actions import DBActions DBActions . writePDB ( struct , pdbname ) E = DB [ prot ] [ col ] try : titrpkas = DB . getLabbookSheet ( name + '.pKas' ) . data print 'got experimental pKa values for %s' % name except : print 'failed to get pKa values for %s' % name titrpkas = self . convertpkadict ( titrpkas ) print titrpkas if calculatespans == True : import pKaTool . Ghosts . Chemical_shift as ChemShift C = ChemShift . CSP ( pdbname , method = 'Coulomb' , pKaDict = titrpkas , nucleus = nucleus ) calcspans = C . getSpanDict ( ) self . savePickle ( calcspans , os . path . join ( path , fname + '_' + nucleus + '_spans.pickle' ) ) else : calcspans = self . loadPickle ( fname + '_' + nucleus + '_spans.pickle' ) G = self . assignGhosts ( pkainfo [ name ] , calcspans , titrpkas , pdbname ) self . savePickle ( G , fname + '_' + nucleus + '_ghosts.pickle' ) self . ghostStats ( G ) '''#save csp curves to an ekinproject
            Ecsp = self.dict2Ekin(csps)
            Ecsp.saveProject('csps')
            #compare CSP curves to our actual curves
            rmsds = self.compareCSPCurves(E, Ecsp)''' return
Create mapping of pKas to nearby titratable groups, we use the
dict of extracted pKas, but also requires the DB for structural info
Create mapping of pKas to nearby titratable groups we use the dict of extracted pKas but also requires the DB for structural info
"""Create mapping of pKas to nearby titratable groups, we use the
           dict of extracted pKas, but also requires the DB for structural info""" #structure #ekin project with exp data #actual titr grp pKa values we get from labbook #call CSP analysis #assign ghosts - we use the spans dict to match our exp fits '''#save csp curves to an ekinproject
            Ecsp = self.dict2Ekin(csps)
            Ecsp.saveProject('csps')
            #compare CSP curves to our actual curves
            rmsds = self.compareCSPCurves(E, Ecsp)'''
self
DB
col
pkainfo
names
spansfile
nucleus
calculatespans