Esempio n. 1
0
def publication(selection="(all)",_self=cmd):
    cmd=_self
    pub_solv(selection,_self)
    s = tmp_sele
    cmd.select(s,selection)
    cmd.hide("nb_spheres","(("+lig_sele+"|resn hoh+wat+h2o) and "+s+")")
    cmd.delete(s)
Esempio n. 2
0
def simple_no_solv(selection="(all)",_self=cmd):
    cmd=_self
    simple(selection,_self=_self)
    s = tmp_sele
    cmd.select(s,selection)
    cmd.hide("nonbonded","("+solv_sele+" and "+s+")")
    cmd.delete(s)
Esempio n. 3
0
def pretty(selection,_self=cmd):
    cmd=_self
    pretty_solv(selection,_self)
    s = tmp_sele
    cmd.select(s,selection)
    cmd.hide("nb_spheres","("+s+" and "+lig_sele+"|resn hoh+wat+h2o)")
    cmd.delete(s)
Esempio n. 4
0
def _prepare(selection,polar_contacts=None,_self=cmd):
    cmd=_self
    # this function should undo everything that is done by any preset function in this module
    # (except for coloring)
    s = tmp_sele
    cmd.select(s,selection)

    cmd.cartoon("auto",s)   
    cmd.hide("everything",s)
    
    cmd.set("two_sided_lighting",0) # global
    cmd.unset("transparency",s)
    cmd.unset("dot_normals",s)
    cmd.unset("mesh_normals",s)
    cmd.unset("surface_quality",s)
    cmd.unset("surface_type",selection)
    cmd.unset("sphere_scale",selection)
    cmd.unset_bond("stick_radius",s,s)
    cmd.unset_bond("stick_color",s,s)
    cmd.unset("cartoon_highlight_color",selection)
    cmd.unset("cartoon_fancy_helices",selection)
    cmd.unset("cartoon_smooth_loops",selection)
    cmd.unset("cartoon_flat_sheets",selection)
    cmd.unset("cartoon_side_chain_helper",selection)   
    cmd.unset("mesh_normals",s)
    cmd.unset("dot_normals",s)
    if polar_contacts == None:
        polar_contacts = _get_polar_contacts_name(s,_self)
        if polar_contacts in cmd.get_names('objects'):
            cmd.delete(polar_contacts)
Esempio n. 5
0
def publication(selection="(all)", _self=cmd):
    cmd = _self
    pub_solv(selection, _self)
    s = tmp_sele
    cmd.select(s, selection)
    cmd.hide("nb_spheres",
             "((" + lig_sele + "|resn hoh+wat+h2o) and " + s + ")")
Esempio n. 6
0
def _prepare(selection, polar_contacts=None, _self=cmd):
    cmd = _self
    # this function should undo everything that is done by any preset function in this module
    # (except for coloring)
    s = tmp_sele
    cmd.select(s, selection)

    cmd.cartoon("auto", s)
    cmd.hide("everything", s)

    cmd.set("two_sided_lighting", 0)  # global
    cmd.unset("transparency", s)
    cmd.unset("dot_normals", s)
    cmd.unset("mesh_normals", s)
    cmd.unset("surface_quality", s)
    cmd.unset("surface_type", selection)
    cmd.unset("sphere_scale", selection)
    cmd.unset_bond("stick_radius", s, s)
    cmd.unset_bond("stick_color", s, s)
    cmd.unset("cartoon_highlight_color", selection)
    cmd.unset("cartoon_fancy_helices", selection)
    cmd.unset("cartoon_smooth_loops", selection)
    cmd.unset("cartoon_flat_sheets", selection)
    cmd.unset("cartoon_side_chain_helper", selection)
    cmd.unset("mesh_normals", s)
    cmd.unset("dot_normals", s)
    if polar_contacts == None:
        polar_contacts = _get_polar_contacts_name(s, _self)
        if polar_contacts in cmd.get_names('objects'):
            cmd.delete(polar_contacts)
Esempio n. 7
0
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)
Esempio n. 8
0
def ligand_cartoon(selection="(all)",_self=cmd):
    cmd=_self
    ligand_sites(selection,_self)
    s = tmp_sele
    cmd.select(s,selection)
    cmd.set("cartoon_side_chain_helper",1,selection)
    cmd.show("cartoon","rep ribbon")
    cmd.hide("ribbon")
    cmd.hide("surface")
