PEATDB/plugins/KineticsAnalysis.py
def sendtoPEAT(self, server='localhost'):
        """Send all the data to PEATDB"""
        from PEATDB.Base import PDatabase
        self.DB = PDatabase(server=server, username='farrell',
                         password='123', project='novo')
        print self.DB
        DB=self.DB
        DB.addField('setname','text')
        DB.addField('clonename','text')
        #DB.addField('mutation','text')
        DB.addField('ast','General')
        DB.addField('enz_conc','text')
        DB.addField('temp','General')
        DB.addField('t50','text')
        DB.addField('cd','General')

        clonenames = self.getCloneNames(allsets=False)
        enzymeconcs = self.enzymeConcsfromTemplate()
        kprj = {'kcats':EkinProject(), 'kcats_kms':EkinProject(), 'kslopes':EkinProject()}
        for k in kprj:
            kprj[k].openProject(os.path.join(self.path, k))

        for name in self.required:
            DB.add(name)
            DB[name].setname = self.setname
            print name
            if clonenames.has_key(name):
                DB[name].clonename = clonenames[name]['name']
                DB[name].Mutations = clonenames[name]['mutation']
                
            #kinetics data              
            DB[name]['enz_conc'] = str(enzymeconcs[name][0])
            Ea = EkinProject()
            Ea.openProject(os.path.join(self.path, name.replace(' ','')+'_ast'))
            DB[name]['ast'] = Ea
            
            for r in self.runs:
                print 'adding run %s data' %r
                E = EkinProject()
                E.openProject(os.path.join(self.path, name.replace(' ','')+'_'+str(r)))
                col = 'raw_'+str(r)
                DB.addField(col,'General')
                DB[name][col] = E

                #add kcat etc. vals for each run
                '''for k in kprj:
                    for r in self.runs:
                        d = name+'_'+str(r)
                        col = k+'_'+str(r)
                        ekd = EkinDataset(kprj[k].getDataset(d))
                        DB.addField(col,'text')
                        DB[name][col] = str(round(ekd.getYVal(7),5))'''
            

            #temp data
            Et = EkinProject()
            Et.openProject(os.path.join(self.path, name.replace(' ','')+'_temp'))
            try:
                t50=numpy.mean(Et.getMetaData('1_7')['t50'] + Et.getMetaData('2_7')['t50'])
                DB[name]['t50'] = round(t50,2)
                DB[name]['temp'] = Et
                DB.updateCellCache(name, 't50')
                DB.updateCellCache(name, 'temp')
            except:
                pass

        print DB        
        DB.commit(note='added from script')
        return DB
Send all the data to PEATDB
Send all the data to PEATDB
Send all the data to PEATDB
def sendtoPEAT(self, server='localhost'):
        from PEATDB.Base import PDatabase
        self.DB = PDatabase(server=server, username='farrell',
                         password='123', project='novo')
        print self.DB
        DB=self.DB
        DB.addField('setname','text')
        DB.addField('clonename','text')
        DB.addField('ast','General')
        DB.addField('enz_conc','text')
        DB.addField('temp','General')
        DB.addField('t50','text')
        DB.addField('cd','General')
        clonenames = self.getCloneNames(allsets=False)
        enzymeconcs = self.enzymeConcsfromTemplate()
        kprj = {'kcats':EkinProject(), 'kcats_kms':EkinProject(), 'kslopes':EkinProject()}
        for k in kprj:
            kprj[k].openProject(os.path.join(self.path, k))
        for name in self.required:
            DB.add(name)
            DB[name].setname = self.setname
            print name
            if clonenames.has_key(name):
                DB[name].clonename = clonenames[name]['name']
                DB[name].Mutations = clonenames[name]['mutation']
            DB[name]['enz_conc'] = str(enzymeconcs[name][0])
            Ea = EkinProject()
            Ea.openProject(os.path.join(self.path, name.replace(' ','')+'_ast'))
            DB[name]['ast'] = Ea
            for r in self.runs:
                print 'adding run %s data' %r
                E = EkinProject()
                E.openProject(os.path.join(self.path, name.replace(' ','')+'_'+str(r)))
                col = 'raw_'+str(r)
                DB.addField(col,'General')
                DB[name][col] = E
            Et = EkinProject()
            Et.openProject(os.path.join(self.path, name.replace(' ','')+'_temp'))
            try:
                t50=numpy.mean(Et.getMetaData('1_7')['t50'] + Et.getMetaData('2_7')['t50'])
                DB[name]['t50'] = round(t50,2)
                DB[name]['temp'] = Et
                DB.updateCellCache(name, 't50')
                DB.updateCellCache(name, 'temp')
            except:
                pass
        print DB        
        DB.commit(note='added from script')
        return DB
