def pretty_solv(selection="(all)", _self=cmd): cmd = _self s = tmp_sele cmd.select(s, selection) polar_contacts = _get_polar_contacts_name(s, _self) _prepare(s, polar_contacts, _self=cmd) cmd.dss(s, preserve=1) cmd.cartoon("auto", s) cmd.show("cartoon", s) cmd.show("sticks", "(" + lig_sele + " and (" + s + "))") cmd.show("nb_spheres", "((" + lig_sele + "|resn hoh+wat+h2o) and (" + s + "))") util.cbc("(" + lig_sele + " and (" + s + "))", _self=cmd) util.cbac("(" + lig_sele + " and (" + s + ") and not elem c)", _self=cmd) cmd.spectrum("count", selection="(elem c and (" + s + ") and not " + lig_sele + ")") cmd.set("cartoon_highlight_color", -1, selection) cmd.set("cartoon_fancy_helices", 0, selection) cmd.set("cartoon_smooth_loops", 0, selection) cmd.set("cartoon_flat_sheets", 1, selection) cmd.set("cartoon_side_chain_helper", 0, selection) if polar_contacts in cmd.get_names(): cmd.disable(polar_contacts) if cmd.count_atoms(s): cmd.zoom(s)
def simple(selection="(all)", _self=cmd): cmd = _self s = tmp_sele cmd.select(s, selection) _prepare(s, _self=cmd) util.cbc(s, _self=cmd) cmd.show("ribbon", s) cmd.show( "lines", "(byres ((" + s + " & r. CYS+CYX & n. SG) & bound_to (" + s + " & r. CYS+CYX & n. SG))) & n. CA+CB+SG") # try to show what covalent ligands are connected to... cmd.show("sticks", "(" + lig_sele + " and (" + s + ")) extend 2") cmd.show( "sticks", "byres ((" + lig_sele + " and (" + s + ") and not resn ACE+NAC+NME+NH2) extend 1)") cmd.hide("sticks", "(" + s + ") and ((not rep sticks) extend 1)") cmd.show("sticks", "(" + lig_sele + " and (" + s + ")) extend 2") # color by atom if lines or sticks are shown util.cnc("(( rep lines or rep sticks or (" + lig_and_solv_sele + ")) and (" + s + "))", _self=cmd) cmd.show("nonbonded", "(" + lig_and_solv_sele + " and (" + s + "))") cmd.show("lines", "(" + lig_and_solv_sele + " and (" + s + "))") if cmd.count_atoms(s): cmd.zoom(s) cmd.delete(s)
def toggle_zooms(mode=-1): global zooms if mode<0: zooms = not zooms else: zooms = mode if zooms: cmd.zoom(m4x_ligands,2) else: cmd.zoom("m4x_aligned")
def toggle_zooms(mode=-1): global zooms if mode < 0: zooms = not zooms else: zooms = mode if zooms: cmd.zoom(m4x_ligands, 2) else: cmd.zoom("m4x_aligned")
def pub_solv(selection="(all)",_self=cmd): cmd=_self pretty_solv(selection,_self) s = tmp_sele cmd.select(s,selection) cmd.set("cartoon_smooth_loops",1,selection) cmd.set("cartoon_highlight_color","grey50",selection) cmd.set("cartoon_fancy_helices",1,selection) cmd.set("cartoon_flat_sheets",1,selection) cmd.set("cartoon_side_chain_helper",0,selection) if cmd.count_atoms(s): cmd.zoom(s)
def pub_solv(selection="(all)", _self=cmd): cmd = _self pretty_solv(selection, _self) s = tmp_sele cmd.select(s, selection) cmd.set("cartoon_smooth_loops", 1, selection) cmd.set("cartoon_highlight_color", "grey50", selection) cmd.set("cartoon_fancy_helices", 1, selection) cmd.set("cartoon_flat_sheets", 1, selection) cmd.set("cartoon_side_chain_helper", 0, selection) if cmd.count_atoms(s): cmd.zoom(s)
def ligands(selection="(all)", _self=cmd): cmd = _self try: s = tmp_sele cmd.select(s, selection) polar_contacts = _get_polar_contacts_name(s, _self) _prepare(s, polar_contacts, _self=cmd) host = "_preset_host" solvent = "_preset_solvent" near_solvent = "_preset_solvent" lig = "_preset_lig" cmd.select(host, s + " and " + prot_and_dna_sele) cmd.select(solvent, s + " and " + solv_sele) cmd.select(lig, s + " and " + lig_sele) cmd.select(near_solvent, s + " and (" + solvent + " within 4 of " + lig + ")") util.chainbow(host, _self=cmd) util.cbc(lig, _self=cmd) util.cbac("((" + s + ") and not elem c)", _self=cmd) cmd.hide("everything", s) cmd.show("ribbon", host) cmd.show( "lines", "(" + s + " and byres (" + host + " within 5 of " + lig + "))") cmd.show("sticks", lig) cmd.show("sticks", solvent + " and neighbor " + lig) cmd.show("lines", "(" + s + " and (rep lines extend 1) and " + lig + ")") if cmd.count_atoms(lig): cmd.dist(polar_contacts, host + "|" + near_solvent, lig + "|" + near_solvent, mode=2, quiet=1, label=0, reset=1) # hbonds if polar_contacts in cmd.get_names(): cmd.enable(polar_contacts) cmd.hide("labels", polar_contacts) cmd.show("dashes", polar_contacts) else: cmd.delete(polar_contacts) cmd.show("nonbonded", lig + "|" + host + "|" + near_solvent) if cmd.count_atoms(lig): cmd.zoom(lig, 3) cmd.delete(host) cmd.delete(solvent) cmd.delete(near_solvent) cmd.delete(lig) except: traceback.print_exc()
def ligand_sites(selection="(all)",_self=cmd): cmd=_self try: s = tmp_sele cmd.select(s,selection) polar_contacts = _get_polar_contacts_name(s,_self) _prepare(s,polar_contacts,_self=cmd) host = "_preset_host" solvent = "_preset_solvent" near_solvent = "_preset_solvent" lig = "_preset_lig" cmd.select(host,s+" and "+prot_and_dna_sele) cmd.select(solvent,s+" and "+solv_sele) cmd.select(lig,s+" and "+lig_sele) cmd.select(near_solvent,s+" and ("+solvent+" within 4 of "+lig+")") cmd.flag("ignore",host,"clear") cmd.flag("ignore",lig+"|"+solvent,"set") util.chainbow(host,_self=cmd) util.cbc(lig,_self=cmd) util.cbac("(("+s+") and not elem c)",_self=cmd) cmd.hide("everything",s) cmd.show("ribbon",host) cmd.show("lines","("+s+" and byres ("+host+" within 5 of "+lig+"))") cmd.show("surface","("+s+" and ((rep lines expand 4) within 6 of "+lig+"))") cmd.set("two_sided_lighting",1) # global setting cmd.set("transparency",0,s) cmd.set("surface_quality",0,s) cmd.show("sticks",lig) cmd.show("sticks",solvent+" and neighbor "+lig) cmd.show("lines","("+s+" and (rep lines extend 1) and "+lig+")") if cmd.count_atoms(lig): cmd.dist(polar_contacts,host+"|"+near_solvent,lig+"|"+near_solvent,mode=2,quiet=1,label=0,reset=1) # hbonds if polar_contacts in cmd.get_names(): cmd.enable(polar_contacts) cmd.hide("labels",polar_contacts) cmd.show("dashes",polar_contacts) else: cmd.delete(polar_contacts) cmd.show("nb_spheres",lig+"|"+host+"|"+near_solvent) if cmd.count_atoms(lig): cmd.zoom(lig,3) cmd.delete(host) cmd.delete(solvent) cmd.delete(near_solvent) cmd.delete(lig) except: traceback.print_exc() cmd.delete(s)
def simple(selection="(all)",_self=cmd): cmd=_self s = tmp_sele cmd.select(s,selection) _prepare(s,_self=cmd) util.cbc(s,_self=cmd) cmd.show("ribbon",s) cmd.show("lines","(byres (("+s+" & r. CYS+CYX & n. SG) & bound_to ("+s+" & r. CYS+CYX & n. SG))) & n. CA+CB+SG") # try to show what covalent ligands are connected to... cmd.show("sticks","("+lig_sele+" and ("+s+")) extend 2") cmd.show("sticks","byres (("+lig_sele+" and ("+s+") and not resn ACE+NAC+NME+NH2) extend 1)") cmd.hide("sticks","("+s+") and ((not rep sticks) extend 1)") cmd.show("sticks","("+lig_sele+" and ("+s+")) extend 2") # color by atom if lines or sticks are shown util.cnc("(( rep lines or rep sticks or ("+lig_and_solv_sele+")) and ("+s+"))",_self=cmd) cmd.show("nonbonded","("+lig_and_solv_sele+" and ("+s+"))") cmd.show("lines","("+lig_and_solv_sele+" and ("+s+"))") if cmd.count_atoms(s): cmd.zoom(s) cmd.delete(s)
def pretty_solv(selection="(all)",_self=cmd): cmd=_self s = tmp_sele cmd.select(s,selection) polar_contacts = _get_polar_contacts_name(s,_self) _prepare(s,polar_contacts,_self=cmd) cmd.dss(s,preserve=1) cmd.cartoon("auto",s) cmd.show("cartoon",s) cmd.show("sticks","("+lig_sele+" and ("+s+"))") cmd.show("nb_spheres","(("+lig_sele+"|resn hoh+wat+h2o) and ("+s+"))") util.cbc("("+lig_sele+" and ("+s+"))",_self=cmd) util.cbac("("+lig_sele+" and ("+s+") and not elem c)",_self=cmd) cmd.spectrum("count",selection="(elem c and ("+s+") and not "+lig_sele+")") cmd.set("cartoon_highlight_color",-1,selection) cmd.set("cartoon_fancy_helices",0,selection) cmd.set("cartoon_smooth_loops",0,selection) cmd.set("cartoon_flat_sheets",1,selection) cmd.set("cartoon_side_chain_helper",0,selection) if polar_contacts in cmd.get_names(): cmd.disable(polar_contacts) if cmd.count_atoms(s): cmd.zoom(s)
def setup_contexts(context_info): # Author: Warren DeLano (list,dict) = context_info[0:2] key_list = [ 'F1','F2','F3','F4','F5','F6','F7','F8','F9','F10', #,'F11','F12', 'SHFT-F1','SHFT-F2','SHFT-F3','SHFT-F4','SHFT-F5','SHFT-F6','SHFT-F7', 'SHFT-F8','SHFT-F9','SHFT-F10']# ,'SHFT-F11','SHFT-F12'] doc_list = ["Keys"] zoom_context = 1 global labels labels = 1 if len(key_list): key = key_list.pop(0) cmd.set_key(key,toggle_labels) doc_list.append(key+": Toggle Dist") if len(key_list): key = key_list.pop(0) cmd.set_key(key,lambda :(cmd.zoom(),toggle_labels(0))) doc_list.append(key+": Zoom All") for a in list: water = a+"_water" ligand = a+"_ligand" site = a+"_site" hbond = a+"_hbond" name_list = dict[a] zoom_list = [] if water in name_list: cmd.show("nonbonded",water) util.cbac(water) zoom_list.append(water) if ligand in name_list: cmd.show("sticks",ligand) cmd.hide("cartoon",ligand) util.cbag(ligand) zoom_list.append(ligand) if site in name_list: cmd.show("sticks",site) util.cbac(site) zoom_list.append(site) # replace cartoon with explicit atoms for "site" atoms cmd.hide("cartoon",site) cmd.show("sticks","(byres (neighbor ("+site+" and name c))) and name n+ca") cmd.show("sticks","(byres (neighbor ("+site+" and name n))) and name c+ca+o") if len(zoom_list): if len(key_list): key = key_list.pop(0) zoom_str = string.join(zoom_list,' or ') if zoom_context == 1: zoom_context = zoom_str elif zoom_context not in (0,1): zoom_context = 0 cmd.set_key(key,lambda x=zoom_str:(cmd.zoom(x))) mo = re.search("_([^_]+)$",a) if mo: cont_name = mo.groups()[0] else: cont_name = a doc_list.append(key+": Zoom "+cont_name) if hbond in name_list: cmd.show("dashes",hbond) cmd.show("labels",hbond) cmd.wizard("fedora",doc_list) if zoom_context not in (0,1): cmd.zoom(zoom_context) toggle_labels(0) # cmd.feedback("enable","python","output") cmd.feedback("enable","objectmolecule","results") cmd.feedback("disable","selector","actions") cmd.feedback("disable","scene","actions") cmd.set("internal_feedback",1) cmd.set("internal_prompt",0)
def setup_contexts(context_info): # Author: Warren DeLano (list, dict) = context_info[0:2] key_list = [ 'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'F10', #,'F11','F12', 'SHFT-F1', 'SHFT-F2', 'SHFT-F3', 'SHFT-F4', 'SHFT-F5', 'SHFT-F6', 'SHFT-F7', 'SHFT-F8', 'SHFT-F9', 'SHFT-F10' ] # ,'SHFT-F11','SHFT-F12'] doc_list = ["Keys"] zoom_context = 1 global labels labels = 1 if len(key_list): key = key_list.pop(0) cmd.set_key(key, toggle_labels) doc_list.append(key + ": Toggle Dist") if len(key_list): key = key_list.pop(0) cmd.set_key(key, lambda: (cmd.zoom(), toggle_labels(0))) doc_list.append(key + ": Zoom All") for a in list: water = a + "_water" ligand = a + "_ligand" site = a + "_site" hbond = a + "_hbond" name_list = dict[a] zoom_list = [] if water in name_list: cmd.show("nonbonded", water) util.cbac(water) zoom_list.append(water) if ligand in name_list: cmd.show("sticks", ligand) cmd.hide("cartoon", ligand) util.cbag(ligand) zoom_list.append(ligand) if site in name_list: cmd.show("sticks", site) util.cbac(site) zoom_list.append(site) # replace cartoon with explicit atoms for "site" atoms cmd.hide("cartoon", site) cmd.show( "sticks", "(byres (neighbor (" + site + " and name c))) and name n+ca") cmd.show( "sticks", "(byres (neighbor (" + site + " and name n))) and name c+ca+o") if len(zoom_list): if len(key_list): key = key_list.pop(0) zoom_str = string.join(zoom_list, ' or ') if zoom_context == 1: zoom_context = zoom_str elif zoom_context not in (0, 1): zoom_context = 0 cmd.set_key(key, lambda x=zoom_str: (cmd.zoom(x))) mo = re.search("_([^_]+)$", a) if mo: cont_name = mo.groups()[0] else: cont_name = a doc_list.append(key + ": Zoom " + cont_name) if hbond in name_list: cmd.show("dashes", hbond) cmd.show("labels", hbond) cmd.wizard("fedora", doc_list) if zoom_context not in (0, 1): cmd.zoom(zoom_context) toggle_labels(0) # cmd.feedback("enable","python","output") cmd.feedback("enable", "objectmolecule", "results") cmd.feedback("disable", "selector", "actions") cmd.feedback("disable", "scene", "actions") cmd.set("internal_feedback", 1) cmd.set("internal_prompt", 0)