titration_db/titdb.py
def plotpKDCalcs(self, calcs, Ed=None, option=1):
        """Do pKD calcs with exp data plots"""
        from PEATDB.Ekin.Web import EkinWeb
        from PEATDB.Ekin.Base import EkinProject
        from PEATDB.Ekin.Convert import EkinConvert
        from PEATDB.Ekin.Titration import TitrationAnalyser
        import PEATDB.Ekin.Utils as Utils
        t = TitrationAnalyser()
        c=calcs

        EW = EkinWeb()

        if option == '2':
            print '<a>Just showing experimental data</a>'
            EW.showEkinPlots(project=Ed, datasets='ALL',
                              path=self.plotsdir,
                              imgpath=self.imagepath)
            return
        #create ekin proj from pKD titcurves
        Ec = EkinProject()
        for r in c.keys():
            xd=[];yd=[]
            for i in c[r]:
                if type(i) is types.StringType:
                    continue
                xd.append(i)
                yd.append(c[r][i])
            edata=EkinConvert.xy2ekin([xd,yd])
            Ec.insertDataset(edata, r)

        print '<a>Please wait, fitting calcated curves...</a>'
        sys.stdout.flush()
        Ec.fitDatasets(models=['1 pKa 2 Chemical shifts'], silent=True)

        if option == '3':
            print '<a>Just showing pKD data</a>'
            EW.showEkinPlots(project=Ec, datasets='ALL',
                              path=self.plotsdir,
                              imgpath=self.imagepath)
            return

        #transform exp data names to match pKD ones
        s=':'
        usechainid = True
        #if pKD names have no chain id, we don't need one for exp names
        if Ec.datasets[0].startswith(':'):
            usechainid=False
        for d in Ed.datasets[:]:
            r = Ed.getMetaData(d)
            if r != None:
                if r['chain_id'] == None or usechainid == False:
                    chain = ''
                else:
                    chain = r['chain_id']
                new = chain+s+Utils.leadingZeros(r['res_num'],4)+s+r['residue']
                if new in Ed.datasets:
                    atom = r['atom']
                    new = new + '_' + atom
                Ed.renameDataset(d, new)

        #now we overlay the same datasets in Ed and Ec
        #also handles cases where same residue multiple times for diff atoms in exp data
        for d in Ed.datasets:
            if d in Ec.datasets:
                Ep = EkinProject()
                cdata = Ec.getDataset(d)
                Ep.insertDataset(cdata, d+'_pKD')
                Ep.setFitData(d+'_pKD', Ec.getFitData(d))
                ddata = Ed.getDataset(d)
                Ep.insertDataset(ddata, d+'_exp')
                Ep.setFitData(d+'_exp', Ed.getFitData(d))
                EW.showEkinPlots(project=Ep, datasets='ALL', plotoption=3,
                                 normalise=True, legend=True,
                                 path=self.plotsdir,
                                 imgpath=self.imagepath)

        return
Do pKD calcs with exp data plots
Do pKD calcs with exp data plots
Do pKD calcs with exp data plots
def plotpKDCalcs(self, calcs, Ed=None, option=1):
        from PEATDB.Ekin.Web import EkinWeb
        from PEATDB.Ekin.Base import EkinProject
        from PEATDB.Ekin.Convert import EkinConvert
        from PEATDB.Ekin.Titration import TitrationAnalyser
        import PEATDB.Ekin.Utils as Utils
        t = TitrationAnalyser()
        c=calcs
        EW = EkinWeb()
        if option == '2':
            print '<a>Just showing experimental data</a>'
            EW.showEkinPlots(project=Ed, datasets='ALL',
                              path=self.plotsdir,
                              imgpath=self.imagepath)
            return
        Ec = EkinProject()
        for r in c.keys():
            xd=[];yd=[]
            for i in c[r]:
                if type(i) is types.StringType:
                    continue
                xd.append(i)
                yd.append(c[r][i])
            edata=EkinConvert.xy2ekin([xd,yd])
            Ec.insertDataset(edata, r)
        print '<a>Please wait, fitting calcated curves...</a>'
        sys.stdout.flush()
        Ec.fitDatasets(models=['1 pKa 2 Chemical shifts'], silent=True)
        if option == '3':
            print '<a>Just showing pKD data</a>'
            EW.showEkinPlots(project=Ec, datasets='ALL',
                              path=self.plotsdir,
                              imgpath=self.imagepath)
            return
        s=':'
        usechainid = True
        if Ec.datasets[0].startswith(':'):
            usechainid=False
        for d in Ed.datasets[:]:
            r = Ed.getMetaData(d)
            if r != None:
                if r['chain_id'] == None or usechainid == False:
                    chain = ''
                else:
                    chain = r['chain_id']
                new = chain+s+Utils.leadingZeros(r['res_num'],4)+s+r['residue']
                if new in Ed.datasets:
                    atom = r['atom']
                    new = new + '_' + atom
                Ed.renameDataset(d, new)
        for d in Ed.datasets:
            if d in Ec.datasets:
                Ep = EkinProject()
                cdata = Ec.getDataset(d)
                Ep.insertDataset(cdata, d+'_pKD')
                Ep.setFitData(d+'_pKD', Ec.getFitData(d))
                ddata = Ed.getDataset(d)
                Ep.insertDataset(ddata, d+'_exp')
                Ep.setFitData(d+'_exp', Ed.getFitData(d))
                EW.showEkinPlots(project=Ep, datasets='ALL', plotoption=3,
                                 normalise=True, legend=True,
                                 path=self.plotsdir,
                                 imgpath=self.imagepath)
        return