Esempio n. 9
0
def ligand_cartoon(selection="(all)", _self=cmd):
    cmd = _self
    ligand_sites(selection, _self)
    s = tmp_sele
    cmd.select(s, selection)
    cmd.set("cartoon_side_chain_helper", 1, selection)
    cmd.show("cartoon", "rep ribbon")
    cmd.hide("ribbon")
    cmd.hide("surface")
Esempio n. 10
0
File: m4x.py Progetto: Almad/pymol
def toggle_dashes(mode=-1):
    global dashes
    if mode<0:
        dashes = not dashes
    else:
        dashes = mode
    if dashes:
        cmd.show("dashes")
    else:
        cmd.hide("dashes")
Esempio n. 11
0
File: m4x.py Progetto: Almad/pymol
def toggle_waters(mode=-1):
    global waters
    if mode<0:
        waters = not waters
    else:
        waters = mode
    if waters:
        cmd.show("nonbonded",m4x_waters)
    else:
        cmd.hide("nonbonded",m4x_waters)
Esempio n. 12
0
File: m4x.py Progetto: Almad/pymol
def toggle_sites(mode=-1):
    global sites
    if mode<0:
        sites = not sites
    else:
        sites = mode
    if sites:
        cmd.show("lines",m4x_sites)
    else:
        cmd.hide("lines",m4x_sites)
Esempio n. 13
0
File: m4x.py Progetto: Almad/pymol
def toggle_ligands(mode=-1):
    global ligands
    if mode<0:
        ligands = not ligands
    else:
        ligands = mode
    if ligands:
        cmd.show("sticks",m4x_ligands)
    else:
        cmd.hide("sticks",m4x_ligands)
Esempio n. 14
0
File: m4x.py Progetto: Almad/pymol
def toggle_cgos(mode=-1):
    global cgos
    if mode<0:
        cgos = not cgos
    else:
        cgos = mode
    if cgos:
        cmd.show("cgo")
    else:
        cmd.hide("cgo")
Esempio n. 15
0
def ligand_sites_dots(selection="(all)", _self=cmd):
    cmd = _self
    ligand_sites(selection, _self)
    s = tmp_sele
    cmd.select(s, selection)
    cmd.show("sticks", s + " and rep lines")
    cmd.hide("lines", s + " and rep lines")
    cmd.set("surface_type", "1", selection)
    cmd.set("surface_quality", "1", selection)
    cmd.set("dot_normals", 0, s)
Esempio n. 16
0
def toggle_cgos(mode=-1):
    global cgos
    if mode < 0:
        cgos = not cgos
    else:
        cgos = mode
    if cgos:
        cmd.show("cgo")
    else:
        cmd.hide("cgo")
Esempio n. 17
0
def toggle_dashes(mode=-1):
    global dashes
    if mode < 0:
        dashes = not dashes
    else:
        dashes = mode
    if dashes:
        cmd.show("dashes")
    else:
        cmd.hide("dashes")
Esempio n. 18
0
def toggle_waters(mode=-1):
    global waters
    if mode < 0:
        waters = not waters
    else:
        waters = mode
    if waters:
        cmd.show("nonbonded", m4x_waters)
    else:
        cmd.hide("nonbonded", m4x_waters)
Esempio n. 19
0
def toggle_sites(mode=-1):
    global sites
    if mode < 0:
        sites = not sites
    else:
        sites = mode
    if sites:
        cmd.show("lines", m4x_sites)
    else:
        cmd.hide("lines", m4x_sites)
Esempio n. 20
0
def toggle_ligands(mode=-1):
    global ligands
    if mode < 0:
        ligands = not ligands
    else:
        ligands = mode
    if ligands:
        cmd.show("sticks", m4x_ligands)
    else:
        cmd.hide("sticks", m4x_ligands)
Esempio n. 21
0
def ligand_sites_trans_hq(selection="(all)",_self=cmd):
    cmd=_self
    ligand_sites(selection,_self)
    s = tmp_sele
    cmd.select(s,selection)
    cmd.show("sticks",s+" and rep lines")
    cmd.hide("lines",s+" and rep lines")
    cmd.set("transparency","0.33",s)
    cmd.set("surface_type",0,selection)
    cmd.set("surface_quality",1,selection)
Esempio n. 22
0
def toggle_labels(mode=-1):
    global labels
    if mode < 0:
        labels = not labels
    else:
        labels = mode
    if labels:
        cmd.show("labels")
    else:
        cmd.hide("labels")
