def displayStructure(self, srecs): """Display a structure""" app = self.preferences.get('molgraphApplication') path = self.preferences.get('molgraphAppPath') DBActions.DB = self.DB if DBActions.yasara != None: DBActions.yasara.Clear() colors = ['green', 250, 270, 290, 310, 320, 340] i = 0 for r in srecs: color = colors[i] i += 1 DBActions.displayStructure(r, 'Structure', app, path, color, False) #try to align objects Y = DBActions.yasara if hasattr(Y, 'objects') and len(Y.objects) > 1: Y.AlignMultiAll() return
def displayStructure(self, srecs): """Display a structure""" app = self.preferences.get('molgraphApplication') path = self.preferences.get('molgraphAppPath') DBActions.DB = self.DB if DBActions.yasara != None: DBActions.yasara.Clear() colors = ['green',250,270,290,310,320,340] i=0 for r in srecs: color = colors[i] i+=1 DBActions.displayStructure(r, 'Structure', app, path, color, False) #try to align objects Y = DBActions.yasara if hasattr(Y, 'objects') and len(Y.objects)>1: Y.AlignMultiAll() return
def remodel(): #DB=PDatabase(local='hewlsample.fs') DB=PDatabase(server='localhost',port=8080, username='******',password='******', project='novo') print DB, 'curr ref:', DB.meta.refprotein '''rec= DB['wt+D52N'] print rec.getDisplayAttribute('Structure') rec['Structure'] = rec.Structure''' r='6 c9' rec= DB[r] DBActions.checkModels(DB=DB, selected=[r]) print rec.Structure #print rec.aaseq '''for r in DB.getRecs(): print r, type(DB.get(r).Structure) print DB.get(r).getDisplayAttribute('Structure')''' #DB.commit(note='modelling') return
def remodel(): #DB=PDatabase(local='hewlsample.fs') DB = PDatabase(server='localhost', port=8080, username='******', password='******', project='novo') print DB, 'curr ref:', DB.meta.refprotein '''rec= DB['wt+D52N'] print rec.getDisplayAttribute('Structure') rec['Structure'] = rec.Structure''' r = '6 c9' rec = DB[r] DBActions.checkModels(DB=DB, selected=[r]) print rec.Structure #print rec.aaseq '''for r in DB.getRecs(): print r, type(DB.get(r).Structure) print DB.get(r).getDisplayAttribute('Structure')''' #DB.commit(note='modelling') return
def modelontheFly(self, DB, operations): """Produce the PDBlines for the mutant file""" self.MUT = DBActions.initProtool() # Create temporary array holding models if not getattr(DB, 'tmp_3Dmodels', None): DB.tmp_3Dmodels = {} # Get the structure from the parent parent = operations['parent'] parentrec = DB.get(parent) if parentrec.hasStructure() == 'available': # Have we already modelled this one? if DB.tmp_3Dmodels.has_key(str(operations)): pdblines = DB.tmp_3Dmodels[str(operations)] import Protool X = Protool.structureIO() X.parsepdb(pdblines) return pdblines, X # Read parent structure pdblines = parentrec.Structure import Protool X = Protool.structureIO() X.parsepdb(pdblines) # Perform all the operations # First do all the deletes print operations['Rotamer_operations'] for operation, uniqueid, atom in operations['Rotamer_operations']: #print operation,uniqueid,atom if operation == 'delete': X.remove_atom(uniqueid) for operation, uniqueid, atom in operations['Rotamer_operations']: if operation == 'add': # Add atom chainID = uniqueid.split(':')[0] atomname = uniqueid.split(':')[-1] residuenumber = uniqueid.split(':')[1] resid = '%s:%s' % (chainID, residuenumber) status = X.add_atom(uniqueid=uniqueid, atomname=atomname, residuenumber=residuenumber, chainid=chainID, residuename=atom['RESNAME'], xcoord=atom['X'], ycoord=atom['Y'], zcoord=atom['Z']) if not status: self.parent.record_event( 'Modelling failed in model_on_the_fly for operations: %s' % (str(operations))) return [] # Update the arrays X.Update() # Rename the rest of the atoms for this_atom in X.residues[resid]: X.atoms[this_atom]['RESNAME'] = atom['RESNAME'] X.Update() #put mutation stuff into a tuple and return it too #mutantinfo = (chainID,residuenumber) # Return the PDBlines and the instance pdblines = X.writepdb('dummy', nowrite=1) # Store for next use DB.tmp_3Dmodels[str(operations)] = pdblines[:] return pdblines, X else: print 'Parent does not have a structure' return [], None
def modelontheFly(self, DB, operations): """Produce the PDBlines for the mutant file""" self.MUT = DBActions.initProtool() # Create temporary array holding models if not getattr(DB,'tmp_3Dmodels',None): DB.tmp_3Dmodels={} # Get the structure from the parent parent = operations['parent'] parentrec = DB.get(parent) if parentrec.hasStructure() == 'available': # Have we already modelled this one? if DB.tmp_3Dmodels.has_key(str(operations)): pdblines = DB.tmp_3Dmodels[str(operations)] import Protool X=Protool.structureIO() X.parsepdb(pdblines) return pdblines,X # Read parent structure pdblines = parentrec.Structure import Protool X=Protool.structureIO() X.parsepdb(pdblines) # Perform all the operations # First do all the deletes print operations['Rotamer_operations'] for operation,uniqueid,atom in operations['Rotamer_operations']: #print operation,uniqueid,atom if operation=='delete': X.remove_atom(uniqueid) for operation,uniqueid,atom in operations['Rotamer_operations']: if operation=='add': # Add atom chainID=uniqueid.split(':')[0] atomname=uniqueid.split(':')[-1] residuenumber=uniqueid.split(':')[1] resid='%s:%s' %(chainID,residuenumber) status=X.add_atom(uniqueid=uniqueid, atomname=atomname, residuenumber=residuenumber, chainid=chainID, residuename=atom['RESNAME'], xcoord=atom['X'],ycoord=atom['Y'],zcoord=atom['Z']) if not status: self.parent.record_event('Modelling failed in model_on_the_fly for operations: %s' %(str(operations))) return [] # Update the arrays X.Update() # Rename the rest of the atoms for this_atom in X.residues[resid]: X.atoms[this_atom]['RESNAME']=atom['RESNAME'] X.Update() #put mutation stuff into a tuple and return it too #mutantinfo = (chainID,residuenumber) # Return the PDBlines and the instance pdblines=X.writepdb('dummy',nowrite=1) # Store for next use DB.tmp_3Dmodels[str(operations)]=pdblines[:] return pdblines, X else: print 'Parent does not have a structure' return [], None