def do_key(self, key, x, y, mod): """ Take responsibility for handling key presses. """ # If the user presses Ctrl-Space (key, mod == 0, 2), show the next # mutation. Otherwise let pymol handle the key press. if self.wildtype_obj and self.mutant_obj: if (key, mod) == (0, 2): self.show_next_mutation() else: return 0 # If the user hasn't specified a wildtype and a mutant object, prompt # for them. Letters (key >= 32), Backspace (key in 8, 127), and Enter # (key in 10, 13) are handled specially. Everything else is passed on # to pymol. else: if key in (8, 127): self.active_prompt = self.active_prompt[:-1] elif key >= 32: self.active_prompt += chr(key) elif key in (10, 13): if not self.wildtype_obj: self.set_wildtype_object(self.active_prompt) elif not self.mutant_obj: self.set_mutant_object(self.active_prompt) else: return 0 cmd.refresh_wizard() return 1
def finish(self): if self.r_var.get(): self.validated_values = list((self.validated_values[0],)) + \ list(map(kCal_to_kJ, self.validated_values[1:])) self.bondForceParams['T'] = self.validated_values[0] # Temperature (K) self.bondForceParams['K_r_aA'] = self.validated_values[ 1] * 100 # force constant for distance (kJ/mol/nm^2) self.bondForceParams['K_th_a'] = self.validated_values[ 2] # force constant for angle (kJ/mol/rad^2) self.bondForceParams['K_th_A'] = self.validated_values[ 3] # force constant for angle (kJ/mol/rad^2) self.bondForceParams['K_phi_ba'] = self.validated_values[ 4] # force constant for dihedral (kJ/mol/rad^2) self.bondForceParams['K_phi_aA'] = self.validated_values[ 5] # force constant for dihedral (kJ/mol/rad^2) self.bondForceParams['K_phi_AB'] = self.validated_values[ 6] # force constant for dihedral (kJ/mol/rad^2) showinfo('Info', 'Now choose the atoms you need') if self.select_atoms.get() == 'Select 6 atoms': wiz = RestraintWizard(self.parent, self.bondForceParams, self.atoms_def) else: wiz = RestraintWizardTwo(self.parent, self.bondForceParams, self.atoms_def) cmd.set_wizard(wiz) cmd.refresh_wizard() self.main.withdraw() self.main.destroy()
def set_n_cap(self,n_cap): cmd=self.cmd if n_cap in self.n_caps: self.n_cap=n_cap if self.status==1: self.do_library() cmd.refresh_wizard()
def Start(self): self.queue.put(lambda: self.FlexAID.root.withdraw()) cmd.window('hide') cmd.window('show') # self.queue.put(lambda: cmd.window('show')) cmd.refresh_wizard() self.ErrorCode = 1 try: self.selection_mode = cmd.get("mouse_selection_mode") cmd.set("mouse_selection_mode", 0) # set selection mode to atomic # Mask objects self.exc = [self.LigDisplay] General_cmd.mask_Objects(self.exc) self.ErrorCode = 0 except: self.queue.put(lambda: self.FlexAID.DisplayMessage(" ERROR: Could not start the Anchor Atom wizard", 1)) self.queue.put(lambda: self.FlexAID.DisplayMessage(" The wizard will abort prematurely", 1)) self.Quit_Wizard() return # Display the ligand from the PDB file if self.DisplayLigand() or self.RefreshDisplay(): self.queue.put(lambda: self.FlexAID.DisplayMessage(" ERROR: Could not display the ligand", 1)) self.queue.put(lambda: self.FlexAID.DisplayMessage(" The wizard will abort prematurely", 1)) self.Quit_Wizard() return # remove any possible selection before selecting atoms cmd.deselect()
def Start(self): # self.queue.put(lambda: self.top.top.root.withdraw()) cmd.window('hide') cmd.refresh_wizard() cmd.orient() cmd.window('show') # self.queue.put(lambda: cmd.window('show')) self.ErrorCode = 1 try: self.State = cmd.get_state() self.config_mouse = General_cmd.get_config_mouse() cmd.config_mouse('three_button_editing') self.exc = [ self.SphereDisplay ] General_cmd.mask_Objects(self.exc) # success self.ErrorCode = 0 except: self.queue.put(lambda: self.App.DisplayMessage(" ERROR: Could not start the Sphere wizard", 1)) self.queue.put(lambda: self.App.DisplayMessage(" The wizard will abort prematurely", 1)) self.Quit_Wizard() return if self.DisplaySphere(): self.queue.put(lambda: self.App.DisplayMessage(" ERROR: Could not display the Sphere", 1)) self.queue.put(lambda: self.App.DisplayMessage(" The wizard will abort prematurely", 1)) self.Quit_Wizard() return
def Start(self): self.queue.put(lambda: self.FlexAID.root.withdraw()) cmd.window('hide') self.queue.put(lambda: cmd.window('show')) cmd.refresh_wizard() # Display the ligand from the PDB file if self.DisplayLigand(): self.FlexAID.DisplayMessage("Error while trying to display the ligand from PDB file", 1) self.Quit_Wizard(self.ErrorCode) return # Color the Atoms based on their type if self.ColorByType(): self.FlexAID.DisplayMessage("Error while coloring the ligand atoms by type", 1) self.Quit_Wizard(self.ErrorCode) return # Mask everythign except modifyable object (ligand) self.exc = [self.LigDisplay] General.mask_Objects(self.exc) self.selection_mode = cmd.get("mouse_selection_mode") cmd.set("mouse_selection_mode", 0) # set selection mode to atomic # remove any possible selection before selecting atoms cmd.deselect() self.ErrorCode += 1
def set_and_search(self): # Set RMSD cutoff if self.is_num(self.win.rmsd.get()): #cmd.get_wizard().set_rmsd(float(self.win.rmsd.get())) self.win.rmsd.set(float(self.win.rmsd.get())) else: cmd.get_wizard().status = 'rmsd not number' cmd.refresh_wizard() return # Set number of structures if self.is_num(self.win.num_structs.get()): #cmd.get_wizard().set_num_structures(float(self.win.num_structs.get())) self.win.num_structs.set(float(self.win.num_structs.get())) else: cmd.get_wizard().status = 'num matches not number' cmd.refresh_wizard() return # Set Database if self.win.db.get() == "Test DB": self.win.datab = DATABASE_TEST elif self.win.db.get() == "Full DB": self.win.datab = DATABASE_FULL # Set Full matches if self.win.fm.get() == "Region": self.win.full_match = False elif self.win.fm.get() == "Full": self.win.full_match = True # Launch the search self.launch_search()
def launch_logo_search(self, flag): """ launches the show logo operation in the separate thread does some basic checking and gets selection """ if self.win.search is None: print 'please select target search' return else: cmd.get_wizard().status = 'logo request launched' cmd.refresh_wizard() self.stop_logo() self.win.logoThread = LogoThread(self.win.jobIDs[self.win.search], int(flag), self.win.serverURL, cmd) self.win.logoThread.start() self.win.logoThread.join() cmd.get_wizard().status = 'logo request finished' cmd.refresh_wizard() query = self.win.jobIDs[self.win.search] residues = self.win.qSeqs[self.win.search] cmd.get_wizard().makeLogo = 0 self.display_menu_logo(cmd.get_wizard().app, query, residues, self.win.rmsd.get(), flag, cmd.get_wizard())
def launch_search(self): """ launches the search in the separate thread does some basic checking and gets selection """ # gets the active selections from pymol active_selections = cmd.get_names('selections', 1) if len(active_selections) == 0: cmd.get_wizard().set_status('no selection') else: selection = active_selections[0] print "The active selections are " + str(selection) pdbstr = cmd.get_pdbstr(selection) print 'pdbstr is', pdbstr self.stop_search() # print cmd.get_wizard(), self.win.rmsd.get(), self.win.num_structs.get(), self.win.full_match, self.win.datab, pdbstr, self.win.serverURL, cmd.get_wizard().cmd, self.win.jobIDs self.win.searchThread = SearchThread(cmd.get_wizard(), self.win.rmsd.get(), self.win.num_structs.get(), self.win.full_match, self.win.datab, pdbstr, self.win.serverURL, cmd.get_wizard().cmd, self.win.jobIDs) self.win.searchThread.start() cmd.get_wizard().set_status('search launched') cmd.get_wizard().searchProgress = 0 cmd.refresh_wizard()
def launch_logo_search(self, flag): """ launches the show logo operation in the separate thread does some basic checking and gets selection """ if self.win.search is None: print 'please select target search' return else: cmd.get_wizard().status = 'logo request launched' cmd.refresh_wizard() self.stop_logo() self.win.logoThread = LogoThread( self.win.jobIDs[self.win.search], int(flag), self.win.serverURL, cmd) self.win.logoThread.start() self.win.logoThread.join() cmd.get_wizard().status = 'logo request finished' cmd.refresh_wizard() query = self.win.jobIDs[self.win.search] residues = self.win.qSeqs[self.win.search] cmd.get_wizard().makeLogo = 0 self.display_menu_logo(cmd.get_wizard().app, query, residues, self.win.rmsd.get(), flag, cmd.get_wizard())
def do_select(self, name): self.atom = self.get_Atom(name) if self.atom: resn = self.atom[1] resi = self.atom[2] chain = self.atom[3] if chain == '': chain = '-' self.ResidueName = resn + str(resi) + chain Error = self.top.Validate_EnterResidue(self.ResidueName) if Error != '': self.ErrorStatus = [ Error ] self.btn_Reset() else: self.ErrorStatus = [ ] self.highlight_Residue(name) cmd.deselect() cmd.refresh_wizard()
def set_and_search(self): # Set RMSD cutoff if self.is_num(self.win.rmsd.get()): cmd.get_wizard().set_rmsd(float(self.win.rmsd.get())) else: cmd.get_wizard().status = 'rmsd not number' cmd.refresh_wizard() return # Set number of structures if self.is_num(self.win.num_structs.get()): cmd.get_wizard().set_num_structures(self.win.num_structs.get()) else: cmd.get_wizard().status = 'num matches not number' cmd.refresh_wizard() return # Set Database if self.win.db == "Test DB": cmd.get_wizard().set_database("Test") elif self.win.db == "Full DB": cmd.get_wizard().set_database("Full") # Set Full matches if self.win.fm == "Region": cmd.get_wizard().set_full_matches(False) elif self.win.fm == "Full": cmd.get_wizard().set_full_matches(True) # Launch the search cmd.get_wizard().launch_search()
def set_c_cap(self,c_cap): cmd=self.cmd if c_cap in self.c_caps: self.c_cap=c_cap if self.status==1: self.do_library() cmd.refresh_wizard()
def pymol_mutate(file_name, chain, res_index): pymol.finish_launching() cmd.delete('all') selection = chain + '/' + res_index + '/' mutant = 'CYS' cmd.wizard("mutagenesis") pdb = file_name[:-4] cmd.load(file_name) cmd.remove('not (alt ''+A)') cmd.select('mut', 'resi ' + res_index + ' and chain ' + chain) if cmd.count_atoms('mut') == 0: return False cmd.refresh_wizard() cmd.get_wizard().set_mode(mutant) cmd.get_wizard().do_select(selection) nStates = cmd.count_states("mutation") for i in range(1, nStates + 1): cmd.get_wizard().do_select(selection) cmd.frame(i) cmd.get_wizard().apply() cmd.save("rec_" + str(res_index) + "_" + str(i) + ".pdb") cmd.set_wizard() cmd.remove(file_name[:-4]) return True
def do_select(self, name): # map selects into picks from .selecting import select_sspick if self.name not in cmd.get_names('selections', enabled_only=1): self.name = cmd.get_unused_name('ss') select_sspick(name, self.name, self.selection_mode) cmd.enable(self.name) cmd.refresh_wizard()
def set_hyd(self,hyd): cmd=self.cmd if hyd in self.hyds: self.hyd=hyd if self.status==1: self.do_library() cmd.refresh_wizard()
def set_mode(self,mode): cmd=self.cmd if mode in self.modes: self.mode = mode if self.status==1: self.do_library() cmd.refresh_wizard()
def mutate_atoms(desired_sequence): # Acquire the lock once you execute this program lock.acquire() cmd.reset() # Check the length of peptide sequence # If the sequence does not match the MHC structure, the program will terminate. try: if len(desired_sequence) != 9: raise AssertionError except AssertionError: sys.exit( "Please input a peptide sequence with exactly 9 residues (in short abbreviation, no space)!" ) # Execute the mutation command based on the PyMOL API. # For each round, we construct a new PyMOL object to avoid the problem of different mutation affecting each other. cmd.wizard("mutagenesis") cmd.load("structures/3pwn_clear_original.pdb") new_sequence = translate_sequence(desired_sequence) for i in range(len(new_sequence)): cmd.refresh_wizard() cmd.get_wizard().set_mode(new_sequence[i]) cmd.get_wizard().do_select("C/%d/" % (i + 1)) cmd.get_wizard().apply() cmd.save("structures/mutated_intermediate/mutated_pmhc_complex.pdb") cmd.quit() # Release the lock when the program ends lock.release()
def do_select(self, name): if name != disp_sele: self.cmd.select(disp_sele, name + " or ?" + disp_sele, enable=1) dict = {'x': []} self.cmd.iterate(disp_sele + " and not ?" + click_sele, 'x.append( (model,segi,chain,resn,resi,name,alt) )', space=dict) if len(dict['x']): # toggled on entry = tuple(map(quote_blanks, dict['x'][0])) sele_str = "/%s/%s/%s/%s`%s/%s`%s" % entry self.cmd.select(click_sele, "?" + click_sele + " or " + sele_str, enable=0) self.click_list.append(sele_str) self.cmd.refresh_wizard() else: # toggled off new_list = [] for entry in self.click_list: if self.cmd.count_atoms(entry + " and " + disp_sele): new_list.append(entry) self.click_list = new_list self.cmd.select(click_sele, disp_sele, enable=0) cmd.refresh_wizard() self.cmd.delete(name) self.cmd.select(disp_sele, click_sele, enable=1)
def do_select(self, selection): n = self.cmd.select(self.selename, selection, 0) self.cmd.deselect() self.cmd.unpick() data = [] if n == 0: print(" Warning: empty selection") elif n > 1: print(" Warning: selection must contain exactly one atom") self.cmd.select(self.selename, 'none', 0) else: self.cmd.edit(self.sele) self.cmd.iterate(self.sele, 'data[:] = [label,' 'model, segi, chain, resn, resi, name, alt,' ']', space={'data': data}) if sys.version_info[0] < 3: data[0] = data[0].decode('utf-8', 'replace') self.label = data[0] self.cursor = len(self.label) self.identifiers = tuple(data[1:8]) cmd.refresh_wizard()
def set_dep(self,value): cmd=self.cmd if value!=self.dep: self.dep = value self.load_library() if src_sele in cmd.get_names("all"): self.do_library() cmd.refresh_wizard()
def do_select(self, name): # handle mouse selection callback if not sele_name in cmd.get_names('selections'): cmd.select(sele_name, 'none') cmd.enable(sele_name) cmd.refresh_wizard()
def delete_all(self): global dist_count dist_count = 0 cmd.delete(dist_prefix+"*") self.status=0 self.error = None self.clear() cmd.refresh_wizard()
def set_rep(self,rep): cmd=self.cmd if rep in self.reps: self.rep=rep cmd.hide("("+obj_name+")") cmd.show('lines',obj_name) # always show lines cmd.show(self.rep,obj_name) cmd.refresh_wizard()
def delete_all(self): global dist_count dist_count = 0 cmd.delete(dist_prefix + "*") self.status = 0 self.error = None self.clear() cmd.refresh_wizard()
def do_select(self,name): # handle mouse selection callback if not sele_name in cmd.get_names('selections'): cmd.select(sele_name,'none') cmd.enable(sele_name) cmd.refresh_wizard()
def do_select(self, name): # handle mouse selection callback # if not "sele" in cmd.get_names('selections'): # cmd.select("sele",'none') # cmd.enable("sele") cmd.refresh_wizard()
def _do_mutation(self): ''' After selection, propose what the fragment will look like where applied. Exception: _do_mutation should be wrapped in a try-exception block when called ''' cmd = self.cmd cmd.delete(FRAG_NAME) cmd.refresh_wizard() if any( cmd.count_atoms("(%s) & name %s" % (SRC_SELE, name)) != 1 for name in ("C1'", "C2'", "C3'", "C4'", "O4'")): self.clear() raise pymol.wizarding.WizardError( 'Improper selection of nucleic acid.') frag_type_lower = self._mode_labels[self.mode].lower() cmd.fragment(frag_type_lower, FRAG_NAME, origin=0) self._update_reps() cmd.color("white", "%s & elem C" % FRAG_NAME) cmd.iterate("first (%s)" % SRC_SELE, 'stored.name = model+"/"+segi+"/"+chain+"/"+resn+"`"+resi', space=self._space) self.res_text = self._space['stored'].name cmd.alter("?%s & name C1'" % SRC_SELE, "stored.identifiers = (segi, chain, resi, ss, color)", space=self._space) self._status = Status.MUTAGENIZING self.get_prompt() cmd.iterate("(%s & name C1')" % SRC_SELE, "stored.resn = resn", space=self._space) src_type_lower = self._space['stored'].resn.lower() self._src_O_atom_name, self._src_Cp_atom_name, self._src_N_atom_name, \ self._src_C_atom_name = self._get_chi_dihedral_atoms(src_type_lower) self._frag_O_atom_name, self._frag_Cp_atom_name, self._frag_N_atom_name, \ self._frag_C_atom_name = self._get_chi_dihedral_atoms(frag_type_lower) cmd.pair_fit("(%s & name %s)" % (FRAG_NAME, self._frag_O_atom_name), "(%s & name %s)" % (SRC_SELE, self._src_O_atom_name), "(%s & name %s)" % (FRAG_NAME, self._frag_Cp_atom_name), "(%s & name %s)" % (SRC_SELE, self._src_Cp_atom_name), "(%s & name %s)" % (FRAG_NAME, self._frag_N_atom_name), "(%s & name %s)" % (SRC_SELE, self._src_N_atom_name)) self._transfer_dihedral() for a in self._sugar_phos_atoms: cmd.remove("(%s & name %s)" % (FRAG_NAME, a)) if self._auto_center == "ON": cmd.center(FRAG_NAME, animate=1)
def mutate(selection, aa): aa = fix_aa(aa) cmd.set("retain_order", 0) cmd.wizard("mutagenesis") cmd.refresh_wizard() for single_res in iter_residues(selection): mutate_one(single_res, aa) cmd.set_wizard() cmd.sort()
def delete_last(self): global dist_count if self.status==0: if dist_count>0: cmd.delete(dist_prefix+"%02d"%dist_count) dist_count = dist_count - 1 self.status=0 self.error = None self.clear() cmd.refresh_wizard()
def clear(self): cmd.delete(sele_prefix+"*") cmd.delete(dist_prefix+"*") cmd.delete(indi_sele) lst = cmd.get_names('selections') self.n_pair = 0 self.status = 0 self.message = None cmd.unpick() cmd.refresh_wizard()
def delete_last(self): global dist_count if self.status == 0: if dist_count > 0: cmd.delete(dist_prefix + "%02d" % dist_count) dist_count = dist_count - 1 self.status = 0 self.error = None self.clear() cmd.refresh_wizard()
def clear(self): cmd.delete(sele_prefix + "*") cmd.delete(dist_prefix + "*") cmd.delete(indi_sele) lst = cmd.get_names('selections') self.n_pair = 0 self.status = 0 self.message = None cmd.unpick() cmd.refresh_wizard()
def residue_select(self, i): # Show selection message cmd.get_wizard().res_info = 'click search chain '+self.win.residue_list[i][1]+' num '+self.win.residue_list[i][2] cmd.get_wizard().status = 'residue selected' cmd.refresh_wizard() # Select residues cmd.select("curPos", "curPos or (chain " + self.win.residue_list[i][1] + " and resi " + self.win.residue_list[i][2] + ")") sys.stdout.flush()
def redraw(self): cmd.refresh_wizard() i, j = self.get_indices() sele = f'({self.sele}) and resi {i}-{j}' print(sele) cmd.color('green', self.sele) cmd.spectrum('b', 'blue_white_red', sele, minimum=self.low, maximum=self.high) cmd.zoom(sele, buffer=10, animate=-1)
def do_pick(self, bondFlag): global dist_count if bondFlag: self.error = "Error: please select an atom, not a bond." print(self.error) else: if self.mode == 'pairs': if self.status == 0: name = sele_prefix cmd.select(name, "(pk1)") self.status = 1 self.error = None elif self.status == 1: if ((self.object_mode == 'append') or (not dist_count)): dist_count = dist_count + 1 else: cmd.delete(dist_prefix + "%2d" % dist_count) name = dist_prefix + "%02d" % dist_count cmd.dist(name, sele_prefix, "(pk1)") cmd.delete(sele_prefix) cmd.unpick() cmd.enable(name) self.status = 0 elif self.mode in ['neigh', 'polar', 'heavy']: if ((self.object_mode == 'append') or (not dist_count)): dist_count = dist_count + 1 else: cmd.delete(dist_prefix + "%2d" % dist_count) name = dist_prefix + "%02d" % dist_count cnt = 0 if self.mode == 'neigh': cnt = cmd.select( sele_prefix, "(v. and (pk1 a; %f) and (not (nbr. pk1)) and (not (nbr. (nbr. pk1))) and (not (nbr. (nbr. (nbr. pk1)))))" % self.__class__.cutoff) elif self.mode == 'polar': cnt = cmd.select( sele_prefix, "(v. and (pk1 a; %f) and (e. n,o) and (not (nbr. pk1)) and (not (nbr. (nbr. pk1))) and (not (nbr. (nbr. (nbr. pk1)))))" % self.__class__.cutoff) elif self.mode == 'heavy': cnt = cmd.select( sele_prefix, "(v. and (pk1 a; %f) and (not h.) and (not (nbr. pk1)) and (not (nbr. (nbr. pk1))) and (not (nbr. (nbr. (nbr. pk1)))))" % self.__class__.cutoff) cmd.delete(name) if cnt: cmd.dist(name, "(pk1)", sele_prefix) else: print(" Wizard: No neighbors found.") cmd.delete(sele_prefix) cmd.unpick() cmd.enable(name) cmd.refresh_wizard()
def add_new_search(self, search_id): ''' add current search to search history after it finishes ''' # print 'add new search' self.win.searches.append(search_id) cmd.refresh_wizard() # Trip flag for window self.win.done_adding = True cmd.get_wizard().makeLogo = 1
def set_auto_center(self, auto_center): ''' Sets the flag for automatic centering upon prospective mutation :param auto_center: string flag ("ON" or "OFF") :rtype auto_center: string ''' cmd = self.cmd if auto_center not in self._auto_center_str: print("Improper Auto Center setting. 'ON' or 'OFF' accepted only") self._auto_center = auto_center cmd.refresh_wizard()
def add_new_graft(self, search_id): ''' add current search to search history after it finishes ''' # print 'add new search' self.grafts.append(graft_id) cmd.refresh_wizard() # Trip flag for window self.done_adding = True cmd.get_wizard().makeLogo = 7
def clear(self): cmd=self.cmd self.status=0 self.bump_scores = [] cmd.delete(tmp_obj2) cmd.delete(mut_sele) cmd.delete(src_sele) cmd.delete(obj_name) cmd.delete(bump_name) cmd.delete("_seeker_hilight") cmd.refresh_wizard()
def accept(self): # accept compound and advance if self.object is None: print(" Filter-Error: Please choose an object first") else: state = cmd.get_object_state(self.object) ident = self.get_ident(self.object,state) print(" Filter: Accepting '%s'"%ident) self.count(ident,accept_str) cmd.forward() cmd.refresh_wizard()
def accept(self): # accept compound and advance if self.object==None: print " Filter-Error: Please choose an object first" else: state = cmd.get_state() ident = self.get_ident(self.object,state) print " Filter: Accepting '%s'"%ident self.count(ident,accept_str) cmd.forward() cmd.refresh_wizard()
def defer(self): # defer compound and advance if self.object==None: print " Filter-Error: Please choose an object first" else: state = cmd.get_state() ident = self.get_ident(self.object,state) print " Filter: Deferring '%s'"%ident self.check_object_dict() self.count(ident,defer_str) cmd.forward() cmd.refresh_wizard()
def clear(self): ''' Clear selections and objects created by this wizard in PyMOL. Overrides method from Wizard class ''' cmd = self.cmd self._status = Status.NO_SELECTION self.mode = DEFAULT_MODE self.rep = DEFAULT_REP cmd.delete(FRAG_NAME) cmd.refresh_wizard()
def set_AtomType(self,type): if self.SelAtomName != '...': self.top.Vars.dictAtomTypes[self.ID][1] = type self.SelAtomName = '...' self.SelAtomType = '...' self.ColorByType() cmd.delete(self.AtomDisplay) cmd.refresh_wizard()
def remove_last(self): # build up the pair-wise list of selections cmd.delete(dist_prefix+"*") lst = self.get_sele_list() if len(lst): cmd.delete(lst.pop()) if len(lst): cmd.delete(lst.pop()) self.n_pair = self.n_pair - 1 self.update_dashes() self.status=0 cmd.refresh_wizard()
def clear(self): cmd = self.cmd pymol = cmd._pymol self.status = 0 cmd.delete(tmp_obj1) cmd.delete(tmp_obj2) cmd.delete(tmp_obj3) cmd.delete(mut_sele) cmd.delete(src_sele) cmd.delete(obj_name) cmd.delete(bump_name) cmd.delete("_seeker_hilight") cmd.refresh_wizard()
def set_rep(self, rep): ''' Sets the atom representation of the candidate fragment Overrides method from Wizard class :param rep: atom representation :rtype rep: string ''' cmd = self.cmd if self._status != Status.MUTAGENIZING: return if rep in self._reps: self.rep = rep self._update_reps() cmd.refresh_wizard()
def do_pick(self, picked_bond): self.reset() cmd.iterate("pk1", "setattr(cmd.get_wizard(),'pk1_st'," "'%s/%s/%s/%s/%s'%(model,segi,chain,resi,name))") if picked_bond: cmd.iterate("pk1", "setattr(cmd.get_wizard(),'pk2_st'," "'%s/%s/%s/%s/%s'%(model,segi,chain,resi,name))") else: # for single atom, also get 3D coordinates (EXAMPLE) cmd.iterate_state(cmd.get_state(), "pk1", "setattr(cmd.get_wizard(),'pk1_xyz',(x,y,z))") cmd.unpick() cmd.refresh_wizard()