Esempio n. 23
0
def ligand_sites_dots(selection="(all)",_self=cmd):
    cmd=_self
    ligand_sites(selection,_self)
    s = tmp_sele
    cmd.select(s,selection)
    cmd.show("sticks",s+" and rep lines")
    cmd.hide("lines",s+" and rep lines")
    cmd.set("surface_type","1",selection)
    cmd.set("surface_quality","1",selection)
    cmd.set("dot_normals",0,s)
Esempio n. 24
0
File: m4x.py Progetto: Almad/pymol
def toggle_labels(mode=-1):
    global labels
    if mode<0:
        labels = not labels
    else:
        labels = mode
    if labels:
        cmd.show("labels")
    else:
        cmd.hide("labels")
Esempio n. 25
0
def ligand_sites_trans_hq(selection="(all)", _self=cmd):
    cmd = _self
    ligand_sites(selection, _self)
    s = tmp_sele
    cmd.select(s, selection)
    cmd.show("sticks", s + " and rep lines")
    cmd.hide("lines", s + " and rep lines")
    cmd.set("transparency", "0.33", s)
    cmd.set("surface_type", 0, selection)
    cmd.set("surface_quality", 1, selection)
Esempio n. 26
0
def ligand_sites_mesh(selection="(all)",_self=cmd):
    cmd=_self
    ligand_sites(selection,_self)
    s = tmp_sele
    cmd.select(s,selection)
    cmd.show("sticks",s+" and rep lines")
    cmd.hide("lines",s+" and rep lines")
    cmd.set("surface_type","2",selection)
    cmd.set("surface_quality","0",selection)
    cmd.set("mesh_normals",0,s)
    cmd.delete(s)
Esempio n. 27
0
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()
Esempio n. 28
0
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)
Esempio n. 29
0
File: util.py Progetto: Almad/pymol
def protein_vacuum_esp(selection, mode=2, border=10.0, quiet = 1, _self=cmd):
    pymol=_self._pymol
    cmd=_self

    if ((string.split(selection)!=[selection]) or
         selection not in cmd.get_names('objects')):
        print " Error: must provide an object name"
        raise cmd.QuietException
    obj_name = selection + "_e_chg"
    map_name = selection + "_e_map"
    pot_name = selection + "_e_pot"
    cmd.disable(selection)
    cmd.delete(obj_name)
    cmd.delete(map_name)
    cmd.delete(pot_name)
    cmd.create(obj_name,"((polymer and ("+selection+
               ") and (not resn A+C+T+G+U)) or ((bymol (polymer and ("+
               selection+"))) and resn NME+NHE+ACE)) and (not hydro)")
         # try to just get protein...

    protein_assign_charges_and_radii(obj_name,_self=_self)
        
    ext = cmd.get_extent(obj_name)
    max_length = max(abs(ext[0][0] - ext[1][0]),abs(ext[0][1] - ext[1][1]),abs(ext[0][2]-ext[1][2])) + 2*border

    # compute an grid with a maximum dimension of 50, with 10 A borders around molecule, and a 1.0 A minimum grid

    sep = max_length/50.0
    if sep<1.0: sep = 1.0
    print " Util: Calculating electrostatic potential..."
    if mode==0: # absolute, no cutoff
        cmd.map_new(map_name,"coulomb",sep,obj_name,border)
    elif mode==1: # neutral, no cutoff
        cmd.map_new(map_name,"coulomb_neutral",sep,obj_name,border)
    else: # local, with cutoff
        cmd.map_new(map_name,"coulomb_local",sep,obj_name,border)      
        
    cmd.ramp_new(pot_name, map_name, selection=obj_name,zero=1)
    cmd.hide("everything",obj_name)
    cmd.show("surface",obj_name)
    cmd.set("surface_color",pot_name,obj_name)
    cmd.set("surface_ramp_above_mode",1,obj_name)
Esempio n. 30
0
def ball_and_stick(selection="(all)", mode=1, _self=cmd):
    cmd = _self
    s = tmp_sele
    cmd.select(s, selection)
    _prepare(s, _self=cmd)
    if mode == 1:
        cmd.hide("everything", s)
        cmd.set_bond("stick_color", "white", s, s)
        cmd.set_bond("stick_radius", "0.14", s, s)
        cmd.set("sphere_scale", "0.25", s)
        cmd.show("sticks", s)
        cmd.show("spheres", s)
    elif mode == 2:
        cmd.hide("everything", s)
        cmd.set_bond("stick_color", "white", s, s)
        cmd.set_bond("stick_radius", "-0.14", s, s)
        cmd.set("stick_ball", "1")
        cmd.set("stick_ball_ratio", -1.0)
        cmd.set("stick_ball_color", "atomic")
        cmd.show("sticks", s)
