PEATDB/scripts/multiProjects.py
def createProjects(files):
    """Create multiple projects at once from csv files"""

    for filename in files:
        print filename
        name = os.path.splitext(filename)[0]
        #create/open db
        DB = PDatabase(local=os.path.join(savepath,name))
        DB.add('wt')
        #add wt pdb
        stream = DBActions.fetchPDB(name)
        DBActions.addPDBFile(DB, 'wt', pdbdata=stream, pdbname=name, gui=False)
        DB.meta.refprotein = 'wt'
        DB.meta.info['protein'] = name
        #import data from csv
        DB.importCSV(os.path.join(cpath,filename), namefield='Mutations')
        print 'imported ok'
        DB.deleteField('PDB')
        DB.commit()
        DB.close()
        print 'done'
    return
Create multiple projects at once from csv files
Create multiple projects at once from csv files
Create multiple projects at once from csv files
def createProjects(files):
    for filename in files:
        print filename
        name = os.path.splitext(filename)[0]
        DB = PDatabase(local=os.path.join(savepath,name))
        DB.add('wt')
        stream = DBActions.fetchPDB(name)
        DBActions.addPDBFile(DB, 'wt', pdbdata=stream, pdbname=name, gui=False)
        DB.meta.refprotein = 'wt'
        DB.meta.info['protein'] = name
        DB.importCSV(os.path.join(cpath,filename), namefield='Mutations')
        print 'imported ok'
        DB.deleteField('PDB')
        DB.commit()
        DB.close()
        print 'done'
    return
def createProjects ( files ) : for filename in files : print filename name = os . path . splitext ( filename ) [ 0 ] DB = PDatabase ( local = os . path . join ( savepath , name ) ) DB . add ( 'wt' ) stream = DBActions . fetchPDB ( name ) DBActions . addPDBFile ( DB , 'wt' , pdbdata = stream , pdbname = name , gui = False ) DB . meta . refprotein = 'wt' DB . meta . info [ 'protein' ] = name DB . importCSV ( os . path . join ( cpath , filename ) , namefield = 'Mutations' ) print 'imported ok' DB . deleteField ( 'PDB' ) DB . commit ( ) DB . close ( ) print 'done' return
Create multiple projects at once from csv files
Create multiple projects at once from csv files
"""Create multiple projects at once from csv files""" #create/open db #add wt pdb #import data from csv
files