def frag(state=state, obj=obj): pwd, mutations, orig_sequence = setup(obj) #get_positions_in_selection(sub, distance) # Run over all sites where to mutate, optionally add and retain hydrogens. for site in mutations.keys(): variants = mutations[site] # Run over all variants. for variant in variants: cmd.load(obj) cmd.do('wizard mutagenesis') cmd.do('refresh_wizard') cmd.get_wizard().set_hyd("keep") cmd.get_wizard().set_mode(variant) #cmd.get_wizard().do_select(site + '/') # Get the number of available rotamers at that site. # Introduce a condition here to check if rotamers are requested. # <<OPTIONAL>> nRots = getRots(site, variant) #if nRots > 3: # nRots = 3 nRots=1 cmd.rewind() for i in range(1, nRots + 1): cmd.get_wizard().do_select("(" + site + "/)") cmd.frame(i) cmd.get_wizard().apply() # Optimize the mutated sidechain #<<OPTION>> #print "Sculpting." local_sculpt(obj, variant, site) # Protonation of the N. #cmd.do("select n%d, name n and %d/" % (int(site), int(site))) #cmd.edit("n%d" % int(site), None, None, None, pkresi=0, pkbond=0) #cmd.do("h_fill") # Protonation of the C. #cmd.do("select c%d, name c and %d/" % (int(site), int(site))) #cmd.edit("c%d" % int(site), None, None, None, pkresi=0, pkbond=0) #cmd.do("h_fill") # Definition of saveString #saveString = '%s/' % pwd #saveString += 'frag-' + get_one(orig_sequence[site]).lower() +\ # site + get_one(variant).lower() + '-%s.pdb, ' % state +\ # '((%s/))' % site save_string_rot = '%s/' % pwd save_string_rot += 'frag-' + get_one(orig_sequence[site]).lower() +\ site + get_one(variant).lower() + '-%02d-%s.pdb, ' % (i, state) +\ '((%s/))' % site #print saveString #cmd.do('save %s' % saveString.lower()) cmd.do('save %s' % save_string_rot.lower()) cmd.do('delete all') cmd.set_wizard('done')
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 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: # 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 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 cycle_deletions(dels_workspace, cursor=0, low=0, high=50): """ DESCRIPTION Launch a wizard that will show each proposed deletion in turn. USAGE cycle_delections dels_workspace [, cursor [, low [, high ]]] ARGUMENTS dels_workspace = a path to a workspace for the final step of the pipeline, which is to pick deletions. cursor = the deletion to start on {default: 0} low = the percentile of the data to make the most blue {default: 0}. high = the percentile of the data to make the most red {default: 50}. NOTES This script assumes that the only structure loaded in pymol is the one contained in the given workspace. """ wizard = CycleDeletions(dels_workspace, cursor, low, high) cmd.set_wizard(wizard)
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 SelectFlexibleSideChains(self): self.FlexSCRunning(True) self.top.ActiveWizard = FlexSideChain.flexSC(self,self.queue) cmd.set_wizard(self.top.ActiveWizard) cmd.refresh() self.top.ActiveWizard.Start()
def suns_search(app): ''' DESCRIPTION Suns search client. ''' wiz = Suns_search(app) cmd.set_wizard(wiz)
def Sphere_Clicked(self): self.SphereRunning(True) self.top.ActiveWizard = Sphere.Sphere(self, self.queue, self.Vars.BindingSite.Sphere, self.SphereDisplay, self.SphereSize, '') cmd.set_wizard(self.top.ActiveWizard) cmd.refresh() self.top.ActiveWizard.Start()
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 load_ligands(ligand_file): print(ligand_file) cmd.load(os.path.dirname(__file__) + '/' + ligand_file) cmd.show("sticks", "resn HIS") cmd.center() cmd.zoom() pymol_module = diswiz.Restraints_Wizard() cmd.set_wizard(pymol_module) return pymol_module
def master_search(app): """ MASTER search """ # create a folder for storing temporary data if not os.path.exists('cache/'): os.makedirs('cache/') wiz = MasterSearch(app) cmd.set_wizard(wiz)
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 testDirtyDelete(self): cmd.pseudoatom('m1') cmd.pseudoatom('m2') cmd.group('g1', 'm1 m2') cmd.set_wizard(MockWizard()) cmd.draw() v = cmd.get_object_list('(g1)') self.assertEqual(v, ['m1', 'm2'])
def mutate(protein, resi, mode='ALA', chain='A'): cmd.wizard('mutagenesis') cmd.do("refresh_wizard") cmd.get_wizard().set_mode(mode.upper()) selection = f'/{protein}//{chain}/{resi}' cmd.get_wizard().do_select(selection) cmd.frame(str(1)) cmd.get_wizard().apply() cmd.set_wizard('done') cmd.refresh()
def mutate(molecule, chain, resi, target="CYS", mutframe="1"): target = target.upper() cmd.wizard("mutagenesis") cmd.do("refresh_wizard") cmd.get_wizard().set_mode("%s" % target) selection = "/%s//%s/%s" % (molecule, chain, resi) cmd.get_wizard().do_select(selection) cmd.frame(str(mutframe)) cmd.get_wizard().apply() # cmd.set_wizard("done") cmd.set_wizard()
def cleanup(self): """ Remove any changes this wizard made to the user's session. """ cmd.delete('wt_env') cmd.delete('mut_env') cmd.delete('wt_hbonds') cmd.delete('mut_hbonds') cmd.set_view(self.original_view) cmd.set_wizard()
def mutate(molecule,chain,resi,target="CYS",mutframe="1"): target = target.upper() cmd.wizard("mutagenesis") cmd.do("refresh_wizard") cmd.get_wizard().set_mode("%s"%target) selection="/%s//%s/%s"%(molecule,chain,resi) cmd.get_wizard().do_select(selection) cmd.frame(str(mutframe)) cmd.get_wizard().apply() #cmd.set_wizard("done") cmd.set_wizard()
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 run_plugin_gui(): """ This function fires up the plugin gui in pymol. """ from pymol import cmd # include python path package_path = os.path.dirname(__main__.__file__) sys.path.append(package_path) # cmd import restraintmaker.interface_Pymol.RestraintMaker_Pymol as restMPym cmd.set_wizard(restMPym.Restraints_Wizard())
def mutXYZposition(residues): cmd.hide("everything") cmd.show("sticks") for resi in residues: for caa in residues[resi]: print(resi, caa) filename = "residue" + str(resi) + "to" + caa + ".csv" outfile = open(filename, "w") row = ("rotamer" + "," + "X" + "," + "Y" + "," + "Z" + "\n") cmd.wizard("mutagenesis") cmd.do("refresh_wizard") cmd.get_wizard().set_mode(caa) sel = "/test//A/" + str(resi) cmd.get_wizard().do_select(sel) fram = cmd.count_states("mutation") stored.pos = [] cmd.iterate_state(0, 'mutation', 'stored.pos.append((x,y,z))', atomic=0) counter = 1 state = 1 natom = int(len(stored.pos) / fram) for po in stored.pos: if counter < natom: row = (str(state) + "," + str(po[0]) + "," + str(po[1]) + "," + str(po[2]) + "\n") outfile.write(row) counter += 1 elif counter == natom: row = (str(state) + "," + str(po[0]) + "," + str(po[1]) + "," + str(po[2]) + "\n") outfile.write(row) counter = 1 state += 1 outfile.close() cmd.frame(fram) cmd.get_wizard().apply() cmd.set_wizard("done") cmd.save("residue" + str(resi) + "to" + caa + "rotamer" + str(fram) + ".pdb") for f in range(1, fram): fra = fram - f cmd.wizard("mutagenesis") cmd.do("refresh_wizard") cmd.get_wizard().do_select(sel) cmd.frame(fra) cmd.get_wizard().apply() cmd.set_wizard("done") cmd.save("residue" + str(resi) + "to" + caa + "rotamer" + str(fra) + ".pdb")
def doFinish(self): r_aA = cmd.get_distance(atom1="pw2", atom2="pw3", state=0) cmd.distance(self.params_str[0], "pw2", "pw3") th_a = cmd.get_angle(atom1="pw1", atom2="pw2", atom3="pw3", state=0) cmd.angle(self.params_str[1], "pw1", "pw2", "pw3") th_A = cmd.get_angle(atom1="pw2", atom2="pw3", atom3="pw4", state=0) cmd.angle(self.params_str[2], "pw2", "pw3", "pw4") if not (r_aA and th_a and th_A): showerror(self.parent, "Error!", "Maybe you made a mistake when choosing atoms!") self.reset() phi_ba = cmd.get_dihedral(atom1="pw0", atom2="pw1", atom3="pw2", atom4="pw3", state=0) cmd.dihedral(self.params_str[3], "pw0", "pw1", "pw2", "pw3") phi_aA = cmd.get_dihedral(atom1="pw1", atom2="pw2", atom3="pw3", atom4="pw4", state=0) cmd.dihedral(self.params_str[4], "pw1", "pw2", "pw3", "pw4") phi_AB = cmd.get_dihedral(atom1="pw2", atom2="pw3", atom3="pw4", atom4="pw5", state=0) cmd.dihedral(self.params_str[5], "pw2", "pw3", "pw4", "pw5") index_c = cmd.id_atom("pw0") index_c_name = getAtomString('pw0') index_b = cmd.id_atom("pw1") index_b_name = getAtomString('pw1') index_a = cmd.id_atom("pw2") index_a_name = getAtomString('pw2') index_A = cmd.id_atom("pw3") index_A_name = getAtomString('pw3') index_B = cmd.id_atom("pw4") index_B_name = getAtomString('pw4') index_C = cmd.id_atom("pw5") index_C_name = getAtomString('pw5') self.setBondForceParam(r_aA, th_a, th_A, phi_ba, phi_aA, phi_AB, index_c, index_b, index_a, index_A, index_B, index_C) self.setAtomsDef(index_c_name, index_b_name, index_a_name, index_A_name, index_B_name, index_C_name) top = Toplevel( self.parent) # <- freeze when open gro file in pymol 1.X Output(top, self.bondForceParams, self.atoms_def) cmd.set_wizard()
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_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 run_plugin_gui(): """ .. autofunction:: run_plugin_gui This function allows to run the plugin gui in pymol. :return: """ from pymol import cmd # include python path package_path = os.path.dirname(__main__.__file__) sys.path.append(package_path) # cmd import restraintmaker.interface_Pymol.RestraintMaker_PyMOL as restMPym cmd.set_wizard(restMPym.Restraints_Wizard())
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_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 do_key(self, k, x, y, mod): pre, post = self.label[:self.cursor], self.label[self.cursor:] c = '' if k == 127: # delete post = post[1:] elif k == 8: # backspace if self.cursor > 0: pre = pre[:-1] self.cursor -= 1 elif k == 27: # esc cmd.set_wizard() return True elif k in (10, 13): if not mod: cmd.set_wizard() return True # SHIFT+Return c = "\n" elif k < 32: return False elif k > 126: c = eval(r"u'\x%2x'" % (k)) else: c = chr(k) if c: pre += c self.cursor += len(c) self.label = pre + post if sys.version_info[0] < 3: new_label = self.label.encode("utf-8", "replace") else: new_label = self.label self.cmd.alter(self.sele, 'label = new_label', space=locals()) self.cmd.show('label', self.sele) cmd.refresh_wizard() return True
def master_search(app): """ MASTER search """ # create a folder for storing temporary data if not os.path.exists(MAIN_CACHE): os.makedirs(MAIN_CACHE) if not os.path.exists(SEARCH_CACHE): os.makedirs(SEARCH_CACHE) if not os.path.exists(LOGO_CACHE): os.makedirs(LOGO_CACHE) wiz = MasterSearch(app) cmd.set_wizard(wiz)
def mutate_to_cys(pdb, resnum_i): selection_i = "resi " + str(resnum_i) cmd.wizard("mutagenesis") cmd.get_wizard().set_mode("CYS") cmd.do("refresh_wizard") cmd.get_wizard().do_select(selection_i) cmd.get_wizard().do_select(selection_i) for frame_i in [1, 2, 3]: cmd.frame(frame_i) cmd.create("rotamer_" + str(resnum_i) + "_" + str(frame_i), "mutation", frame_i, 1) rotamer_i_pymol_prefix = "/" + "rotamer_" + str(resnum_i) + "_" + str(frame_i) + "///" + resnum_i + "/" cmd.set_wizard("done")
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 pymol_mutate(file_name, chain, res_index, number, mutant): pymol.finish_launching() cmd.delete(file_name[:-4]) selection = chain + '/' + res_index + '/' cmd.wizard("mutagenesis") pdb = file_name[:-4] cmd.load(file_name) 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])
def check_disulphide(pdb, resnum_i, resnum_j, f): selection_i = "resi " + str(resnum_i) selection_j = "resi " + str(resnum_j) # cmd.wizard("mutagenesis") # cmd.get_wizard().set_mode("CYS") cmd.do("refresh_wizard") # Select the rotamer for frame_i in [1, 2, 3]: # cmd.do("refresh_wizard") cmd.get_wizard().do_select(selection_i) cmd.frame(frame_i) cmd.create("rotamer_i_" + str(frame_i), "mutation", frame_i, 1) rotamer_i_pymol_prefix = "/" + "rotamer_i_" + str(frame_i) + "///" + resnum_i + "/" for frame_j in [1, 2, 3]: # cmd.do("refresh_wizard") cmd.get_wizard().do_select(selection_j) cmd.frame(frame_j) cmd.create("rotamer_j_" + str(frame_j), "mutation", frame_j, 1) rotamer_j_pymol_prefix = "/" + "rotamer_j_" + str(frame_j) + "///" + resnum_j + "/" # s_gamma_distance = cmd.get_distance(rotamer_i_pymol_prefix + "SG", rotamer_j_pymol_prefix + "SG") # print s_gamma_distance cmd.set_wizard("clear") for frame_i in [1, 2, 3]: rotamer_i_pymol_prefix = "/" + "rotamer_i_" + str(frame_i) + "///" + resnum_i + "/" for frame_j in [1, 2, 3]: rotamer_j_pymol_prefix = "/" + "rotamer_j_" + str(frame_j) + "///" + resnum_j + "/" s_gamma_distance = cmd.get_distance(rotamer_i_pymol_prefix + "SG", rotamer_j_pymol_prefix + "SG") print s_gamma_distance
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 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() 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 = self.new_name.strip() 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_wizard() return 1
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() 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_wizard() return 1
def pymol_mutate(file_name, chain, res_index, number): pymol.finish_launching() cmd.delete(file_name[:-4]) selection = chain + '/' + res_index + '/' mutant = 'CYS' cmd.wizard("mutagenesis") pdb = file_name[:-4] cmd.load(file_name) 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])
def thread_onto_backbone(backbone_object, backbone_selection, aaString): # # # # create a new temporary dictionary stored.tmp_res_dict = {} # store residue indices(=key) and chain(=value) cmd.iterate(backbone_selection, "stored.tmp_res_dict[resi] = chain") # create a sorted list of all indices as integers sorted_keys_list = [] for index_string in stored.tmp_res_dict.keys(): sorted_keys_list.append(int(index_string)) sorted_keys_list.sort() # set up the mutagenesis wizard cmd.wizard("mutagenesis") cmd.refresh_wizard() count = 0 for residue_index in range(sorted_keys_list[0], sorted_keys_list[0] + len(sorted_keys_list) ): # get a selection string representation of our current residue # e.g. /HPG-3//A/12 index_string = "%d" %(residue_index) selection_str = "/" + backbone_object + "//"+ stored.tmp_res_dict[index_string] + "/%d/" %(residue_index) # perform the desired mutagenesis cmd.get_wizard().do_select(selection_str) cmd.get_wizard().set_mode(aaName(aaString[count])) cmd.get_wizard().apply() count = count + 1 # close up the mutagenesis wizard cmd.set_wizard()
def frag(state=state, obj=obj3): pwd, orig_sequence = setup(obj) stored.rotamerDict = {} # Add and retain hydrogens cmd.get_wizard().set_hyd("keep") # Run over all sites where to mutate for site in mutations.keys(): variants = mutations[site] # Run over all variants. for variant in variants: cmd.load(obj) cmd.do('wizard mutagenesis') cmd.do('refresh_wizard') cmd.get_wizard().do_select("(%s/)" % site) cmd.do("cmd.get_wizard().set_mode('%s')"%variant) # Get the number of available rotamers at that site # Introduce a condition here to check if # rotamers are requested. # <<OPTION>> print variant, "variant" nRots = getRots(site, variant) nRots = 2 stored.rotamerDict[str(site)+getOne(variant)] = nRots cmd.rewind() for i in range(1, nRots + 1): cmd.get_wizard().do_select("(" + site + "/)") cmd.frame(i) cmd.get_wizard().apply() # Optimize the mutated sidechain #<<OPTION>> print "Sculpting." localSculpt(obj, site) # Protonation of the N. cmd.do("select n%d, name n and %d/" % (int(site), int(site))) cmd.edit("n%d" % int(site), None, None, None, pkresi=0, pkbond=0) cmd.do("h_fill") # Protonation of the C. cmd.do("select c%d, name c and %d/" % (int(site), int(site))) cmd.edit("c%d" % int(site), None, None, None, pkresi=0, pkbond=0) cmd.do("h_fill") # Definition of saveString saveString = '%s/' % pwd saveString += 'frag-' + getOne(orig_sequence[site]).lower() +\ site + getOne(variant).lower() + '-rot%i-%s.pdb, ' \ % (i,state) +'((%s/))' % site #print saveString cmd.do('save %s' % saveString) cmd.do('delete all') cmd.set_wizard('done') print "Frag is all done"
cmd.select(disp_sele,"none",enable=1) self.cmd.refresh_wizard() def print_list(self): cnt = 1 print("Atoms Clicked (in order):") for entry in self.click_list: print("Atom %d: %s"%(cnt,entry)) cnt = cnt + 1 def cleanup(self): self.cmd.delete(disp_sele) self.cmd.delete(click_sele) # load an example structure cmd.load("$TUT/1hpv.pdb") # color by chain (aesthetics) util.cbc() # put the mouse into single-atom selection mode cmd.set('mouse_selection_mode',0) # activate the wizard cmd.set_wizard(Clicker())
def frag(state=state, obj=obj): pwd, mutations, orig_sequence = setup(obj) # Add and retain hydrogens cmd.get_wizard().set_hyd("keep") # Run over all sites where to mutate for site in mutations.keys(): variants = mutations[site] # Run over all variants. for variant in variants: cmd.load(obj) cmd.do("wizard mutagenesis") cmd.do("refresh_wizard") cmd.get_wizard().set_mode(variant) cmd.get_wizard().do_select(site + "/") # Get the number of available rotamers at that site # Introduce a condition here to check if # rotamers are requested. # <<OPTION>> # nRots = getRots(site, variant) # if nRots > 3: # nRots = 3 nRots = 1 cmd.rewind() for i in range(1, nRots + 1): cmd.get_wizard().do_select("(" + site + "/)") cmd.frame(i) cmd.get_wizard().apply() # Optimize the mutated sidechain # <<OPTION>> # print "Sculpting." # localSculpt(obj, site) # Protonation of the N. cmd.do("select n%d, name n and %d/" % (int(site), int(site))) cmd.edit("n%d" % int(site), None, None, None, pkresi=0, pkbond=0) cmd.do("h_fill") # Protonation of the C. cmd.do("select c%d, name c and %d/" % (int(site), int(site))) cmd.edit("c%d" % int(site), None, None, None, pkresi=0, pkbond=0) cmd.do("h_fill") # Definition of saveString # saveString = '%s/' % pwd # saveString += 'frag-' + getOne(orig_sequence[site]).lower() +\ # site + getOne(variant).lower() + '-%s.pdb, ' % state +\ # '((%s/))' % site saveStringRot = "%s/" % pwd saveStringRot += ( "frag-" + getOne(orig_sequence[site]).lower() + site + getOne(variant).lower() + "-%02d-%s.pdb, " % (i, state) + "((%s/))" % site ) # print saveString # cmd.do('save %s' % saveString.lower()) cmd.do("save %s" % saveStringRot.lower()) cmd.do("delete all") cmd.set_wizard("done")
cmd.load("$TUT/1hpv.pdb") # color by chain (aesthetics) util.cbc() # store the links as atom text_types cmd.alter("name ca",r"custom='http://delsci.info/cgi-bin/click.cgi?residue=%s%s%s'%(resn,resi,chain)") # put the mouse into single-atom selection mode cmd.set('mouse_selection_mode',0) # just show ribbon (means we can only select labelled C-alphas) cmd.show_as("cartoon") # set up the labels cmd.label("name ca","'Link'") # color the labels white cmd.set("label_color", 'white') # activate the wizard cmd.set_wizard(Clickurl())
# cmd.show("sticks","sculpt") cmd.show("spheres","sculpt") # cmd.set("sphere_transparency","0.75","sculpt") # cmd.set("sphere_color","grey","sculpt") cmd.frame(1) cmd.set("auto_sculpt",1) cmd.set("sculpting",1) cmd.sculpt_activate("sculpt") cmd.set("sculpting_cycles","100") cmd.do("edit_mode") cmd.set("valence","0.05") cmd.set("suspend_updates",0,quiet=0) cmd.sculpt_iterate("sculpt") cmd.alter_state(1,"sculpt","x=x*1.5;y=y*0.1;z=z*1.5") cmd.zoom() cmd.unpick() else: cmd.set("valence","0") cmd.set("sculpting",0) cmd.set("auto_sculpt",0) cmd.delete("sculpt") cmd.mouse() if __name__=='pymol': pymol.wizard.stereodemo = Stereodemo() cmd.set_wizard(pymol.wizard.stereodemo) cmd.stereo("on") cmd.set("max_threads",4)
self.pickNextAtom(atom_name) point1 = cmd.get_atom_coords("(%s%s)" % (self.object_prefix, "0")) point2 = cmd.get_atom_coords("(%s%s)" % (self.object_prefix, "1")) point3 = cmd.get_atom_coords("(%s%s)" % (self.object_prefix, "2")) plane = planeFromPoints(point1, point2, point3, self.facetSize) planeName = "plane-%02d" % self.object_count self.object_count += 1 makePrimitive(plane, planeName) cmd.show("cgo", "plane*") self.pick_count = 0 self.reset() def get_panel(self): return [ [ 1, 'Plane Wizard',''], [ 2, 'Reset','cmd.get_wizard().reset()'], [ 2, 'Delete All Planes' , 'cmd.get_wizard().delete_all()'], [ 2, 'Done','cmd.set_wizard()'], ] # create an instance wiz = PlaneWizard() # make this the active wizard cmd.set_wizard(wiz)