Esempio n. 31
0
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)
Esempio n. 32
0
def technical(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)
    util.chainbow(s,_self=cmd)
    util.cbc("("+lig_sele+" and ("+s+"))",_self=cmd)   
    util.cbac("(("+s+") and not elem c)",_self=cmd)
    cmd.show("nonbonded",s)
    cmd.show("lines","((("+s+") and not "+lig_sele+") extend 1)")
    cmd.show("sticks","("+lig_sele+" and ("+s+"))")
    cmd.show("ribbon",s)
    cmd.dist(polar_contacts,s,s,mode=2,label=0,reset=1) # hbonds
    if polar_contacts in cmd.get_names():
        cmd.enable(polar_contacts)
        cmd.set("dash_width",1.5,polar_contacts)
        cmd.hide("labels",polar_contacts)
        cmd.show("dashes",polar_contacts)
    cmd.show("nonbonded","(("+lig_sele+"|resn hoh+wat+h2o) and ("+s+"))")
Esempio n. 33
0
def ball_and_stick(selection="(all)",mode=1,_self=cmd):
    cmd=_self
    s = tmp_sele
    cmd.select(s,selection)
    _prepare(s,_self=cmd)
    if mode == 1:
        cmd.hide("everything",s)
        cmd.set_bond("stick_color","white",s,s)
        cmd.set_bond("stick_radius","0.14",s,s)
        cmd.set("sphere_scale","0.25",s)
        cmd.show("sticks",s)
        cmd.show("spheres",s)
    elif mode == 2:
        cmd.hide("everything",s)
        cmd.set_bond("stick_color","white",s,s)
        cmd.set_bond("stick_radius","-0.14",s,s)
        cmd.set("stick_ball","1")
        cmd.set("stick_ball_ratio",-1.0)
        cmd.set("stick_ball_color","atomic")
        cmd.show("sticks",s)
Esempio n. 34
0
def technical(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)
    util.chainbow(s, _self=cmd)
    util.cbc("(" + lig_sele + " and (" + s + "))", _self=cmd)
    util.cbac("((" + s + ") and not elem c)", _self=cmd)
    cmd.show("nonbonded", s)
    cmd.show("lines", "(((" + s + ") and not " + lig_sele + ") extend 1)")
    cmd.show("sticks", "(" + lig_sele + " and (" + s + "))")
    cmd.show("ribbon", s)
    cmd.dist(polar_contacts, s, s, mode=2, label=0, reset=1)  # hbonds
    if polar_contacts in cmd.get_names():
        cmd.enable(polar_contacts)
        cmd.set("dash_width", 1.5, polar_contacts)
        cmd.hide("labels", polar_contacts)
        cmd.show("dashes", polar_contacts)
    cmd.show("nonbonded",
             "((" + lig_sele + "|resn hoh+wat+h2o) and (" + s + "))")