def plotpKDCalcs ( self , calcs , Ed = None , option = 1 ) : from PEATDB . Ekin . Web import EkinWeb from PEATDB . Ekin . Base import EkinProject from PEATDB . Ekin . Convert import EkinConvert from PEATDB . Ekin . Titration import TitrationAnalyser import PEATDB . Ekin . Utils as Utils t = TitrationAnalyser ( ) c = calcs EW = EkinWeb ( ) if option == '2' : print '<a>Just showing experimental data</a>' EW . showEkinPlots ( project = Ed , datasets = 'ALL' , path = self . plotsdir , imgpath = self . imagepath ) return Ec = EkinProject ( ) for r in c . keys ( ) : xd = [ ] ; yd = [ ] for i in c [ r ] : if type ( i ) is types . StringType : continue xd . append ( i ) yd . append ( c [ r ] [ i ] ) edata = EkinConvert . xy2ekin ( [ xd , yd ] ) Ec . insertDataset ( edata , r ) print '<a>Please wait, fitting calcated curves...</a>' sys . stdout . flush ( ) Ec . fitDatasets ( models = [ '1 pKa 2 Chemical shifts' ] , silent = True ) if option == '3' : print '<a>Just showing pKD data</a>' EW . showEkinPlots ( project = Ec , datasets = 'ALL' , path = self . plotsdir , imgpath = self . imagepath ) return s = ':' usechainid = True if Ec . datasets [ 0 ] . startswith ( ':' ) : usechainid = False for d in Ed . datasets [ : ] : r = Ed . getMetaData ( d ) if r != None : if r [ 'chain_id' ] == None or usechainid == False : chain = '' else : chain = r [ 'chain_id' ] new = chain + s + Utils . leadingZeros ( r [ 'res_num' ] , 4 ) + s + r [ 'residue' ] if new in Ed . datasets : atom = r [ 'atom' ] new = new + '_' + atom Ed . renameDataset ( d , new ) for d in Ed . datasets : if d in Ec . datasets : Ep = EkinProject ( ) cdata = Ec . getDataset ( d ) Ep . insertDataset ( cdata , d + '_pKD' ) Ep . setFitData ( d + '_pKD' , Ec . getFitData ( d ) ) ddata = Ed . getDataset ( d ) Ep . insertDataset ( ddata , d + '_exp' ) Ep . setFitData ( d + '_exp' , Ed . getFitData ( d ) ) EW . showEkinPlots ( project = Ep , datasets = 'ALL' , plotoption = 3 , normalise = True , legend = True , path = self . plotsdir , imgpath = self . imagepath ) return
Do pKD calcs with exp data plots
Do pKD calcs with exp data plots
"""Do pKD calcs with exp data plots""" #create ekin proj from pKD titcurves #transform exp data names to match pKD ones #if pKD names have no chain id, we don't need one for exp names #now we overlay the same datasets in Ed and Ec #also handles cases where same residue multiple times for diff atoms in exp data
self
calcs
Ed
option