PEATDB/plugins/KineticsAnalysis.py
def processKineticsRaw(self, variantdata, phvalues):
        """Get raw data for a variant into ekin projects, fit MM and save"""

        E = EkinProject(mode='General')
        for ph in variantdata.keys():
            for s in variantdata[ph].keys():
                E.insertDataset(variantdata[ph][s], ph+'_'+str(s))

         #inital fit of raw data to get slopes
        print 'fitting raw velocity data..'
        E.fitDatasets(models=['Linear'], noiter=100, conv=1e-6, grad=1e-8, silent=True)

        #check linear fits applying criteria
        print 'checking linear fits..'
        actlists={}
        for ph in phvalues:
            actlists[ph]=[]
            for d in E.datasets:
                x = d.split('_')
                p, sconc = x[0], round(float(x[1]),3)
                if p == ph:
                    status = self.checkLinearFit(E, d, cutoff = 0.04)
                    actlists[ph].append(status)
        print actlists
        #estimate exp uncertainty and save linear fit errors in the meta_data
        print 'estimating exp uncertainties for raw data..'
        for d in E.datasets:
            ferrs = E.estimateExpUncertainty(d, runs=10)
            E.addMeta(d, 'exp_errors', ferrs)

        #Extract mm data and fit to michealis-menten
        print 'creating MM data..'
        import copy
        datasets = copy.deepcopy(E.datasets)
        mmdatasets = []
        for ph in phvalues:
            slopes=[];sconcs=[];xerrors=[];yerrors=[]
            active = actlists[ph]
            for d in datasets:
                x = d.split('_')
                p, sconc = x[0], round(float(x[1]),3)
                #print ph, name, n, sconc, slope, yerror
                if p == ph:
                    #get slope and error and add the point
                    try:
                        slope = E.getMetaData(d)['a']
                        yerror = E.getMeta(d, 'exp_errors')['a'][1]
                    except:
                        print 'no slope, skipping'
                        continue
                    slopes.append(slope)
                    sconcs.append(sconc)
                    xerrors.append(sconc*self.sconcerr/100)
                    yerrors.append(yerror)
            #print ph, name, sconcs, slopes, yerrors
            edata = EkinDataset(xy=[sconcs, slopes], xerrs=xerrors, yerrs=yerrors,
                                        active=active, xlabel='[S]',ylabels='V')

            E.insertDataset(edata, ph)
            mmdatasets.append(ph)

        E.fitDatasets(datasets=mmdatasets, models=['Michaelis-Menten'], noiter=400,
                            conv=1e-7, grad=1e-8, silent=True)

        print 'estimating exp uncertainties for MM data..'
        for d in mmdatasets:
            ferrs = E.estimateExpUncertainty(d, runs=10)
            E.addMeta(d, 'exp_errors', ferrs)

        return E
Get raw data for a variant into ekin projects, fit MM and save
Get raw data for a variant into ekin projects, fit MM and save
Get raw data for a variant into ekin projects fit MM and save
def processKineticsRaw(self, variantdata, phvalues):
        E = EkinProject(mode='General')
        for ph in variantdata.keys():
            for s in variantdata[ph].keys():
                E.insertDataset(variantdata[ph][s], ph+'_'+str(s))
        print 'fitting raw velocity data..'
        E.fitDatasets(models=['Linear'], noiter=100, conv=1e-6, grad=1e-8, silent=True)
        print 'checking linear fits..'
        actlists={}
        for ph in phvalues:
            actlists[ph]=[]
            for d in E.datasets:
                x = d.split('_')
                p, sconc = x[0], round(float(x[1]),3)
                if p == ph:
                    status = self.checkLinearFit(E, d, cutoff = 0.04)
                    actlists[ph].append(status)
        print actlists
        print 'estimating exp uncertainties for raw data..'
        for d in E.datasets:
            ferrs = E.estimateExpUncertainty(d, runs=10)
            E.addMeta(d, 'exp_errors', ferrs)
        print 'creating MM data..'
        import copy
        datasets = copy.deepcopy(E.datasets)
        mmdatasets = []
        for ph in phvalues:
            slopes=[];sconcs=[];xerrors=[];yerrors=[]
            active = actlists[ph]
            for d in datasets:
                x = d.split('_')
                p, sconc = x[0], round(float(x[1]),3)
                if p == ph:
                    try:
                        slope = E.getMetaData(d)['a']
                        yerror = E.getMeta(d, 'exp_errors')['a'][1]
                    except:
                        print 'no slope, skipping'
                        continue
                    slopes.append(slope)
                    sconcs.append(sconc)
                    xerrors.append(sconc*self.sconcerr/100)
                    yerrors.append(yerror)
            edata = EkinDataset(xy=[sconcs, slopes], xerrs=xerrors, yerrs=yerrors,
                                        active=active, xlabel='[S]',ylabels='V')
            E.insertDataset(edata, ph)
            mmdatasets.append(ph)
        E.fitDatasets(datasets=mmdatasets, models=['Michaelis-Menten'], noiter=400,
                            conv=1e-7, grad=1e-8, silent=True)
        print 'estimating exp uncertainties for MM data..'
        for d in mmdatasets:
            ferrs = E.estimateExpUncertainty(d, runs=10)
            E.addMeta(d, 'exp_errors', ferrs)
        return E