def sendtoPEAT ( self , server = 'localhost' ) : from PEATDB . Base import PDatabase self . DB = PDatabase ( server = server , username = 'farrell' , password = '123' , project = 'novo' ) print self . DB DB = self . DB DB . addField ( 'setname' , 'text' ) DB . addField ( 'clonename' , 'text' ) DB . addField ( 'ast' , 'General' ) DB . addField ( 'enz_conc' , 'text' ) DB . addField ( 'temp' , 'General' ) DB . addField ( 't50' , 'text' ) DB . addField ( 'cd' , 'General' ) clonenames = self . getCloneNames ( allsets = False ) enzymeconcs = self . enzymeConcsfromTemplate ( ) kprj = { 'kcats' : EkinProject ( ) , 'kcats_kms' : EkinProject ( ) , 'kslopes' : EkinProject ( ) } for k in kprj : kprj [ k ] . openProject ( os . path . join ( self . path , k ) ) for name in self . required : DB . add ( name ) DB [ name ] . setname = self . setname print name if clonenames . has_key ( name ) : DB [ name ] . clonename = clonenames [ name ] [ 'name' ] DB [ name ] . Mutations = clonenames [ name ] [ 'mutation' ] DB [ name ] [ 'enz_conc' ] = str ( enzymeconcs [ name ] [ 0 ] ) Ea = EkinProject ( ) Ea . openProject ( os . path . join ( self . path , name . replace ( ' ' , '' ) + '_ast' ) ) DB [ name ] [ 'ast' ] = Ea for r in self . runs : print 'adding run %s data' % r E = EkinProject ( ) E . openProject ( os . path . join ( self . path , name . replace ( ' ' , '' ) + '_' + str ( r ) ) ) col = 'raw_' + str ( r ) DB . addField ( col , 'General' ) DB [ name ] [ col ] = E '''for k in kprj:
                    for r in self.runs:
                        d = name+'_'+str(r)
                        col = k+'_'+str(r)
                        ekd = EkinDataset(kprj[k].getDataset(d))
                        DB.addField(col,'text')
                        DB[name][col] = str(round(ekd.getYVal(7),5))''' Et = EkinProject ( ) Et . openProject ( os . path . join ( self . path , name . replace ( ' ' , '' ) + '_temp' ) ) try : t50 = numpy . mean ( Et . getMetaData ( '1_7' ) [ 't50' ] + Et . getMetaData ( '2_7' ) [ 't50' ] ) DB [ name ] [ 't50' ] = round ( t50 , 2 ) DB [ name ] [ 'temp' ] = Et DB . updateCellCache ( name , 't50' ) DB . updateCellCache ( name , 'temp' ) except : pass print DB DB . commit ( note = 'added from script' ) return DB
Send all the data to PEATDB
Send all the data to PEATDB
"""Send all the data to PEATDB""" #DB.addField('mutation','text') #kinetics data               #add kcat etc. vals for each run '''for k in kprj:
                    for r in self.runs:
                        d = name+'_'+str(r)
                        col = k+'_'+str(r)
                        ekd = EkinDataset(kprj[k].getDataset(d))
                        DB.addField(col,'text')
                        DB[name][col] = str(round(ekd.getYVal(7),5))''' #temp data
self
server