Exemplo n.º 1
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")
Exemplo n.º 2
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")
Exemplo n.º 3
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)
Exemplo n.º 4
0
Arquivo: m4x.py Projeto: 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")
Exemplo n.º 5
0
Arquivo: m4x.py Projeto: 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)
Exemplo n.º 6
0
Arquivo: m4x.py Projeto: 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)
Exemplo n.º 7
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)
Exemplo n.º 8
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)
Exemplo n.º 9
0
Arquivo: m4x.py Projeto: 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")
Exemplo n.º 10
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)
Exemplo n.º 11
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")
Exemplo n.º 12
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)
Exemplo n.º 13
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)
Exemplo n.º 14
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")
Exemplo n.º 15
0
def b_factor_putty(selection="(name ca or name p)",_self=cmd):
    cmd=_self
    s = tmp_sele
    cmd.select(s,selection)
    _prepare(s,_self=cmd)
    cmd.select(s,"(name ca or name p) and ("+selection+")")
    cmd.show("cartoon",s)
    cmd.set("cartoon_flat_sheets",0,selection)
    cmd.cartoon("putty",s)
    cmd.spectrum("b",selection=s)
Exemplo n.º 16
0
Arquivo: m4x.py Projeto: 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")
Exemplo n.º 17
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)
Exemplo n.º 18
0
Arquivo: m4x.py Projeto: 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)
Exemplo n.º 19
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")
Exemplo n.º 20
0
def b_factor_putty(selection="(name ca or name p)", _self=cmd):
    cmd = _self
    s = tmp_sele
    cmd.select(s, selection)
    _prepare(s, _self=cmd)
    cmd.select(s, "(name ca or name p) and (" + selection + ")")
    cmd.show("cartoon", s)
    cmd.set("cartoon_flat_sheets", 0, selection)
    cmd.cartoon("putty", s)
    cmd.spectrum("b", selection=s)
Exemplo n.º 21
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)
Exemplo n.º 22
0
def default(selection="(all)", _self=cmd):
    cmd = _self
    s = tmp_sele
    cmd.select(s, selection)
    _prepare(s, _self=cmd)
    cmd.show("lines", s)
    cmd.show("nonbonded", s)
    color = cmd.get_object_color_index(selection)
    if color < 0:
        util.cbag(selection, _self=cmd)
    else:
        util.cnc(selection, _self=cmd)
        cmd.color(str(color), "(" + s + ") and elem c")
Exemplo n.º 23
0
def default(selection="(all)",_self=cmd):
    cmd=_self
    s = tmp_sele
    cmd.select(s,selection)
    _prepare(s,_self=cmd)
    cmd.show("lines",s)
    cmd.show("nonbonded",s)
    color=cmd.get_object_color_index(selection)
    if color<0:
        util.cbag(selection,_self=cmd)
    else:
        util.cnc(selection,_self=cmd)
        cmd.color(str(color),"("+s+") and elem c")