def processKineticsRaw ( self , variantdata , phvalues ) : E = EkinProject ( mode = 'General' ) for ph in variantdata . keys ( ) : for s in variantdata [ ph ] . keys ( ) : E . insertDataset ( variantdata [ ph ] [ s ] , ph + '_' + str ( s ) ) print 'fitting raw velocity data..' E . fitDatasets ( models = [ 'Linear' ] , noiter = 100 , conv = 1e-6 , grad = 1e-8 , silent = True ) print 'checking linear fits..' actlists = { } for ph in phvalues : actlists [ ph ] = [ ] for d in E . datasets : x = d . split ( '_' ) p , sconc = x [ 0 ] , round ( float ( x [ 1 ] ) , 3 ) if p == ph : status = self . checkLinearFit ( E , d , cutoff = 0.04 ) actlists [ ph ] . append ( status ) print actlists print 'estimating exp uncertainties for raw data..' for d in E . datasets : ferrs = E . estimateExpUncertainty ( d , runs = 10 ) E . addMeta ( d , 'exp_errors' , ferrs ) print 'creating MM data..' import copy datasets = copy . deepcopy ( E . datasets ) mmdatasets = [ ] for ph in phvalues : slopes = [ ] ; sconcs = [ ] ; xerrors = [ ] ; yerrors = [ ] active = actlists [ ph ] for d in datasets : x = d . split ( '_' ) p , sconc = x [ 0 ] , round ( float ( x [ 1 ] ) , 3 ) if p == ph : try : slope = E . getMetaData ( d ) [ 'a' ] yerror = E . getMeta ( d , 'exp_errors' ) [ 'a' ] [ 1 ] except : print 'no slope, skipping' continue slopes . append ( slope ) sconcs . append ( sconc ) xerrors . append ( sconc * self . sconcerr / 100 ) yerrors . append ( yerror ) edata = EkinDataset ( xy = [ sconcs , slopes ] , xerrs = xerrors , yerrs = yerrors , active = active , xlabel = '[S]' , ylabels = 'V' ) E . insertDataset ( edata , ph ) mmdatasets . append ( ph ) E . fitDatasets ( datasets = mmdatasets , models = [ 'Michaelis-Menten' ] , noiter = 400 , conv = 1e-7 , grad = 1e-8 , silent = True ) print 'estimating exp uncertainties for MM data..' for d in mmdatasets : ferrs = E . estimateExpUncertainty ( d , runs = 10 ) E . addMeta ( d , 'exp_errors' , ferrs ) return E
Get raw data for a variant into ekin projects, fit MM and save
Get raw data for a variant into ekin projects fit MM and save
"""Get raw data for a variant into ekin projects, fit MM and save""" #inital fit of raw data to get slopes #check linear fits applying criteria #estimate exp uncertainty and save linear fit errors in the meta_data #Extract mm data and fit to michealis-menten #print ph, name, n, sconc, slope, yerror #get slope and error and add the point #print ph, name, sconcs, slopes, yerrors
self
variantdata
phvalues