Esempio n. 35
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)
Esempio n. 36
0
def colorByRMSD(objSel1, objSel2, doAlign="True", doPretty=None):
    """
    colorByRMSD -- align two structures and show the structural deviations
                   in color to more easily see variable regions.
 
    PARAMS
 
        objSel1 (valid PyMOL object or selection)
            The first object to align.  
 
        objSel2 (valid PyMOL object or selection)
            The second object to align
 
        doAlign (boolean, either True or False)
            Should this script align your proteins or just leave them as is?
            If doAlign=True then your original proteins are aligned.
            If False, then they are not. Regardless, the B-factors are changed.
            DEFAULT: True
 
        doPretty (boolean, either True or False)
            If doPretty=True then a simple representation is created to
            highlight the differences.  If False, then no changes are made.
            DEFAULT: False
 
    RETURNS
        None.
 
    SIDE-EFFECTS
        Modifies the B-factor columns in your original structures.
 
    """
    # First create backup copies; names starting with __ (underscores) are
    # normally hidden by PyMOL
    tObj1, tObj2, aln = "__tempObj1", "__tempObj2", "__aln"
 
    if strTrue(doAlign):
        # perform the alignment
        cmd.create( tObj1, objSel1 )
        cmd.create( tObj2, objSel2 )
        cmd.super( tObj1, tObj2, object=aln )
        cmd.matrix_copy(tObj1, objSel1)
    else:
        # perform the alignment
        cmd.create( tObj1, objSel1 )
        cmd.create( tObj2, objSel2 )
        cmd.super( tObj1, tObj2, 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=-10")
    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 = [], []
 
    #  Get the residue identifiers from the alignment object "aln"
    cmd.iterate(tObj1 + " and n. CA and " + aln, "stored.alnAres.append(resi)")
    cmd.iterate(tObj2 + " and n. CA and " + aln, "stored.alnBres.append(resi)")
 
    # Change the B-factors for EACH object
    rmsUpdateB(tObj1,stored.alnAres,tObj2,stored.alnBres)
 
    # Store the NEW B-factors
    stored.alnAnb, stored.alnBnb = [], []
    cmd.iterate(tObj1 + " and n. CA and " + aln, "stored.alnAnb.append(b)" )
    cmd.iterate(tObj2 + " and n. CA and " + aln, "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
    for x in range(len(stored.alnAres)):
        cmd.alter(objSel1 + " and n. CA and i. " + str(stored.alnAres[x]), "b = " + str(stored.alnAnb[x]))
    for x in range(len(stored.alnBres)):
        cmd.alter(objSel2 + " and n. CA and i. " + str(stored.alnBres[x]), "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 "\nColorByRMSD completed successfully."
    print "The MINIMUM RMSD value is: "+str(min(stored.allRMSDval))
    print "The MAXIMUM RMSD value is: "+str(max(stored.allRMSDval))
 
    if doPretty!=None:
        # Showcase what we did
        cmd.orient()
        cmd.hide("all")
        cmd.show_as("cartoon", objSel1 + " or " + objSel2)
        # Select the residues not used for alignment; they still have their B-factors as "-10"
        cmd.select("notUsedForAln", "b < 0")
        # White-wash the residues not used for alignment
        cmd.color("white", "notUsedForAln")
        # Color the residues used for alignment according to their B-factors (RMSD values)
        cmd.spectrum("b", 'rainbow',  "((" + objSel1 + " and n. CA) or (n. CA and " + objSel2 +" )) and not notUsedForAln")
        # 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 below.
        cmd.delete("notUsedForAln")
        # cmd.disable("notUsedForAln") 
 
        print "\nObjects are now colored by C-alpha RMS deviation."
        print "All residues with RMSD values greater than the maximum are colored white..."
Esempio n. 37
0
def colorByRMSD(objSel1, objSel2, doAlign="True", doPretty=None):
    """
    colorByRMSD -- align two structures and show the structural deviations
                   in color to more easily see variable regions.
 
    PARAMS
 
        objSel1 (valid PyMOL object or selection)
            The first object to align.  
 
        objSel2 (valid PyMOL object or selection)
            The second object to align
 
        doAlign (boolean, either True or False)
            Should this script align your proteins or just leave them as is?
            If doAlign=True then your original proteins are aligned.
            If False, then they are not. Regardless, the B-factors are changed.
            DEFAULT: True
 
        doPretty (boolean, either True or False)
            If doPretty=True then a simple representation is created to
            highlight the differences.  If False, then no changes are made.
            DEFAULT: False
 
    RETURNS
        None.
 
    SIDE-EFFECTS
        Modifies the B-factor columns in your original structures.
 
    """
    # First create backup copies; names starting with __ (underscores) are
    # normally hidden by PyMOL
    tObj1, tObj2, aln = "__tempObj1", "__tempObj2", "__aln"
 
    if strTrue(doAlign):
        # perform the alignment
        cmd.create( tObj1, objSel1 )
        cmd.create( tObj2, objSel2 )
        cmd.super( tObj1, tObj2, object=aln )
        cmd.matrix_copy(tObj1, objSel1)
    else:
        # perform the alignment
        cmd.create( tObj1, objSel1 )
        cmd.create( tObj2, objSel2 )
        cmd.super( tObj1, tObj2, 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=-10")
    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 = [], []
 
    #  Get the residue identifiers from the alignment object "aln"
    cmd.iterate(tObj1 + " and n. CA and " + aln, "stored.alnAres.append(resi)")
    cmd.iterate(tObj2 + " and n. CA and " + aln, "stored.alnBres.append(resi)")
 
    # Change the B-factors for EACH object
    rmsUpdateB(tObj1,stored.alnAres,tObj2,stored.alnBres)
 
    # Store the NEW B-factors
    stored.alnAnb, stored.alnBnb = [], []
    cmd.iterate(tObj1 + " and n. CA and " + aln, "stored.alnAnb.append(b)" )
    cmd.iterate(tObj2 + " and n. CA and " + aln, "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
    for x in range(len(stored.alnAres)):
        cmd.alter(objSel1 + " and n. CA and i. " + str(stored.alnAres[x]), "b = " + str(stored.alnAnb[x]))
    for x in range(len(stored.alnBres)):
        cmd.alter(objSel2 + " and n. CA and i. " + str(stored.alnBres[x]), "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 "\nColorByRMSD completed successfully."
    print "The MINIMUM RMSD value is: "+str(min(stored.allRMSDval))
    print "The MAXIMUM RMSD value is: "+str(max(stored.allRMSDval))
 
    if doPretty!=None:
        # Showcase what we did
        cmd.orient()
        cmd.hide("all")
        cmd.show_as("cartoon", objSel1 + " or " + objSel2)
        # Select the residues not used for alignment; they still have their B-factors as "-10"
        cmd.select("notUsedForAln", "b < 0")
        # White-wash the residues not used for alignment
        cmd.color("white", "notUsedForAln")
        # Color the residues used for alignment according to their B-factors (RMSD values)
        cmd.spectrum("b", 'rainbow',  "((" + objSel1 + " and n. CA) or (n. CA and " + objSel2 +" )) and not notUsedForAln")
        # 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 below.
        cmd.delete("notUsedForAln")
        # cmd.disable("notUsedForAln") 
 
        print "\nObjects are now colored by C-alpha RMS deviation."
        print "All residues with RMSD values greater than the maximum are colored white..."
Esempio n. 38
0
File: m4x.py Progetto: Almad/pymol
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)
Esempio n. 39
0
import cmd, sys

# This is a set of in-line functions used to specify color gradients.  fx is 
# the fractional time of a given step within the trajectories (ranging from 0
# to 1). "color_graidents" is a list of references to these functions.  
# If multiple trajectories are loaded, the gradients are applied in the order
# specified in color_gradients.  The trajectories are ordered by where they 
# occur in the command line.
def a(fx): return [fx,0,(1.0-fx)]   #fx,fx,1-fx]
def b(fx): return [1,fx,1]   #1,fx,fx]
def c(fx): return [1,1,fx]   #1-fx,1-fx,fx]

color_gradients = [a,b,c]

# Default representations
cmd.hide("everything","all")
cmd.show("ribbon","all")
cmd.show("spheres","resn N06 or resn N15 or resn E40 or resn EST")

# Create a list of unique trajectories loaded by parsing the command line
unique = [arg[:-4] for arg in sys.argv if arg.endswith(".pdb")]

# Go through each trajecotry
models = cmd.get_names("all")
for i, u in enumerate(unique):

    traj = [m for m in models if "_".join(m.split("_")[:-1]) == u]

    # Go through each step in the trajectory
    num_steps = float(len(traj))
    for j, t in enumerate(traj):
Esempio n. 40
0
def a(fx):
    return [fx, 0, (1.0 - fx)]  #fx,fx,1-fx]


def b(fx):
    return [1, fx, 1]  #1,fx,fx]


def c(fx):
    return [1, 1, fx]  #1-fx,1-fx,fx]


color_gradients = [a, b, c]

# Default representations
cmd.hide("everything", "all")
cmd.show("ribbon", "all")
cmd.show("spheres", "resn N06 or resn N15 or resn E40 or resn EST")

# Create a list of unique trajectories loaded by parsing the command line
unique = [arg[:-4] for arg in sys.argv if arg.endswith(".pdb")]

# Go through each trajecotry
models = cmd.get_names("all")
for i, u in enumerate(unique):

    traj = [m for m in models if "_".join(m.split("_")[:-1]) == u]

    # Go through each step in the trajectory
    num_steps = float(len(traj))
    for j, t in enumerate(traj):
Esempio n. 41
0
def simple_no_solv(selection="(all)", _self=cmd):
    cmd = _self
    simple(selection, _self=_self)
    s = tmp_sele
    cmd.select(s, selection)
    cmd.hide("nonbonded", "(" + solv_sele + " and " + s + ")")
Esempio n. 42
0
def pretty(selection, _self=cmd):
    cmd = _self
    pretty_solv(selection, _self)
    s = tmp_sele
    cmd.select(s, selection)
    cmd.hide("nb_spheres", "(" + s + " and " + lig_sele + "|resn hoh+wat+h2o)")