PEATDB/scripts/multiProjects.py
def PEATSAJobs(prjs, resubmit=False):
    """Submit PEATSA runs for all projects or merge results if done"""
    for name in prjs:
        print name
        DB = PDatabase(local=os.path.join(savepath,name))
        pdb = DB['wt'].Structure
        PS = PEATSAPlugin()
        PS.main(DB=DB)
        if hasattr(DB.meta,'peatsa_jobs') and resubmit == False:
            if 'mycalc' in DB.meta.peatsa_jobs:
                print 'job is present'
                #try to merge results
                S = PEATTableModel(DB)
                job,n = PS.getJob('mycalc')
                PS.mergeResults(job, 'prediction', S)
                DB.commit()
                print 'merged results'
        else:
            mutlist = []
            for p in DB.getRecs():
                mutlist.append(DB.get(p).Mutations)
            #print mutlist
            pdbfile = PS.writetempPDB()
            #we add source project data so exp data can be read from summary
            prjdata = {'server':'enzyme.ucd.ie','username':'guest',
                              'project':name,'password':'123','port':'8080'}
            PS.submitJob(name='mycalc', pdbname=DB.meta.refprotein, pdbfile=pdbfile, 
                         mutations=mutlist, calcs=['stability'],
                         meta={'protein':name,'expcol':'Exp','project':prjdata})
        #required to end process
        PS.jobManager.stopLogging()
        DB.close()
    return
Submit PEATSA runs for all projects or merge results if done
Submit PEATSA runs for all projects or merge results if done
Submit PEATSA runs for all projects or merge results if done
def PEATSAJobs(prjs, resubmit=False):
    for name in prjs:
        print name
        DB = PDatabase(local=os.path.join(savepath,name))
        pdb = DB['wt'].Structure
        PS = PEATSAPlugin()
        PS.main(DB=DB)
        if hasattr(DB.meta,'peatsa_jobs') and resubmit == False:
            if 'mycalc' in DB.meta.peatsa_jobs:
                print 'job is present'
                S = PEATTableModel(DB)
                job,n = PS.getJob('mycalc')
                PS.mergeResults(job, 'prediction', S)
                DB.commit()
                print 'merged results'
        else:
            mutlist = []
            for p in DB.getRecs():
                mutlist.append(DB.get(p).Mutations)
            pdbfile = PS.writetempPDB()
            prjdata = {'server':'enzyme.ucd.ie','username':'guest',
                              'project':name,'password':'123','port':'8080'}
            PS.submitJob(name='mycalc', pdbname=DB.meta.refprotein, pdbfile=pdbfile, 
                         mutations=mutlist, calcs=['stability'],
                         meta={'protein':name,'expcol':'Exp','project':prjdata})
        PS.jobManager.stopLogging()
        DB.close()
    return
def PEATSAJobs ( prjs , resubmit = False ) : for name in prjs : print name DB = PDatabase ( local = os . path . join ( savepath , name ) ) pdb = DB [ 'wt' ] . Structure PS = PEATSAPlugin ( ) PS . main ( DB = DB ) if hasattr ( DB . meta , 'peatsa_jobs' ) and resubmit == False : if 'mycalc' in DB . meta . peatsa_jobs : print 'job is present' S = PEATTableModel ( DB ) job , n = PS . getJob ( 'mycalc' ) PS . mergeResults ( job , 'prediction' , S ) DB . commit ( ) print 'merged results' else : mutlist = [ ] for p in DB . getRecs ( ) : mutlist . append ( DB . get ( p ) . Mutations ) pdbfile = PS . writetempPDB ( ) prjdata = { 'server' : 'enzyme.ucd.ie' , 'username' : 'guest' , 'project' : name , 'password' : '123' , 'port' : '8080' } PS . submitJob ( name = 'mycalc' , pdbname = DB . meta . refprotein , pdbfile = pdbfile , mutations = mutlist , calcs = [ 'stability' ] , meta = { 'protein' : name , 'expcol' : 'Exp' , 'project' : prjdata } ) PS . jobManager . stopLogging ( ) DB . close ( ) return
Submit PEATSA runs for all projects or merge results if done
Submit PEATSA runs for all projects or merge results if done
"""Submit PEATSA runs for all projects or merge results if done""" #try to merge results #print mutlist #we add source project data so exp data can be read from summary #required to end process
prjs
resubmit