Exemplo n.º 24
0
Arquivo: util.py Projeto: 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)
Exemplo n.º 25
0
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)
Exemplo n.º 26
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)
Exemplo n.º 27
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)
Exemplo n.º 28
0
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)
Exemplo n.º 29
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+"))")
Exemplo n.º 30
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)
Exemplo n.º 31
0
Arquivo: m4x.py Projeto: 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)
Exemplo n.º 32
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()
def ColorByDisplacementCA(objSel1, objSel2, super1='all', super2='all', doColor="True", doAlign="True", AlignedWhite='yes'):
    ### First create backup copies; names starting with __ (underscores) are normally hidden by PyMOL
    tObj1, tObj2, aln = "__tempObj1", "__tempObj2", "__aln"
 
    if strTrue(doAlign):
        ### Create temp objects
        cmd.create( tObj1, objSel1 )
        cmd.create( tObj2, objSel2 )
	### Align and make create an object aln which indicates which atoms were paired between the two structures
	### Super is must faster than align http://www.pymolwiki.org/index.php/Super
        cmd.super(tObj1 + ' and ' + str(super1), tObj2 + ' and ' + str(super2), object=aln)
	### Modify the original matrix of object1 from the alignment
        cmd.matrix_copy(tObj1, objSel1)
    else:
        ### Create temp objects
        cmd.create( tObj1, objSel1 )
        cmd.create( tObj2, objSel2 )
	### Align and make create an object aln which indicates which atoms were paired between the two structures
	### Super is must faster than align http://www.pymolwiki.org/index.php/Super
        cmd.super(tObj1 + ' and ' + str(super1), tObj2 + ' and ' + str(super2), object=aln)
 
    ### Modify the B-factor columns of the original objects,
    ### in order to identify the residues NOT used for alignment, later on
    cmd.alter( objSel1 + " or " + objSel2, "b=-0.2")
    cmd.alter( tObj1 + " or " + tObj2, "chain='A'")
    cmd.alter( tObj1 + " or " + tObj2, "segi='A'")
 
    ### Update pymol internal representations; one of these should do the trick
    cmd.refresh(); cmd.rebuild(); cmd.sort(tObj1); cmd.sort(tObj2)
 
    ###  Create lists for storage
    stored.alnAres, stored.alnBres = [], []
 
    ### Iterate over objects
    if AlignedWhite=='yes':
        cmd.iterate(tObj1 + " and n. CA and not " + aln, "stored.alnAres.append(resi)")
	cmd.iterate(tObj2 + " and n. CA and not " + aln, "stored.alnBres.append(resi)")
    else:
	cmd.iterate(tObj1 + " and n. CA", "stored.alnAres.append(resi)")
        cmd.iterate(tObj2 + " and n. CA", "stored.alnBres.append(resi)")
 
    ### Change the B-factors for EACH object
    displacementUpdateB(tObj1,stored.alnAres,tObj2,stored.alnBres)
 
    ### Store the NEW B-factors
    stored.alnAnb, stored.alnBnb = [], []
    ### Iterate over objects and get b
    if AlignedWhite=='yes':
	### Iterate over objects which is not aligned
    	cmd.iterate(tObj1 + " and n. CA and not " + aln, "stored.alnAnb.append(b)" )
	cmd.iterate(tObj2 + " and n. CA and not " + aln, "stored.alnBnb.append(b)" )
    else:
	### Or Iterate over all objects with CA
    	cmd.iterate(tObj1 + " and n. CA", "stored.alnAnb.append(b)" )
    	cmd.iterate(tObj2 + " and n. CA", "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 "\nColorByDisplacementCA completed successfully."
    print "The MAXIMUM Displacement is: "+str(max(stored.allRMSDval)) +" residue "+str(stored.alnAres[int(stored.allRMSDval.index(max(stored.allRMSDval)))])
 
    if strTrue(doColor):
        ### Showcase what we did
        #cmd.orient()
        #cmd.hide("all")
        cmd.show("cartoon", objSel1 + " or " + objSel2)
        ### Select the residues not used for alignment; they still have their B-factors as "-0.2"
        cmd.select("notUsedForAln", "b = -0.2")
        ### White-wash the residues not used for alignment
        cmd.color("white", "notUsedForAln")
        ### Select the residues not in both pdb files; they have their B-factors as "-0. 01"
        cmd.select("ResNotInBothPDB", "b = -0.01")
        ### White-wash the residues not used for alignment
        cmd.color("black", "ResNotInBothPDB")
        ### Color the residues used for alignment according to their B-factors (Displacment values)
#        cmd.spectrum("b", 'rainbow',  "((" + objSel1 + " and n. CA) or (n. CA and " + objSel2 +" )) and not notUsedForAln+ResNotInBothPDB")
        cmd.spectrum("b", 'rainbow',  "((" + objSel1 + " and n. CA) or (n. CA and " + objSel2 +" )) and not (notUsedForAln or ResNotInBothPDB)")
        ### Delete the selection of atoms not used for alignment
        ### If you would like to keep this selection intact,
        ### just comment "cmd.delete" line and
        ### uncomment the "cmd.disable" line abowe.
        cmd.disable("notUsedForAln")
        cmd.delete("notUsedForAln")
        cmd.disable("ResNotInBothPDB")
        cmd.delete("ResNotInBothPDB")
 
        print "\nObjects are now colored by C-alpha displacement deviation."
        print "Blue is minimum and red is maximum..."
        print "White is those residues used in the alignment algorithm. Can be turned off in top of algorithm."
	print "Black is residues that does not exist in both files..."
Exemplo n.º 34
0
# 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):
Exemplo n.º 35
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)
Exemplo n.º 36
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 + "))")
Exemplo n.º 37
0
    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):
Exemplo n.º 38
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)
Exemplo n.º 39
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()