def mini(total_steps=500, gradient=0.001, interval=100, object='rt', fix_flag=None, rest_flag=None, solvation=None, finish=None): global state if not state: print " realtime.mini: please run setup first..." else: model = state.model print " realtime.mini: %d atoms total\n" % model.nAtom try: while total_steps>0: total_steps = total_steps - interval state.minimize(max_iter=interval, fix_flag=fix_flag, rest_flag=rest_flag, solvation=solvation) cmd.delete(object) cmd.load_model(state.model,object,1) cmd.refresh() if finish!=None: apply(finish[0],finish[1],finish[2]) except: cmd.load_model(state.model,'ref') traceback.print_exc() print " realtime.mini: complete."
def load(): r = 0 rep = [ "simple", "technical", "ligands", "ligand_sites","ligand_sites_trans","ligand_sites_mesh","pretty", "publication" ] list = glob("pdb/*/*") # while list[0]!="pdb/f8/pdb1f8u": # list.pop(0) for file in list: print file cmd.delete('pdb') cmd.load(file,'pdb') cmd.orient('pdb') cur_rep = rep.pop(0) rep = rep + [cur_rep] getattr(pymol.preset,cur_rep)('pdb') cmd.refresh() # give PyMOL a chance time.sleep(0.02) time.sleep(0.02) time.sleep(0.02) time.sleep(0.02) cmd.refresh() time.sleep(0.02) time.sleep(0.02) time.sleep(0.02) time.sleep(0.02) while(pymol.run==0): time.sleep(0.1)
def load(): try: r = 0 list = glob(ent_dir) list.sort() # list = [ "pdb/vq" ] for dir in list: sys.__stdout__.write("\n"+dir) sys.__stdout__.flush() for file in glob(dir+"/pdb*"): name = os.path.split(file)[-1] name = string.split(name,'.')[0] cmd.disable() cmd.load(file,name) cmd.show_as("cartoon",name) cmd.refresh() cmd.dss(name) cmd.refresh() time.sleep(0.1) sys.__stdout__.write(".") sys.__stdout__.flush() sys.__stdout__.write("("+str(cmd.count_atoms())+")") sys.__stdout__.flush() cmd.dss() cmd.delete('all') except: traceback.print_exc()
def Update(self): try: # Copy the initial protein (Frame 1) into the working state cmd.create(self.TargetObj, self.TargetName, 1, self.State) cmd.refresh() # Display the last frame cmd.frame(self.State) #print "Switched to frame " + str(self.State) except: self.CriticalError("Object " + str(self.TargetName) + " no longer exists") if not self.UpdateLigandAnchorPoint() and not self.UpdateLigandFlexibility(): self.selSideChains = self.UpdateSideChainConformations() if self.WriteOutLigand() or self.EditView() or \ self.top.UpdateDataList(self.Line, self.TOP, self.top.Reference, self.dictCoord): self.Delete_Object() self.Delete_Object() return
def RefreshDisplay(self): try: # Display the atoms spheres cmd.show('spheres', self.LigDisplay) cmd.refresh() cmd.alter(self.LigDisplay,'vdw=0.25') cmd.rebuild(self.LigDisplay) cmd.refresh() util.cbag(self.LigDisplay) cmd.refresh() if self.AnchorAtom != -1: AtomSel = self.LigDisplay + ' & id ' + str(self.AnchorAtom) cmd.color('white',AtomSel) cmd.refresh() cmd.alter(AtomSel ,'vdw=0.30') cmd.rebuild(AtomSel) cmd.refresh() except: self.ErrorCode = 1 return self.ErrorCode
def simulation(): import traceback try: while 1: for part in particle: # simplistic Euler intergration # p = p + v part[1] = (half_box + part[1] + part[5]) % box_size - half_box part[2] = (half_box + part[2] + part[6]) % box_size - half_box part[3] = (half_box + part[3] + part[7]) % box_size - half_box # v = v + pseudo-gravitational acceleration factor = max(0.1 * box_size, 0.1 * (part[1] ** 2 + part[2] ** 2 + part[3] ** 2) ** 1.5) part[5] = part[5] - part[1] / factor part[6] = part[6] - part[2] / factor part[7] = part[7] - part[3] / factor cmd.alter_state(1, "cloud", "(x,y,z) = particle[int(resi)][1:4]", space=globals()) cmd.refresh() except: traceback.print_exc()
def DisplaySphere(self): try: # Display the Sphere cmd.delete(self.SphereDisplay) cmd.refresh() except: pass try: cmd.pseudoatom(self.SphereDisplay, pos=self.SphereView.Center, vdw=self.SphereView.Radius, state=self.State) cmd.refresh() cmd.color('oxygen', self.SphereDisplay) cmd.refresh() cmd.hide('everything', self.SphereDisplay) cmd.refresh() cmd.show('spheres', self.SphereDisplay) cmd.refresh() except: self.ErrorCode = 1 return self.ErrorCode
def Quit_Wizard(self): try: # Delete Sphere object General_cmd.unmask_Objects(self.exc) cmd.config_mouse(self.config_mouse) cmd.delete(self.SphereDisplay) cmd.refresh() except: pass # Catch error in App if self.ErrorCode > 0: self.App.WizardError = True # Re-enable controls self.App.ActiveWizard = None cmd.set_wizard() cmd.set_view(self.View) cmd.refresh() self.queue.put(lambda: self.top.SphereRunning(False)) self.queue.put(lambda: self.top.top.root.deiconify()) self.queue.put(lambda: self.top.top.root.update())
def displayPartition(self): auto_zoom = cmd.get("auto_zoom") try: cmd.delete(self.PartitionDisplay) cmd.refresh() except: pass try: cmd.set("auto_zoom", 0) cmd.load(self.TempPartition, self.PartitionDisplay, format='pdb') cmd.refresh() cmd.hide('everything', self.PartitionDisplay) cmd.refresh() cmd.show('surface', self.PartitionDisplay) cmd.refresh() cmd.color('grey60', self.PartitionDisplay) cmd.refresh() General_cmd.Oscillate(self.Cleft.CleftName, 0.0) except: self.top.DisplayMessage(" ERROR: An error occured while displaying the partitionned cleft", 1) cmd.set("auto_zoom", auto_zoom)
def load(): cmd.set("valence") r = 0 list = glob("pdb/*/*") # while list[0]!="pdb/f8/pdb1f8u": # list.pop(0) cmd.set("label_size",-1.0) for file in list: try: cmd.delete('pdb') cmd.load(file,'pdb') cmd.set_title('pdb',1,os.path.split(file)[-1]) cmd.rewind() cmd.orient('pdb') cmd.label("polymer and (name ca or elem P)","'//%s/%s/%s`%s/%s'%(segi,chain,resn,resi,name)") cmd.refresh() sys.__stderr__.write(".") sys.__stderr__.flush() n = cmd.count_states() if n>1: cmd.rewind() sys.__stderr__.write(file+"\n") sys.__stderr__.flush() for a in range(1,n+1): cmd.forward() cmd.refresh() except: traceback.print_exc()
def SphereRunning(self, boolRun): if boolRun: self.Start_Update() try: cmd.delete(self.SphereDisplay) cmd.refresh() except: pass self.Disable_Frame(self.ResizeSphere,self.lblRadius) self.ResizeSphere.config(from_=0.5,to=self.Sphere.MaxRadius) self.SphereSize.set(self.Sphere.Radius) else: self.End_Update() self.Enable_Frame() if not self.top.WizardError and self.top.WizardResult == 2: self.dictSpheres[self.SphereID] = self.Sphere.Copy() self.update_Spheres() self.Vertex = self.write_Partition() self.displayPartition() self.Step2Selection.set('')
def Quit_Wizard(self, rv): try: cmd.delete(self.LigDisplay) cmd.delete(self.AtomDisplay) cmd.deselect() if rv != 1: General.unmask_Objects(self.exc) cmd.set('mouse_selection_mode', self.selection_mode) #cmd.config_mouse('three_button_editing', 1) if rv > 0: self.FlexAID.WizardError = True self.FlexAID.ActiveWizard = None cmd.set_wizard() cmd.set_view(self.View) cmd.refresh() self.top.SATRunning(False) self.queue.put(lambda: self.top.AnchorRunning(False)) self.queue.put(lambda: self.FlexAID.root.deiconify()) self.queue.put(lambda: self.FlexAID.root.update()) except: pass
def Quit_Wizard(self): try: General_cmd.unmask_Objects(self.exc) cmd.set('mouse_selection_mode', self.selection_mode) cmd.delete(self.LigDisplay) cmd.refresh() cmd.deselect() except: pass if self.ErrorCode > 0: self.FlexAID.WizardError = True self.FlexAID.WizardResult = self.AnchorAtom self.FlexAID.ActiveWizard = None self.queue.put(lambda: self.top.AnchorRunning(False)) self.queue.put(lambda: self.FlexAID.root.deiconify()) self.queue.put(lambda: self.FlexAID.root.update()) cmd.set_wizard() cmd.set_view(self.View) cmd.refresh()
def Btn_Anchor_Clicked(self): if self.LigandPath.get(): self.AnchorRunning(True) self.top.ActiveWizard = Anchor.anchor(self, self.queue, self.LigandPath.get(), self.Anchor.get()) cmd.set_wizard(self.top.ActiveWizard) cmd.refresh() self.top.ActiveWizard.Start()
def update(self, configuration=None): try: cmd.set("suspend_updates","1") self._setCoordinates(configuration) cmd.load_model(self.model, self.name, 1) except: cmd.set("suspend_updates","0") traceback.print_exc() cmd.set("suspend_updates","0") cmd.refresh()
def wait_for(name, state=0, quiet=1): ''' DESCRIPTION Wait for "name" to be available as selectable object. ''' if cmd.count_atoms('?' + name, 1, state) == 0: s = cmd.get_setting_boolean('suspend_updates') if s: cmd.set('suspend_updates', 0) cmd.refresh() if s: cmd.set('suspend_updates')
def Delete_Object(self): try: # delete temporary protein PDB file cmd.delete(self.TargetObj) cmd.refresh() cmd.delete(self.LigandObj) cmd.refresh() except: self.CriticalError("Object " + str(self.TargetObj) + " no longer exists")
def AddEditDel_Constraint(self): if not self.PyMOL: return self.ConsRunning(True) self.top.ActiveWizard = Constraint.constraint(self, self.queue) cmd.set_wizard(self.top.ActiveWizard) cmd.refresh() self.top.ActiveWizard.Start()
def load(): global last1, last2 list = glob("pdb/*/*") list = map(lambda x: (random.random(), x), list) list.sort() list = map(lambda x: x[1], list) l = len(list) c = 0 for file in list: c = c + 1 try: cmd.set("suspend_updates", "1") cmd.delete("pdb") print file, last1, last2, c, "of", l last2 = last1 last1 = file cmd.load(file, "pdb") cmd.set_title("pdb", 1, os.path.split(file)[-1]) cmd.rewind() # cmd.refresh() # cmd.hide() cmd.show("cartoon") cmd.color("auto", "ss h") cmd.color("auto", "ss s") cmd.orient("pdb") cmd.color("auto", "organic and elem c") cmd.show("spheres", "organic") cmd.move("z", -50.0) sys.__stderr__.write(".") sys.__stderr__.flush() n = cmd.count_states() finally: cmd.set("suspend_updates", "0") if cmd.count_atoms(): start = time.time() if n > 1: while (time.time() - start) < cycle_time: for a in range(1, n + 1): cmd.refresh() cmd.frame(a) cmd.move("z", 2) cmd.turn("y", 1) time.sleep(0.025) sys.__stderr__.write(" %d of %d" % (c, l)) sys.__stderr__.write("\n") sys.__stderr__.flush() else: cmd.refresh() while (time.time() - start) < cycle_time: for a in range(1, n + 1): time.sleep(0.05) cmd.move("z", 1.0) cmd.turn("y", 1)
def Btn_DownloadPDB_Clicked(self): PdbCode = self.FetchPDB.get() try: if self.PyMOL: cmd.fetch(PdbCode, **{'async': 0}) cmd.refresh() except: self.DisplayMessage(' You entered an invalid PDB code.', 1) self.FetchPDB.set('')
def ResizeSphere(self): self.SphereView.Set_Radius(self.SphereSize.get()) try: cmd.alter(self.SphereDisplay,'vdw=' + str(self.SphereView.Radius)) cmd.rebuild(self.SphereDisplay) cmd.refresh() except: self.queue.put(lambda: self.App.DisplayMessage(" ERROR: Could not resize the Sphere", 1)) self.queue.put(lambda: self.App.DisplayMessage(" The wizard will abort prematurely", 1)) self.Quit_Wizard()
def Btn_SaveObject_Clicked(self, objtype): # Get the Drop Down List Selection Name ddlSelection = self.defaultOption.get() state = cmd.get_state() self.Set_Object_Variables(objtype) if ddlSelection == '' or self.Validate_ObjectSelection(ddlSelection, objtype, state): return Path = tkFileDialog.asksaveasfilename(filetypes=[('PDB File','*.pdb')], initialdir=self.savepath, title='Save the PDB File', initialfile=ddlSelection, defaultextension='.pdb') if len(Path) > 0: Path = os.path.normpath(Path) if General.validate_String(Path, '.pdb', True, False, True): self.DisplayMessage(" ERROR: Could not save the file because you entered an invalid name.", 2) return if self.top.ValidateSaveProject(Path, objtype): self.DisplayMessage(" ERROR: The file can only be saved at its default location", 2) return try: cmd.save(Path, ddlSelection, state) Name = os.path.basename(os.path.splitext(Path)[0]) cmd.load(Path, Name, state=1) cmd.refresh() if ddlSelection != Name: # as if the object was renamed, delete the object cmd.delete(ddlSelection) except: self.DisplayMessage(" ERROR: An error occured while saving the object.", 1) return self.VarPath.set(os.path.normpath(Path)) self.VarName.set(Name) self.VarProc.set('') self.top.SaveSessionFile = '' #self.VarMD5.set(General.hashfile(self.VarPath.get())) if objtype == 'Ligand': self.Reset_Ligand() self.DisplayMessage(' Successfully saved and loaded the object: ' + self.VarName.get() + "'", 0)
def SmilesRunning(self, boolRun, Convert): if boolRun: self.Disable_Frame() else: # When a user inputs a SMILES string, need to first write to a .smi file self.Enable_Frame() if Convert and self.SmilesString.get(): Filebase = self.SmilesLigand if self.SmilesName.get(): Filebase = self.SmilesName.get() if not self.Write_Smiles(Filebase) and not self.Convert_Smiles() and \ not self.Move_TempLigand(Filebase): LigandFile = os.path.join(self.top.FlexAIDTempProject_Dir, Filebase + '.mol2') try: cmd.delete(Filebase) cmd.refresh() except: pass self.LigandPath.set(LigandFile) if not self.Load_ProcConvLigand(LigandFile, Filebase, True) and \ not self.Validate_ObjectSelection(Filebase, 'Ligand', 1): self.LigandName.set(Filebase) self.Reset_Ligand() if self.ForceSaveObject(LigandFile, Filebase, 'Ligand'): self.LigandPath.set('') self.LigandName.set('') #self.ProcessOnly = True else: self.LigandPath.set('') self.LigandName.set('') else: self.LigandPath.set('') self.LigandName.set('') self.ProcessedLigandPath.set('') self.ProcessedLigandINPPath.set('') self.ProcessedLigandICPath.set('') self.top.ChildWindow = None
def load(): cmd.set("valence") r = 0 list = glob("pdb/*/*") # while list[0]!="pdb/f8/pdb1f8u": # list.pop(0) for file in list: try: cmd.delete('pdb') cmd.load(file,'pdb') cmd.set_title('pdb',1,os.path.split(file)[-1]) cmd.rewind() cmd.orient('pdb') cmd.refresh() cmd.show_as("ribbon") cmd.refresh() cmd.show_as("sticks") cmd.refresh() sys.__stderr__.write(".") sys.__stderr__.flush() n = cmd.count_states() if n>1: cmd.rewind() sys.__stderr__.write(file+"\n") sys.__stderr__.flush() for a in range(1,n+1): cmd.forward() cmd.refresh() except: traceback.print_exc()
def Btn_AddRemove_FlexBonds(self): if not self.PyMOL: return self.FlexStatus.set('') self.FlexBondsRunning(True) self.top.ActiveWizard = FlexBonds.flexbond(self, self.queue, self.top.IOFile.ResSeq.get(),self.top.IOFile.ProcessedLigandPath.get()) cmd.set_wizard(self.top.ActiveWizard) cmd.refresh() self.top.ActiveWizard.Start()
def Btn_Edit_AtomTypes(self): if not self.PyMOL: return self.SATStatus.set('') self.SATRunning(True) self.top.ActiveWizard = AtomTypes.setType(self, self.queue, self.top.IOFile.OldTypes.get()) cmd.set_wizard(self.top.ActiveWizard) cmd.refresh() self.top.ActiveWizard.Start()
def Btn_LoadObject_Clicked(self, objtype): self.Set_Object_Variables(objtype) SupportedFormats = self.Get_SupportedFormats(objtype) Path = tkFileDialog.askopenfilename(filetypes=SupportedFormats, initialdir=self.savepath, title='Select a file to Load') # Path = self.top.root.master.splitlist(Path) if len(Path) > 0: Path = os.path.normpath(Path) if General.validate_String(Path, '', True, False, True): self.DisplayMessage(" ERROR: Could not load the file because it has an invalid name.", 2) return if Path == self.VarPath.get(): self.DisplayMessage(" Loading skipped. File is the same as the one already loaded.", 2) return try: Name = os.path.basename(os.path.splitext(Path)[0]) cmd.load(Path, Name, state=1) cmd.refresh() if self.Validate_ObjectSelection(Name, objtype, 1): return except: self.DisplayMessage(" ERROR: An error occured while loading the file.", 1) return self.VarPath.set(Path) self.VarName.set(Name) self.VarProc.set('') self.top.SaveSessionFile = '' if objtype == 'Ligand': self.Reset_Ligand() if self.ForceSaveObject(Path,Name,objtype): self.VarPath.set('') self.VarName.set('') #self.VarMD5.set(General.hashfile(self.VarPath.get())) self.DisplayMessage(" Successfully loaded the object: '" + self.VarName.get() + "'", 0)
def Rotate( angleX, angleY): #if not CheckMaster(controller): # return currtime = time.clock() global lastmovetime #Slowdown code vvv - don't use for right now if ((currtime - lastmovetime) < .01): #print "derp" return view = list(cmd.get_view()) view = rotateView(view, angleX/20, angleY/20, 0) cmd.set_view(view) #DamageGUI() cmd.refresh() lastmovetime = time.clock()
def Step2_Prev(self): if self.top.ActiveWizard is None: self.activate_Step(1) self.highlight_Step(1) self.Step = 1 cmd.delete(self.PartitionDisplay) cmd.refresh() cmd.delete(self.SphereDisplay) cmd.refresh() else: self.top.DisplayMessage("Could not execute task: A Wizard is active")
def load(): cmd.set("valence") cmd.unset("auto_zoom") cmd.zoom("center",100) r = 0 list = glob("pdb/*/*") # while list[0]!="pdb/f8/pdb1f8u": # list.pop(0) for file in list: try: cmd.delete('pdb') cmd.load(file,'pdb') cmd.set_title('pdb',1,os.path.split(file)[-1]) cmd.refresh() except: traceback.print_exc()
def edot1(event): delcrea() try: cmd.isodot('map1', 'map', contour1.get(), 'sele') except: try: cmd.set("suspend_updates", 1, quiet=1) cmd.remove("hydro") cmd.enable('all') cmd.map_new('map', "gaussian", "0.75", 'all') cmd.isodot("map1", "map", 9999.0, 'all') cmd.set("suspend_updates", 0, quiet=1) cmd.refresh() cmd.isodot('map1', 'map', contour1.get(), 'sele') cmd.get_names('all') except: cmd.orient('all') showinfo( "Error", 'No PDB is present\nOr there is no selection (' "sele" ')') interior.mainloop()
def Step2_Add(self): if self.top.ActiveWizard is None: self.SphereID = self.Get_SphereID() self.Sphere = SphereObj.SphereObj(self.Width / 1.5, self.Width, self.Center) self.SphereRunning(True) self.top.ActiveWizard = Sphere.Sphere( self, self.queue, self.Sphere, self.SphereID, self.SphereSize, "The grayed volume of the cleft is the volume that will be conserved." ) cmd.set_wizard(self.top.ActiveWizard) cmd.refresh() self.top.ActiveWizard.Start() else: self.top.DisplayMessage( "Could not execute task: A Wizard is active")
def Modify_Display(self, var, display): if var.get(): try: cmd.show(display, 'TOP_*__ & ! resn LIG') cmd.refresh() #cmd.show(display, 'RESULT_*__ & ! resn LIG') #cmd.refresh() except: pass else: try: cmd.hide(display, 'TOP_*__ & ! resn LIG') cmd.refresh() #cmd.hide(display, 'RESULT_*__ & ! resn LIG') #cmd.refresh() except: pass
def color_shift(start="Apo2",end="cterm2",divide=100): stored.start_colors=[] cmd.iterate("%s and name ca and chain A" % start,"stored.start_colors.append(color)") stored.end_colors=[] cmd.iterate("%s and name ca and chain A" % end,"stored.end_colors.append(color)") print stored.start_colors[0],stored.end_colors[0] print cmd.get_color_tuple(stored.start_colors[0]),cmd.get_color_tuple(stored.end_colors[0]) start_color_indice=cmd.get_color_tuple(stored.start_colors[0]) end_color_indice=cmd.get_color_tuple(stored.end_colors[0]) print "start ,end" print start_color_indice,end_color_indice print np.array(end_color_indice)-np.array(start_color_indice) #print (np.array(end_color_indice)-np.array(start_color_indice))/float(divide) graduate_color_indice=(np.array(end_color_indice)-np.array(start_color_indice))/float(divide) i=1 while i<divide: i+=1 #print list(np.array(start_color_indice)+graduate_color_indice*i) time.sleep(0.1) cmd.refresh() cmd.recolor() cmd.set_color("temp%s" %i,list(np.array(start_color_indice)+graduate_color_indice*i)) cmd.color("temp%s" % i,"%s and name ca and chain A" % start)
def Load_Clefts(self): auto_zoom = cmd.get("auto_zoom") cmd.set("auto_zoom", 0) # for Cleft in self.TempBindingSite.listClefts: for CleftName in self.TempBindingSite.Get_SortedCleftNames(): Cleft = self.TempBindingSite.Get_CleftName(CleftName) try: cmd.load(Cleft.CleftFile, Cleft.CleftName, state=1) cmd.refresh() if Cleft.Partition and Cleft.PartitionParent != None and \ General_cmd.object_Exists(Cleft.PartitionParent.CleftName): General_cmd.Oscillate(Cleft.PartitionParent.CleftName, 0.0) except: self.top.DisplayMessage( " ERROR: Failed to load cleft object '" + Cleft.CleftName + "'", 2) continue cmd.set("auto_zoom", auto_zoom)
def highlight_FlexibleSC(self, selString): Error = 0 try: cmd.delete(self.FlexSCDisplay) cmd.refresh() except: pass try: cmd.set("auto_zoom", 0) # Create new object from selection cmd.create(self.FlexSCDisplay, selString, target_state=self.State) cmd.refresh() # Visual appearance cmd.hide('lines', self.FlexSCDisplay) cmd.refresh() cmd.show('sticks', self.FlexSCDisplay) cmd.refresh() cmd.color('white', self.FlexSCDisplay) cmd.refresh() cmd.label(self.FlexSCDisplay + " & name CA", "resn+resi") cmd.mask(self.FlexSCDisplay) except: Error = 1 cmd.set("auto_zoom", self.auto_zoom) return Error
def do_key(self, k, x, y, m): if k in [8, 127]: self.new_name = self.new_name[:-1] elif k == 27: cmd.set_wizard() cmd.refresh() elif k == 32: self.new_name = self.new_name + "_" elif k > 32: self.new_name = self.new_name + chr(k) elif k == 10 or k == 13: self.new_name = string.strip(self.new_name) if self.mode == 'object': cmd.do("set_name %s,%s" % (self.old_name, self.new_name), log=0) elif self.mode == 'scene': cmd.do("scene %s,rename,new_key=%s" % (self.old_name, self.new_name), log=0) cmd.set_wizard() cmd.refresh() return 1 cmd.refresh_wizard() return 1
def is_ATOM(Residue, Prot): resn = Residue[0:3] resi = Residue[3:len(Residue) - 1] try: cmd.select("rtmp1__", "resi " + resi + " & resn " + resn + " & " + Prot) cmd.select( "rtmp2__", "resi " + resi + " & resn " + resn + " & " + Prot + " & not hetatm") if cmd.count_atoms("rtmp1__") == cmd.count_atoms("rtmp2__"): cmd.delete("rtmp*__") cmd.refresh() return 1 cmd.delete("rtmp*__") cmd.refresh() except: return -1 return 0
def Step2_Edit(self): if self.top.ActiveWizard is None and self.Sphere is not None: if not self.dictSpheres.get(self.Step2Selection.get()): return self.SphereID = self.Step2Selection.get() self.SphereRunning(True) self.top.ActiveWizard = Sphere.Sphere( self, self.queue, self.Sphere, self.Step2Selection.get(), self.SphereSize, "The grayed volume of the cleft is the volume that will be conserved." ) cmd.set_wizard(self.top.ActiveWizard) cmd.refresh() self.top.ActiveWizard.Start() else: self.top.DisplayMessage( "Could not execute task: A Wizard is active")
def images_morph(images): global imagecount global ray global filename global ximage global yimage print "... Images %s - %s:" % (imagecount, imagecount + images - 1) print "Writing %s images morphing froms state %s to state %s" % \ (images, 1, images) #cycle over images for i in range(0, images): #change state cmd.set("state", i + 1) #print image cmd.png("images/%s_%04d" % (filename, imagecount), ray=ray) #increment imagecounter imagecount = imagecount + 1 cmd.refresh()
def roving_density(): delcrea() try: cmd.set("suspend_updates", 1, quiet=1) cmd.remove("hydro") cmd.disable() cmd.enable('all') cmd.map_new('map', "gaussian", "0.75", 'all') cmd.set('roving_isomesh', rovingradius1.get()) cmd.set("roving_detail", 1) cmd.set("stick_radius", 0.5) cmd.set("roving_sticks", 0) cmd.set('roving_lines', rovingradius1.get()) cmd.set("roving_polar_contacts", 0) cmd.set("line_width", "3") cmd.set("roving_map1_name", 'map') cmd.isomesh("map1", "map", 9999.0, 'all') cmd.set("suspend_updates", 0, quiet=1) cmd.refresh() cmd.delete('rov_s1') cmd.set('roving_isosurface', 0) except: showinfo("Error", 'No PDB is present') interior.mainloop()
def dyna(steps, iter=1): global state if not state: print(" realtime.dyna: please run setup first.") else: state.echo = 0 model = state.model print(" realtime.dyna: %d atoms total\n" % model.nAtom) xtra_kw = [] xtra_kw.extend(keyword.get_inactive(model, 3)) xtra_kw.extend(keyword.get_restrain_positions(model, 2, 0, 10)) xtra_kw.extend(keyword.get_restrain_positions(model, 5, 0.5, 1)) xtra_kw.extend(keyword.get_inactive(model, 6)) state.keywords['chg-cutoff'] = 10.0 state.keywords['vdw-cutoff'] = 7.00 state.keywords['lights'] = '' state.keywords['restrainterm'] = '' for x in range(0, iter): state.dynamics(steps=steps, timestep=1, kw=xtra_kw) if not len(state.summary): break for a in state.summary: print(a) cmd.load_model(model, 'dyna') cmd.ending() cmd.refresh() io.pkl.toFile("realtime.pkl") print(" realtime.dyna: terminated after %d steps." % state.counter)
def roving(self, cleanup=0): if not cleanup: cmd.load("$PYMOL_DATA/demo/il2.pdb") cmd.remove("hydro") cmd.disable() cmd.enable("il2") cmd.set("ribbon_color", "blue", "il2") cmd.set("roving_detail", 1) cmd.set("roving_origin", 1) cmd.set("stick_radius", 0.12, "il2") # cmd.zoom("/il2///16/O") # cmd.zoom("center",12) cmd.set_view ((\ 0.132852688, -0.729740858, 0.670686543,\ -0.228543565, 0.635894477, 0.737154961,\ -0.964425683, -0.251212329, -0.082298420,\ 0.000062190, 0.000183226, -58.861488342,\ 13.349151611, -1.565427899, 22.383148193,\ 55.259441376, 63.259449005, 0.000000000 )) else: cmd.delete("il2") cmd.set("roving_detail", 0) cmd.refresh() cmd.delete("rov_*")
def images_slide(images, distance, axis): global imagecount global ray global filename global ximage global yimage print "... Images %s - %s:" % (imagecount, imagecount + images - 1) print "Writing %s images moving along %s axis by %s Angstrom per image" % \ (images, axis, distance/images) #cycle for number of images for i in range(0, images): # transformations cmd.move(axis, distance / images) #print image cmd.png("images/%s_%04d" % (filename, imagecount), ray=ray) #increment imagecounter imagecount = imagecount + 1 cmd.refresh()
def run(self): print("FlexAID parsing thread has begun.") # Set the auto_zoom to off cmd.set("auto_zoom", 0) cmd.delete("TOP_*__") cmd.delete("RESULT_*") cmd.refresh() cmd.frame(1) self.queue.put(lambda: self.top.InitStatus()) self.queue.put(lambda: self.top.progressBarHandler(0, self.NbTotalGen)) # send ready to simulate signal print(' Signal sent to start simulation') self.FlexAID.ParseState = 0 print(' Waiting for FlexAID to start') # wait for FlexAID to start, to crash or to finish (if simulation is very short and quickly done) while self.FlexAID.SimulateState < 0: time.sleep(self.top.INTERVAL) print(' Parsing the logfile of FlexAID') while self.FlexAID.Run is not None: # and self.FlexAID.Run.poll() is None: time.sleep(self.top.INTERVAL) if self.ParseLines(): break if not self.FlexAID.ParseState > 0: self.ParseLines() # Put back the auto_zoom to on cmd.set("auto_zoom", self.auto_zoom) # error in simulation or parsing? if self.FlexAID.SimulateState > 0 or self.FlexAID.ParseState > 0: self.queue.put(lambda: self.top.ErrorStatus(self.ErrorMsg)) else: self.queue.put(lambda: self.top.SuccessStatus()) if self.top.Results: cmd.enable("RESULT_*") cmd.refresh() cmd.disable("TOP_*__") cmd.refresh() cmd.frame(1) self.FlexAID.ParseState = 10 print("FlexAID parsing thread has ended.")
def Oscillate(sel, interval): # Determine if selection is enabled/disabled Visible = 0 if cmd.count_atoms('v. & ' + sel) > 0: Visible = 1 if Visible: cmd.disable(sel) cmd.refresh() time.sleep(interval) cmd.enable(sel) cmd.refresh() time.sleep(interval) else: cmd.enable(sel) cmd.refresh() time.sleep(interval) cmd.disable(sel) cmd.refresh() time.sleep(interval)
def displaySphere(self): try: cmd.delete(self.SphereDisplay) cmd.refresh() except: pass if self.Sphere != None: # Only display sphere in current state cmd.pseudoatom(self.SphereDisplay, pos=self.Sphere.Center, vdw=self.Sphere.Radius, color='purpleblue', state=cmd.get_state()) cmd.refresh() cmd.hide('nonbonded',self.SphereDisplay) cmd.refresh() cmd.show('spheres', self.SphereDisplay) cmd.refresh() cmd.set('sphere_transparency', 0.7, self.SphereDisplay) cmd.rebuild(self.SphereDisplay)
def highlight_Atom(self, atom): try: cmd.pseudoatom(self.AtomDisplay, pos=atom[5:], vdw=0.30, color='white') cmd.refresh() cmd.hide('nonbonded', self.AtomDisplay) cmd.refresh() cmd.show('spheres', self.AtomDisplay) cmd.refresh() cmd.mask(self.AtomDisplay) except: self.queue.put(lambda: self.top.DisplayMessage(" ERROR: Failed to highlight atom upon selecting atom", 1)) return
def DisplayLigand(self): try: cmd.set("auto_zoom", 0) cmd.load(self.LigandPath, self.LigDisplay, state=self.State) cmd.refresh() cmd.translate(self.Translation, self.LigDisplay) cmd.refresh() cmd.zoom(self.LigDisplay) cmd.refresh() except: self.ErrorCode = 1 cmd.set("auto_zoom", self.auto_zoom) return self.ErrorCode
def Nice_Display(self, Result, ResultName): cmd.hide('everything', ResultName) cmd.refresh() cmd.show('cartoon', ResultName) cmd.refresh() for opt in Result.Optimizable: if opt.rnc[:3] == 'LIG': cmd.show('lines', 'byres(resn LIG around 5.0) & ' + ResultName) res = opt.rnc[:3].replace('-', '') num = opt.rnc[3:len(opt.rnc) - 1].replace('-', '') chn = opt.rnc[-1:].replace('-', '') sele = 'resn ' + res + ' & resi ' + num + ' & chain \'' + chn + '\' & ' + ResultName cmd.show('sticks', sele) cmd.color('white', sele) util.cnc(ResultName) cmd.refresh()
def Quit_Wizard(self): try: #Delete the Residue objects cmd.delete(self.FlexSCDisplay) cmd.refresh() cmd.delete(self.ResidueDisplay) cmd.refresh() #cmd.delete(self.BackboneDisplay) #cmd.refresh() except: pass if self.ErrorCode != 1: General_cmd.unmask_Objects(self.exc) cmd.set('mouse_selection_mode', self.selection_mode) #cmd.config_mouse('three_button_editing', 1) if self.ErrorCode > 0: self.FlexAID.WizardError = True self.FlexAID.WizardResult = self.TargetFlex.Count_SideChain() self.queue.put(lambda: self.top.FlexSCRunning(False)) self.FlexAID.ActiveWizard = None self.queue.put(lambda: self.FlexAID.root.deiconify()) self.queue.put(lambda: self.FlexAID.root.update()) cmd.set_wizard() cmd.set_view(self.View) cmd.refresh()
def Show_Clefts(self): i = 0 for CleftName in self.TempBindingSite.Get_SortedCleftNames(): Cleft = self.TempBindingSite.Get_CleftName(CleftName) try: cmd.hide('everything', Cleft.CleftName) cmd.refresh() cmd.color(self.ColorList[i], Cleft.CleftName) cmd.refresh() cmd.show('surface', Cleft.CleftName) cmd.refresh() Cleft.Color = self.ColorHex[i] i += 1 except: self.DisplayMessage( " ERROR: Could not display cleft object '" + Cleft.CleftName + "'", 2) continue
def ColorByDisplacementAll(objSel1, objSel2, super1='all', super2='all', doColor="True", doAlign="True", AlignedWhite='yes'): # First create backup copies; names starting with __ (underscores) are normally hidden by PyMOL tObj1, tObj2, aln = "__tempObj1", "__tempObj2", "__aln" if strTrue(doAlign): # Create temp objects cmd.create(tObj1, objSel1) cmd.create(tObj2, objSel2) # Align and make create an object aln which indicates which atoms were paired between the two structures # Super is must faster than align http://www.pymolwiki.org/index.php/Super cmd.super(tObj1 + ' and ' + str(super1), tObj2 + ' and ' + str(super2), object=aln) # Modify the original matrix of object1 from the alignment cmd.matrix_copy(tObj1, objSel1) else: # Create temp objects cmd.create(tObj1, objSel1) cmd.create(tObj2, objSel2) # Align and make create an object aln which indicates which atoms were paired between the two structures # Super is must faster than align http://www.pymolwiki.org/index.php/Super cmd.super(tObj1 + ' and ' + str(super1), tObj2 + ' and ' + str(super2), object=aln) # Modify the B-factor columns of the original objects, # in order to identify the residues NOT used for alignment, later on cmd.alter(objSel1 + " or " + objSel2, "b=-0.2") cmd.alter(tObj1 + " or " + tObj2, "chain='A'") cmd.alter(tObj1 + " or " + tObj2, "segi='A'") # Update pymol internal representations; one of these should do the trick cmd.refresh() cmd.rebuild() cmd.sort(tObj1) cmd.sort(tObj2) # Create lists for storage stored.alnAres, stored.alnBres = [], [] # Iterate over objects and get resi if AlignedWhite == 'yes': cmd.iterate(tObj1 + " and not " + aln, "stored.alnAres.append((resi, name))") cmd.iterate(tObj2 + " and not " + aln, "stored.alnBres.append((resi, name))") else: cmd.iterate(tObj1, "stored.alnAres.append((resi, name))") cmd.iterate(tObj2, "stored.alnBres.append((resi, name))") # Change the B-factors for EACH object displacementUpdateBAll(tObj1, stored.alnAres, tObj2, stored.alnBres) # Store the NEW B-factors stored.alnAnb, stored.alnBnb = [], [] # Iterate over objects and get b if AlignedWhite == 'yes': # Iterate over objects which is not aligned cmd.iterate(tObj1 + " and not " + aln, "stored.alnAnb.append(b)") cmd.iterate(tObj2 + " and not " + aln, "stored.alnBnb.append(b)") else: # Or Iterate over all objects with CA cmd.iterate(tObj1, "stored.alnAnb.append(b)") cmd.iterate(tObj2, "stored.alnBnb.append(b)") # Get rid of all intermediate objects and clean up cmd.delete(tObj1) cmd.delete(tObj2) cmd.delete(aln) # Assign the just stored NEW B-factors to the original objects print "Sooon ready. 1 more minute" for x in range(len(stored.alnAres)): cmd.alter(objSel1 + " and resi " + str(stored.alnAres[x][0]) + " and name " + str(stored.alnAres[x][1]), "b = " + str(stored.alnAnb[x])) for x in range(len(stored.alnBres)): cmd.alter(objSel2 + " and resi " + str(stored.alnBres[x][0]) + " and name " + str(stored.alnBres[x][1]), "b = " + str(stored.alnBnb[x])) cmd.rebuild() cmd.refresh() cmd.sort(objSel1) cmd.sort(objSel2) # Provide some useful information stored.allRMSDval = [] stored.allRMSDval = stored.alnAnb + stored.alnBnb print "\nColorByDisplacementAll completed successfully." print "The MAXIMUM Displacement is: " + str(max(stored.allRMSDval)) + " residue " + str(stored.alnAres[int(stored.allRMSDval.index(max(stored.allRMSDval)))]) if strTrue(doColor): # Showcase what we did # cmd.orient() # cmd.hide("all") cmd.show("sticks", objSel1 + " or " + objSel2) # Select the residues not used for alignment; they still have their B-factors as "-0.2" cmd.select("notUsedForAln", "b = -0.2") # White-wash the residues not used for alignment cmd.color("white", "notUsedForAln") # Select the residues not in both pdb files; they have their B-factors as "-0.01" cmd.select("ResNotInBothPDB", "b = -0.01") # White-wash the residues not used for alignment cmd.color("black", "ResNotInBothPDB") # Color the residues used for alignment according to their B-factors (Displacement values) #cmd.spectrum("b", 'rainbow', "((" + objSel1 + ") or (" + objSel2 +" )) and not notUsedForAln+ResNotInBothPDB") cmd.spectrum("b", 'rainbow', "((" + objSel1 + ") or (" + objSel2 + " )) and not (notUsedForAln or ResNotInBothPDB)") # Delete the selection of atoms not used for alignment # If you would like to keep this selection intact, # just comment "cmd.delete" line and # uncomment the "cmd.disable" line abowe. cmd.disable("notUsedForAln") cmd.delete("notUsedForAln") cmd.disable("ResNotInBothPDB") cmd.delete("ResNotInBothPDB") print "\nObjects are now colored by C-alpha displacement deviation." print "Blue is minimum and red is maximum..." print "White is those residues used in the alignment algorithm. Can be turned off in top of algorithm." print "Black is residues that does not exist in both files..."
def volume_esp(name, map, stops=[0.1, 1.0], neg='red', pos='blue', opacity=0.2, quiet=1): ''' DESCRIPTION Create a volume object from a map object with default coloring for electrostatic potential (similar to positive and negative isosurface). ARGUMENTS name = string: name for the new volume object map = string: name of the map object to use stops = list of floats: 2 or 3 values in standard deviations for creating the volume ramp {default: [0.1, 1.0]} neg = string: color for negative volume {default: red} pos = string: color for positive volume {default: blue} opacity = float: maximum opacity in volume ramp {default: 0.2} SEE ALSO volume ''' from .setting import set_temporary opacity, quiet = float(opacity), int(quiet) if isinstance(stops, str): stops = cmd.safe_list_eval(stops) try: from pymol.colorramping import ColorRamp except ImportError: print(' Warning: volume_esp is deprecated') stdevD = cmd.get_volume_histogram(map, 0)[3] stops = [s * stdevD for s in stops] ramp = [ -stops[1], neg, opacity, -stops[0], neg, 0.0, stops[0], pos, 0.0, stops[1], pos, opacity, ] if len(stops) == 3: ramp = [-stops[2], neg, opacity] + ramp + [stops[2], pos, opacity] cmd.volume(name, map, ramp, quiet=quiet) return c_neg = cmd.get_color_tuple(neg) c_pos = cmd.get_color_tuple(pos) c_pos_0 = c_pos + (0.0, ) c_pos_1 = c_pos + (opacity, ) c_neg_0 = c_neg + (0.0, ) c_neg_1 = c_neg + (opacity, ) if len(stops) == 2: cstops = [(c_neg_1, -999), (c_neg_1, -stops[1]), (c_neg_0, -stops[0]), (c_pos_0, stops[0]), (c_pos_1, stops[1]), (c_pos_1, 999)] elif len(stops) == 3: cstops = [(c_neg_0, -999), (c_neg_0, -stops[2]), (c_neg_1, -stops[1]), (c_neg_0, -stops[0]), (c_pos_0, stops[0]), (c_pos_1, stops[1]), (c_pos_0, stops[2]), (c_pos_0, 999)] else: print(' Error: need 2 or 3 stops') raise CmdException cmd.volume(name, map, quiet=quiet) # get_volume_histogram returns zeros without refresh with set_temporary(suspend_updates='off'): cmd.refresh() minD, maxD, meanD, stdevD = cmd.get_volume_histogram(name)[:4] v_ramp = [] c_ramp = ColorRamp(360) for c, s in cstops: i = int(360 * ((s * stdevD) - minD) / (maxD - minD)) i = min(max(i, 0), 359) v_ramp.append(i) v_ramp.extend(c) c_ramp.addColor(i, c) cmd.set_volume_ramp(name, v_ramp) cmd.volume_color(name, c_ramp.getRamp()) cmd.recolor(name)
def reps(self, cleanup=0): rep_list = [ "lines", "sticks", "spheres", "surface", "mesh", "dots", "ribbon", "cartoon" ] try: if not cleanup: cmd.disable() cmd.set("suspend_updates", 1, quiet=1) cmd.load("$PYMOL_DATA/demo/pept.pdb", "rep1") cmd.alter("rep1///1-5+8-13/", "ss='S'") cmd.cartoon("auto") cmd.hide("everything", "rep1") for a in range(2, 9): cmd.create("rep%d" % a, "rep1") for x, y in enumerate(rep_list, 1): cmd.show(x, "rep%d" % y) cmd.reset() cmd.zoom("rep1", 24) util.cbay("rep2") util.cbac("rep3") util.cbas("rep4") util.cbab("rep5") util.cbaw("rep6") util.cbay("rep8") cmd.set("suspend_updates", 0, quiet=1) scale = 0.5 for b in range(1, 20): cmd.set("suspend_updates", 0, quiet=1) cmd.refresh() cmd.set("suspend_updates", 1, quiet=1) xt = -3.2 yt = 1.6 for a in range(1, 5): cmd.translate([xt * scale, yt * scale, 0], object="rep%d" % a, camera=0) xt = xt + 2 yt = -yt xt = -3.2 for a in range(5, 9): cmd.translate([xt * scale, yt * scale, 0], object="rep%d" % a, camera=0) xt = xt + 2 for a in range(1, 9): cmd.origin("rep%d" % a, object="rep%d" % a) cmd.mset("1") st = ' '.join( map( lambda x, y: "rotate angle=-3,object=rep%d,axis=%s;" % (x, y), list(range(1, 9)), ['x', 'y', 'x', 'y', 'x', 'y', 'x', 'y'])) cmd.mdo(1, st) cmd.set("suspend_updates", 0, quiet=1) cmd.mplay() cgo = [] axes = [[4.5, 0.0, 0.0], [0.0, 3.0, 0.0], [0.0, 0.0, 3.0]] c = 1 for a in rep_list: ext = cmd.get_extent("rep%d" % c) pos = [(ext[0][0] + ext[1][0]) / 2, (ext[0][1] + ext[1][1]) / 2 + 14, (ext[0][2] + ext[1][2]) / 2] c = c + 1 pos[0] = pos[0] - (measure_text(plain, a, axes) / 2) wire_text(cgo, plain, pos, a, axes) cmd.set("cgo_line_width", 1.5) cmd.set("auto_zoom", 0) cmd.load_cgo(cgo, 'reps') cmd.set("auto_zoom", 1) else: cmd.delete("rep*") cmd.mset() cmd.mstop() except: traceback.print_exc()
def colorbyrmsd(mobile, target, doAlign=1, doPretty=1, guide=1, method='super', quiet=1): ''' DESCRIPTION Align two structures and show the structural deviations in color to more easily see variable regions. Colors each mobile/target atom-pair by distance (the name is a bit misleading). Modifies the B-factor columns in your original structures. ARGUMENTS mobile = string: atom selection for mobile atoms target = string: atom selection for target atoms doAlign = 0 or 1: Superpose selections before calculating distances {default: 1} doPretty = 0 or 1: Show nice representation and colors {default: 1} EXAMPLE fetch 1ake 4ake, async=0 remove chain B colorbyrmsd 1ake, 4ake ''' from chempy import cpv doAlign, doPretty = int(doAlign), int(doPretty) guide, quiet = int(guide), int(quiet) aln, seleboth = '_aln', '_objSelBoth' try: align = cmd.keyword[method][0] except: print(' Error: no such method: ' + str(method)) raise CmdException if guide: mobile = '(%s) and guide' % mobile target = '(%s) and guide' % target try: if doAlign: # superpose align(mobile, target) # get alignment without superposing align(mobile, target, cycles=0, transform=0, object=aln) except: print(' Error: Alignment with method %s failed' % (method)) raise CmdException cmd.select(seleboth, '(%s) or (%s)' % (mobile, target)) idx2coords = dict() cmd.iterate_state(-1, seleboth, 'idx2coords[model,index] = (x,y,z)', space=locals()) if cmd.count_atoms('?' + aln, 1, 1) == 0: # this should ensure that "aln" will be available as selectable object cmd.refresh() b_dict = dict() for col in cmd.get_raw_alignment(aln): assert len(col) == 2 b = cpv.distance(idx2coords[col[0]], idx2coords[col[1]]) for idx in col: b_dict[idx] = b cmd.alter(seleboth, 'b = b_dict.get((model, index), -1)', space=locals()) if doPretty: cmd.orient(seleboth) cmd.show_as('cartoon', 'byobj ' + seleboth) cmd.color('gray', seleboth) cmd.spectrum('b', 'blue_red', seleboth + ' and b > -0.5') if not quiet: print(" ColorByRMSD: Minimum Distance: %.2f" % (min(b_dict.values()))) print(" ColorByRMSD: Maximum Distance: %.2f" % (max(b_dict.values()))) print(" ColorByRMSD: Average Distance: %.2f" % (sum(b_dict.values()) / len(b_dict))) cmd.delete(aln) cmd.delete(seleboth)
def Btn_CreatePartition(self): DestFile = '' Output = self.Step3Output.get() if General.validate_String(Output, '', False, False, True): self.DisplayMessage(" ERROR: Could not save the partition file because you entered an invalid name.", 2) return auto_zoom = cmd.get("auto_zoom") if Output != '': if not self.Vertex: self.top.DisplayMessage(" ERROR: Cannot save an empty cleft. Add spheres that include volume of the parent.", 1) return if General_cmd.object_Exists(Output): answer = tkMessageBox.askquestion("Question", message="An object with that name already exists. Would you like to overwrite it?", icon='warning') if str(answer) == 'no': return try: cmd.set("auto_zoom", 0) DestFile = os.path.join(self.top.GetCleftTempProject_Dir, Output + '.pdb') self.top.Manage.copy_TempPartition(self.TempPartition, DestFile) cmd.load(DestFile, Output, state=1) cmd.refresh() cmd.hide('everything', Output) cmd.refresh() cmd.show('surface', Output) cmd.refresh() partition_rgb = self.top.Default.SetPartitionColor(self.Cleft.CleftName) if len(partition_rgb): cmd.color('partition', Output) cmd.refresh() cmd.delete(self.PartitionDisplay) cmd.refresh() Cleft = CleftObj.CleftObj() Cleft.CleftFile = DestFile Cleft.CleftName = self.Step3Output.get() Cleft.PartitionParent = self.Cleft Cleft.Partition = True Cleft.UTarget = self.Cleft.UTarget Cleft.Set_CleftMD5() Cleft.Color = General.rgb_to_hex(partition_rgb) self.top.Default.TempBindingSite.Add_Cleft(Cleft) self.top.CopySession = False # Put the partition cleft over its parent General_cmd.Oscillate(self.Cleft.CleftName, 0.0) self.Reset_Step1() else: self.top.DisplayMessage(" ERROR: Cleft '" + self.Cleft.CleftName + "' could not be found to set partition color", 1) except: self.top.DisplayMessage(" ERROR: Could not create partition object: File not found.", 1) else: self.top.DisplayMessage(" ERROR: Could not create partition object: Output is null.", 1) cmd.set("auto_zoom", auto_zoom)
def hide_Labels(self): cmd.hide('labels', self.LigDisplay) cmd.refresh()
def show_AtomsName(self): cmd.label(self.LigDisplay, "\"%s\" % name") cmd.refresh()
def show_AtomsNumber(self): cmd.label(self.LigDisplay, "\"%d\" % ID") cmd.refresh()