Exemplo n.º 1
0
def show_rep(tag):
    try:
        sel = glb.SELE
        if tag == 'Lines':
            cmd.show('lines', sel)
        elif tag == 'Sticks':
            cmd.show('sticks', sel)
        elif tag == 'Ribbons':
            cmd.show('ribbon', sel)
        elif tag == 'Cartoon':
            cmd.show('cartoon', sel)
        elif tag == 'Dots':
            cmd.show('dots', sel)
        elif tag == 'Spheres':
            cmd.show('spheres', sel)
        elif tag == 'Mesh':
            cmd.show('mesh', sel)
        elif tag == 'Surface':
            cmd.show('surface', sel)
        elif tag == 'Water':
            cmd.show('spheres', '(resn HOH)')
        elif tag == 'Ball and Stick':
            preset.ball_and_stick(sel)
        elif tag == 'Polar Contacts':
            cmd.dist(sel+"_polar_conts", sel, sel, quiet = 1, mode = 2, label = 0,
                reset = 1)
            cmd.enable(sel+"1CHO_polar_conts")        
    except:
        showinfo('Error', 'Update Selection!')
Exemplo n.º 2
0
def fSumWMCFirst(molecule, SGNameAngle, chain, residue, MCNeighbour, DieElecMC,
                 MCchargeC, MCchargeO, printMC):
    # print "First", MCNeighbour
    SumWMCFirst = 0.0
    SGnameselect = "/" + SGNameAngle + "//" + "/" + "/SG"
    NBnameselect = "/" + molecule + "//" + chain + "/" + str(MCNeighbour)
    cmd.select("MC", NBnameselect)
    MCpdbstr = cmd.get_pdbstr("MC")
    MCsplit = MCpdbstr.split()
    residueName = MCsplit[3]
    # print NBnameselect, residueName
    # Mainchain C
    Cnameselect = "/" + molecule + "//" + chain + "/" + str(MCNeighbour) + "/C"
    ResDist = cmd.dist(residue + 'distFirstC', SGnameselect, Cnameselect)
    WMC = fWMC(MCchargeC, DieElecMC, ResDist)
    SumWMCFirst = SumWMCFirst + WMC
    if printMC == 'yes':
        print("MC C ", MCNeighbour, " ", MCchargeC, " ", DieElecMC, " ",
              ResDist, " ", WMC)
    # Mainchain O
    Onameselect = "/" + molecule + "//" + chain + "/" + str(MCNeighbour) + "/O"
    ResDist = cmd.dist(residue + 'distFirstO', SGnameselect, Onameselect)
    WMC = fWMC(MCchargeO, DieElecMC, ResDist)
    SumWMCFirst = SumWMCFirst + WMC
    if printMC == 'yes':
        print("MC O ", MCNeighbour, " ", MCchargeO, " ", DieElecMC, " ",
              ResDist, " ", WMC)
    cmd.delete(residue + 'distFirstC')
    cmd.delete(residue + 'distFirstO')
    cmd.delete("MC")
    return SumWMCFirst
def show_ligand_interactions(recsel="not hetatm", ligsel="hetatm", cutoff=5):
    """
DESCRIPTION

    Visualize interactions between receptor and ligand.

ARGUMENTS

    recsel = string: atom selection of the receptor {default: "not hetatm"}

    ligsel = string: atom selections of the ligand {default: "hetatm"}

    cutoff = float: show as sticks all receptor residues within this distance from the ligand {default: 5.0}
    """
    cmd.select('ligand', ligsel)
    cmd.select('receptor', recsel)
    cmd.bg_color('white')
    cmd.show_as('cartoon')
    cmd.show_as('sticks', 'hetatm')
    cmd.set('cartoon_transparency', 0.2)
    cmd.spectrum(selection=recsel+" or "+ligsel,byres=1)
    util.cbag('not elem C')
    cmd.set('cartoon_fancy_helices', 1);
    cmd.show("sticks", "(hydro)");
    cmd.select("pocket", "byres (receptor within %s of ligand)" % cutoff);
    cmd.show("sticks", "pocket")
    cmd.hide('(h. and (e. c extend 1))')
    cmd.set('h_bond_max_angle', 30)
    cmd.set('h_bond_cutoff_center', 3.6)
    cmd.set('h_bond_cutoff_edge', 3.2)
    cmd.dist('ligand_Hbonds', 'ligand', 'receptor', 3.5, mode=2)
    cmd.set('dash_radius', 0.15)
    # now set the label options
    cmd.set('label_size', 20)
    cmd.set('label_position', [0,0,10])
Exemplo n.º 4
0
def show_rep(tag):
    try:
        sel = glb.SELE
        if tag == 'Lines':
            cmd.show('lines', sel)
        elif tag == 'Sticks':
            cmd.show('sticks', sel)
        elif tag == 'Ribbons':
            cmd.show('ribbon', sel)
        elif tag == 'Cartoon':
            cmd.show('cartoon', sel)
        elif tag == 'Dots':
            cmd.show('dots', sel)
        elif tag == 'Spheres':
            cmd.show('spheres', sel)
        elif tag == 'Mesh':
            cmd.show('mesh', sel)
        elif tag == 'Surface':
            cmd.show('surface', sel)
        elif tag == 'Water':
            cmd.show('spheres', '(resn HOH)')
        elif tag == 'Ball and Stick':
            preset.ball_and_stick(sel)
        elif tag == 'Polar Contacts':
            cmd.dist(sel + "_polar_conts",
                     sel,
                     sel,
                     quiet=1,
                     mode=2,
                     label=0,
                     reset=1)
            cmd.enable(sel + "1CHO_polar_conts")
    except:
        showinfo('Error', 'Update Selection!')
Exemplo n.º 5
0
def bonds(recsel="clean*", ligsel="vina*", cutoff=3.5):
    """
DESCRIPTION

    Visualize interactions between receptor and ligand.

ARGUMENTS

    recsel = string: atom selection of the receptor {default: "not hetatm"}

    ligsel = string: atom selections of the ligand {default: "hetatm"}

    cutoff = float: show as sticks all receptor residues within this distance from the ligand {default: 5.0}
    """
    cmd.select('ligand', ligsel)
    cmd.select('receptor', recsel)
    cmd.select(
        "pocket",
        "byres (receptor within %s of ligand and not resn HEM)" % cutoff)
    cmd.show("sticks", "pocket")
    cmd.set('stick_transparency', 0.5, 'clean*')
    cmd.set('stick_radius', 0.05, 'clean*')
    cmd.hide('(h. and (e. c extend 1))')
    cmd.set('h_bond_max_angle', 30)
    cmd.set('h_bond_cutoff_center', 3.6)
    cmd.set('h_bond_cutoff_edge', 3.2)
    cmd.dist('ligand_Hbonds', 'ligand', 'receptor', 3.5, mode=2)
    #cmd.dist('pipi','ligand','receptor',2.5,mode=5)
    cmd.set('dash_radius', 0.09)
Exemplo n.º 6
0
def fSumWMCFirst(molecule, SGNameAngle, chain, residue, MCNeighbour, DieElecMC, MCchargeC, MCchargeO, printMC):
    # print "First", MCNeighbour
    SumWMCFirst = 0.0
    SGnameselect = "/" + SGNameAngle + "//" + "/" + "/SG"
    NBnameselect = "/" + molecule + "//" + chain + "/" + str(MCNeighbour)
    cmd.select("MC", NBnameselect)
    MCpdbstr = cmd.get_pdbstr("MC")
    MCsplit = MCpdbstr.split()
    residueName = MCsplit[3]
    # print NBnameselect, residueName
    # Mainchain C
    Cnameselect = "/" + molecule + "//" + chain + "/" + str(MCNeighbour) + "/C"
    ResDist = cmd.dist(residue + 'distFirstC', SGnameselect, Cnameselect)
    WMC = fWMC(MCchargeC, DieElecMC, ResDist)
    SumWMCFirst = SumWMCFirst + WMC
    if printMC == 'yes':
        print("MC C ", MCNeighbour, " ", MCchargeC, " ", DieElecMC, " ", ResDist, " ", WMC)
    # Mainchain O
    Onameselect = "/" + molecule + "//" + chain + "/" + str(MCNeighbour) + "/O"
    ResDist = cmd.dist(residue + 'distFirstO', SGnameselect, Onameselect)
    WMC = fWMC(MCchargeO, DieElecMC, ResDist)
    SumWMCFirst = SumWMCFirst + WMC
    if printMC == 'yes':
        print("MC O ", MCNeighbour, " ", MCchargeO, " ", DieElecMC, " ", ResDist, " ", WMC)
    cmd.delete(residue + 'distFirstC')
    cmd.delete(residue + 'distFirstO')
    cmd.delete("MC")
    return SumWMCFirst
Exemplo n.º 7
0
def fSumWMCresidue(molecule, SGNameAngle, chain, residue, MCNeighbour,
                   DieElecMC, MCchargeC, MCchargeO, MCchargeN, MCchargeH,
                   AmideName, printMC):
    # print "residue", MCNeighbour
    SumWMCresidue = 0.0
    SGnameselect = "/" + SGNameAngle + "//" + "/" + "/SG"
    NBnameselect = "/" + molecule + "//" + chain + "/" + str(MCNeighbour)
    cmd.select("MC", NBnameselect)
    MCpdbstr = cmd.get_pdbstr("MC")
    MCsplit = MCpdbstr.split()
    residueName = MCsplit[3]
    # print NBnameselect, residueName
    AmideProt = "/" + molecule + "//" + chain + "/" + str(MCNeighbour) + "/H01"
    Hnameselect = "/" + AmideName + "//" + chain + "/" + str(
        MCNeighbour) + "/H01"
    if cmd.count_atoms(AmideProt) == 0 and cmd.count_atoms(Hnameselect) == 0:
        HbuildSelect = "/" + molecule + "//" + chain + "/" + str(
            MCNeighbour) + "/N"
        cmd.h_add(HbuildSelect)
        cmd.create(AmideName, AmideName + " + " + AmideProt)
        cmd.remove(AmideProt)
    # Mainchain AmideH
    ResDist = cmd.dist(residue + 'distResH', SGnameselect, Hnameselect)
    WMC = fWMC(MCchargeH, DieElecMC, ResDist)
    SumWMCresidue = SumWMCresidue + WMC
    if printMC == 'yes':
        print("MC H ", MCNeighbour, " ", MCchargeH, " ", DieElecMC, " ",
              ResDist, " ", WMC)
    # Mainchain C
    Cnameselect = "/" + molecule + "//" + chain + "/" + str(MCNeighbour) + "/C"
    ResDist = cmd.dist(residue + 'distResC', SGnameselect, Cnameselect)
    WMC = fWMC(MCchargeC, DieElecMC, ResDist)
    SumWMCresidue = SumWMCresidue + WMC
    if printMC == 'yes':
        print("MC C ", MCNeighbour, " ", MCchargeC, " ", DieElecMC, " ",
              ResDist, " ", WMC)
    # Mainchain O
    Onameselect = "/" + molecule + "//" + chain + "/" + str(MCNeighbour) + "/O"
    ResDist = cmd.dist(residue + 'distResO', SGnameselect, Onameselect)
    WMC = fWMC(MCchargeO, DieElecMC, ResDist)
    SumWMCresidue = SumWMCresidue + WMC
    if printMC == 'yes':
        print("MC O ", MCNeighbour, " ", MCchargeO, " ", DieElecMC, " ",
              ResDist, " ", WMC)
    # Mainchain N
    Nnameselect = "/" + molecule + "//" + chain + "/" + str(MCNeighbour) + "/N"
    ResDist = cmd.dist(residue + 'distResN', SGnameselect, Nnameselect)
    WMC = fWMC(MCchargeN, DieElecMC, ResDist)
    SumWMCresidue = SumWMCresidue + WMC
    if printMC == 'yes':
        print("MC N ", MCNeighbour, " ", MCchargeN, " ", DieElecMC, " ",
              ResDist, " ", WMC)
    cmd.delete(residue + 'distResH')
    cmd.delete(residue + 'distResC')
    cmd.delete(residue + 'distResO')
    cmd.delete(residue + 'distResN')
    cmd.show("nb_spheres", AmideName)
    cmd.delete("MC")
    return SumWMCresidue
Exemplo n.º 8
0
def fSumWMCLast(molecule, SGNameAngle, chain, residue, MCNeighbour, DieElecMC, MCchargeN, MCchargeH, MCchargeProCA, MCchargeProCD, MCchargeProN, AmideName, printMC):
	#print "Last", MCNeighbour
	SumWMCLast = 0.0
	SGnameselect = "/"+SGNameAngle+"//"+"/"+"/SG"
	NBnameselect = "/"+molecule+"//"+chain+"/"+str(MCNeighbour)
	cmd.select("MC", NBnameselect)
	MCpdbstr = cmd.get_pdbstr("MC")
	MCsplit = MCpdbstr.split()
	residueName = MCsplit[3]
	#print NBnameselect, residueName
	if residueName == "PRO":
		### Proline CA
		CAnameselect = "/"+molecule+"//"+chain+"/"+str(MCNeighbour)+"/CA"
		ResDist = cmd.dist(residue+'distLastProCA', SGnameselect,CAnameselect)
		WMC = fWMC(MCchargeProCA, DieElecMC, ResDist)
		SumWMCLast = SumWMCLast + WMC
		if printMC == 'yes': print "MC ProCA ", MCNeighbour, " ", MCchargeProCA, " ", DieElecMC, " ", ResDist, " ", WMC
		### Proline CD
		CDnameselect = "/"+molecule+"//"+chain+"/"+str(MCNeighbour)+"/CD"
		ResDist = cmd.dist(residue+'distLastProCD', SGnameselect,CDnameselect)
		WMC = fWMC(MCchargeProCD, DieElecMC, ResDist)
		SumWMCLast = SumWMCLast + WMC
		if printMC == 'yes': print "MC ProCD ", MCNeighbour, " ", MCchargeProCD, " ", DieElecMC, " ", ResDist, " ", WMC
		### Proline N
		Nnameselect = "/"+molecule+"//"+chain+"/"+str(MCNeighbour)+"/N"
		ResDist = cmd.dist(residue+'distLastProN', SGnameselect,Nnameselect)
		WMC = fWMC(MCchargeProN, DieElecMC, ResDist)
		SumWMCLast = SumWMCLast + WMC
		if printMC == 'yes': print "MC ProN ", MCNeighbour, " ", MCchargeProN, " ", DieElecMC, " ", ResDist, " ", WMC
	else:
		AmideProt = "/"+molecule+"//"+chain+"/"+str(MCNeighbour)+"/H01"
		Hnameselect = "/"+AmideName+"//"+chain+"/"+str(MCNeighbour)+"/H01"
		if cmd.count_atoms(AmideProt) == 0 and cmd.count_atoms(Hnameselect) == 0:
			HbuildSelect = "/"+molecule+"//"+chain+"/"+str(MCNeighbour)+"/N"
			cmd.h_add(HbuildSelect)
			cmd.create(AmideName, AmideName+" + "+AmideProt)
			cmd.remove(AmideProt)
		### Mainchain AmideH
		ResDist = cmd.dist(residue+'distLastH', SGnameselect,Hnameselect)
		WMC = fWMC(MCchargeH, DieElecMC, ResDist)
		SumWMCLast = SumWMCLast + WMC
		if printMC == 'yes': print "MC H ", MCNeighbour, " ", MCchargeH, " ", DieElecMC, " ", ResDist, " ", WMC
		### Mainchain N
		Nnameselect = "/"+molecule+"//"+chain+"/"+str(MCNeighbour)+"/N"
		ResDist = cmd.dist(residue+'distLastN', SGnameselect,Nnameselect)
		WMC = fWMC(MCchargeN, DieElecMC, ResDist)
		SumWMCLast = SumWMCLast + WMC
		if printMC == 'yes': print "MC N ", MCNeighbour, " ", MCchargeN, " ", DieElecMC, " ", ResDist, " ", WMC
	cmd.delete(residue+'distLastProCA')
	cmd.delete(residue+'distLastProCD')
	cmd.delete(residue+'distLastProN')
	cmd.delete(residue+'distLastH')
	cmd.delete(residue+'distLastN')
	cmd.show("nb_spheres", AmideName)
	cmd.delete("MC")
	return SumWMCLast
Exemplo n.º 9
0
    def do_pick(self, bondFlag):
        global dist_count

        if bondFlag:
            self.error = "Error: please select an atom, not a bond."
            print(self.error)
        else:
            if self.mode == 'pairs':
                if self.status == 0:
                    name = sele_prefix
                    cmd.select(name, "(pk1)")
                    self.status = 1
                    self.error = None
                elif self.status == 1:
                    if ((self.object_mode == 'append') or (not dist_count)):
                        dist_count = dist_count + 1
                    else:
                        cmd.delete(dist_prefix + "%2d" % dist_count)
                    name = dist_prefix + "%02d" % dist_count
                    cmd.dist(name, sele_prefix, "(pk1)")
                    cmd.delete(sele_prefix)
                    cmd.unpick()
                    cmd.enable(name)
                    self.status = 0
            elif self.mode in ['neigh', 'polar', 'heavy']:
                if ((self.object_mode == 'append') or (not dist_count)):
                    dist_count = dist_count + 1
                else:
                    cmd.delete(dist_prefix + "%2d" % dist_count)
                name = dist_prefix + "%02d" % dist_count
                cnt = 0
                if self.mode == 'neigh':
                    cnt = cmd.select(
                        sele_prefix,
                        "(v. and (pk1 a; %f) and (not (nbr. pk1)) and (not (nbr. (nbr. pk1))) and (not (nbr. (nbr. (nbr. pk1)))))"
                        % self.__class__.cutoff)
                elif self.mode == 'polar':
                    cnt = cmd.select(
                        sele_prefix,
                        "(v. and (pk1 a; %f) and (e. n,o) and (not (nbr. pk1)) and (not (nbr. (nbr. pk1))) and (not (nbr. (nbr. (nbr. pk1)))))"
                        % self.__class__.cutoff)
                elif self.mode == 'heavy':
                    cnt = cmd.select(
                        sele_prefix,
                        "(v. and (pk1 a; %f) and (not h.) and (not (nbr. pk1)) and (not (nbr. (nbr. pk1))) and (not (nbr. (nbr. (nbr. pk1)))))"
                        % self.__class__.cutoff)
                cmd.delete(name)
                if cnt:
                    cmd.dist(name, "(pk1)", sele_prefix)
                else:
                    print(" Wizard: No neighbors found.")
                cmd.delete(sele_prefix)
                cmd.unpick()
                cmd.enable(name)
        cmd.refresh_wizard()
Exemplo n.º 10
0
def fSumWMCresidue(molecule, SGNameAngle, chain, residue, MCNeighbour, DieElecMC, MCchargeC, MCchargeO, MCchargeN, MCchargeH, AmideName, printMC):
    # print "residue", MCNeighbour
    SumWMCresidue = 0.0
    SGnameselect = "/" + SGNameAngle + "//" + "/" + "/SG"
    NBnameselect = "/" + molecule + "//" + chain + "/" + str(MCNeighbour)
    cmd.select("MC", NBnameselect)
    MCpdbstr = cmd.get_pdbstr("MC")
    MCsplit = MCpdbstr.split()
    residueName = MCsplit[3]
    # print NBnameselect, residueName
    AmideProt = "/" + molecule + "//" + chain + "/" + str(MCNeighbour) + "/H01"
    Hnameselect = "/" + AmideName + "//" + chain + "/" + str(MCNeighbour) + "/H01"
    if cmd.count_atoms(AmideProt) == 0 and cmd.count_atoms(Hnameselect) == 0:
        HbuildSelect = "/" + molecule + "//" + chain + "/" + str(MCNeighbour) + "/N"
        cmd.h_add(HbuildSelect)
        cmd.create(AmideName, AmideName + " + " + AmideProt)
        cmd.remove(AmideProt)
    # Mainchain AmideH
    ResDist = cmd.dist(residue + 'distResH', SGnameselect, Hnameselect)
    WMC = fWMC(MCchargeH, DieElecMC, ResDist)
    SumWMCresidue = SumWMCresidue + WMC
    if printMC == 'yes':
        print("MC H ", MCNeighbour, " ", MCchargeH, " ", DieElecMC, " ", ResDist, " ", WMC)
    # Mainchain C
    Cnameselect = "/" + molecule + "//" + chain + "/" + str(MCNeighbour) + "/C"
    ResDist = cmd.dist(residue + 'distResC', SGnameselect, Cnameselect)
    WMC = fWMC(MCchargeC, DieElecMC, ResDist)
    SumWMCresidue = SumWMCresidue + WMC
    if printMC == 'yes':
        print("MC C ", MCNeighbour, " ", MCchargeC, " ", DieElecMC, " ", ResDist, " ", WMC)
    # Mainchain O
    Onameselect = "/" + molecule + "//" + chain + "/" + str(MCNeighbour) + "/O"
    ResDist = cmd.dist(residue + 'distResO', SGnameselect, Onameselect)
    WMC = fWMC(MCchargeO, DieElecMC, ResDist)
    SumWMCresidue = SumWMCresidue + WMC
    if printMC == 'yes':
        print("MC O ", MCNeighbour, " ", MCchargeO, " ", DieElecMC, " ", ResDist, " ", WMC)
    # Mainchain N
    Nnameselect = "/" + molecule + "//" + chain + "/" + str(MCNeighbour) + "/N"
    ResDist = cmd.dist(residue + 'distResN', SGnameselect, Nnameselect)
    WMC = fWMC(MCchargeN, DieElecMC, ResDist)
    SumWMCresidue = SumWMCresidue + WMC
    if printMC == 'yes':
        print("MC N ", MCNeighbour, " ", MCchargeN, " ", DieElecMC, " ", ResDist, " ", WMC)
    cmd.delete(residue + 'distResH')
    cmd.delete(residue + 'distResC')
    cmd.delete(residue + 'distResO')
    cmd.delete(residue + 'distResN')
    cmd.show("nb_spheres", AmideName)
    cmd.delete("MC")
    return SumWMCresidue
Exemplo n.º 11
0
def interface_analyser(name, dist_cuoff=10, animate=True):
    '''
DESCRIPTION
    displays the chains in different colors, showas cavity surfaces, and h.bonds with an interface cutoff
    of 10 (default)
    '''
    # cmd.hide("lines")
    cmd.select("interface", "none")
    alphabet = list(('abcdefghijklmnopqrstuvwxyz').upper())
    for letter in alphabet:
        chainname = "chain" + letter
        cmd.select(
            chainname,
            "%s and chain %s and not hetatm and not symbol w" % (name, letter))
        if cmd.count_atoms("chain%s" % (letter)) > 0:
            interfacename = "interface" + letter
            cmd.select(
                "not_this_chain",
                "%s and not hetatm and not symbol w and not %s" %
                (name, chainname))
            cmd.select(
                interfacename,
                "%s and byres %s and (not_this_chain around %s)" %
                (name, chainname, str(dist_cuoff)))
            cmd.select("interface", "interface or %s" % (interfacename))
            cmd.delete("not_this_chain")
            cmd.delete("interface" + letter)
            cmd.delete("chain%s" % (letter))
        else:
            cmd.delete(chainname)
    cmd.hide("lines", name)
    cmd.show("lines", "interface")
    cmd.show("cartoon")
    cmd.dist(
        "%s_h.bonds" % name,
        "interface",
        "interface",
        quiet=1,
        mode=2,
        label=0,
        reset=1,
    )
    cmd.enable("%s_h.bonds" % name)
    cmd.show("surface", "all")
    cmd.set('surface_cavity_mode', 1)
    util.color_chains("(all and elem c)", _self=cmd)
    if animate:
        cmd.zoom("interface", animate=-1)
        cmd.orient("interface", animate=-1)
    cmd.delete("interface")
    cmd.remove("(all) and hydro")
Exemplo n.º 12
0
def interface_analyser_with_surface(name='all',
                                    chain_sur='A',
                                    dist_cutoff=10,
                                    animate=True):
    cmd.select("interface", "none")
    alphabet = list(('abcdefghijklmnopqrstuvwxyz').upper())
    for letter in alphabet:
        chainname = "chain" + letter
        cmd.select(
            chainname,
            "%s and chain %s and not hetatm and not symbol w" % (name, letter))
        if cmd.count_atoms("chain%s" % (letter)) > 0:
            interfacename = "interface" + letter
            cmd.select(
                "not_this_chain",
                "%s and not hetatm and not symbol w and not %s" %
                (name, chainname))
            cmd.select(
                interfacename,
                "%s and byres %s and (not_this_chain around %s)" %
                (name, chainname, str(dist_cutoff)))
            cmd.select("interface", "interface or %s" % (interfacename))
            cmd.delete("not_this_chain")
            cmd.delete("interface" + letter)
            cmd.delete("chain%s" % (letter))
        else:
            cmd.delete(chainname)
    cmd.hide("lines", name)
    cmd.show("lines", "interface")
    cmd.show("cartoon")
    cmd.dist(
        "%s_h.bonds" % name,
        "interface",
        "interface",
        quiet=1,
        mode=2,
        label=0,
        reset=1,
    )
    cmd.enable("%s_h.bonds" % name)
    cmd.create("chain%s" % chain_sur,
               name + " and chain %s" % chain_sur,
               zoom=0)
    cmd.show("surface", "chain%s" % chain_sur)
    util.color_chains("(all and elem c)", _self=cmd)
    if animate:
        cmd.zoom("interface", animate=-1)
        cmd.orient("interface", animate=-1)
    cmd.delete("interface")
    cmd.remove("(all) and hydro")
Exemplo n.º 13
0
 def update_dashes(self):
     cmd.delete(dist_prefix+"*")
     lst = self.get_sele_list()
     c = 0
     while 1:
         if not len(lst): break
         a = lst.pop()
         if not len(lst): break
         b = lst.pop()
         name = dist_prefix+str(c)
         cmd.dist(name,a,b,width=7,length=0.05,gap=0.05)
         cmd.hide('label',name)
         cmd.enable(name)
         c = c + 1
Exemplo n.º 14
0
 def update_dashes(self):
     cmd.delete(dist_prefix + "*")
     lst = self.get_sele_list()
     c = 0
     while 1:
         if not len(lst): break
         a = lst.pop()
         if not len(lst): break
         b = lst.pop()
         name = dist_prefix + str(c)
         cmd.dist(name, a, b, width=7, length=0.05, gap=0.05)
         cmd.hide('label', name)
         cmd.enable(name)
         c = c + 1
Exemplo n.º 15
0
def zn_interface():

    cmd.show( 'cartoon' )
    cmd.hide( 'lines', 'elem H' )
    util.cbc("elem C")
    cmd.show( 'sticks', 'resn znx')

    cmd.set('cartoon_transparency','0.5')
    cmd.hide( 'sticks', 'elem H' )

    loaded_objs = cmd.get_names('objects')
    print loaded_objs

    for obj in loaded_objs :
        cmd.dist( '"'+obj+'_polar_conts"','"'+obj+'"','"'+obj+'"',quiet=1,mode=2,label=0,reset=1)
        cmd.enable("'"+obj+'_polar_conts"')
Exemplo n.º 16
0
    def do_pick(self,bondFlag):
        global dist_count

        if bondFlag:
            self.error = "Error: please select an atom, not a bond."
            print self.error
        else:
            if self.mode == 'pairs':
                if self.status==0:
                    name = sele_prefix 
                    cmd.select(name,"(pk1)")
                    self.status = 1
                    self.error = None
                elif self.status==1:
                    if ((self.object_mode=='append') or (not dist_count)):
                        dist_count = dist_count + 1
                    else:
                        cmd.delete(dist_prefix+"%2d"%dist_count)
                    name = dist_prefix + "%02d"%dist_count
                    cmd.dist(name,sele_prefix,"(pk1)")
                    cmd.delete(sele_prefix)
                    cmd.unpick()
                    cmd.enable(name)
                    self.status = 0
            elif self.mode in ['neigh','polar','heavy']:
                if ((self.object_mode=='append') or (not dist_count)):
                    dist_count = dist_count + 1
                else:
                    cmd.delete(dist_prefix+"%2d"%dist_count)
                name = dist_prefix + "%02d"%dist_count
                cnt = 0
                if self.mode == 'neigh':
                    cnt = cmd.select(sele_prefix,"(v. and (pk1 a; %f) and (not (nbr. pk1)) and (not (nbr. (nbr. pk1))) and (not (nbr. (nbr. (nbr. pk1)))))"%self.__class__.cutoff)
                elif self.mode == 'polar':
                    cnt = cmd.select(sele_prefix,"(v. and (pk1 a; %f) and (e. n,o) and (not (nbr. pk1)) and (not (nbr. (nbr. pk1))) and (not (nbr. (nbr. (nbr. pk1)))))"%self.__class__.cutoff)            
                elif self.mode == 'heavy':
                    cnt = cmd.select(sele_prefix,"(v. and (pk1 a; %f) and (not h.) and (not (nbr. pk1)) and (not (nbr. (nbr. pk1))) and (not (nbr. (nbr. (nbr. pk1)))))"%self.__class__.cutoff)            
                cmd.delete(name)
                if cnt:
                    cmd.dist(name,"(pk1)",sele_prefix)
                else:
                    print " Wizard: No neighbors found."
                cmd.delete(sele_prefix)
                cmd.unpick()
                cmd.enable(name)
        cmd.refresh_wizard()
Exemplo n.º 17
0
def print_hb(selection):
  hb = cmd.find_pairs("((byres "+selection+") and n;n)","((byres "+selection+") and n;o)",mode=1,cutoff=3.7,angle=55)

  pair1_list = []
  pair2_list = []
  dist_list = []
  for pairs in hb:
    cmd.iterate("%s and ID %s" % (pairs[0][0],pairs[0][1]), 'print "%s/%3s`%s/%s " % (chain,resn,resi,name),')
    cmd.iterate("%s and ID %s" % (pairs[1][0],pairs[1][1]), 'print "%s/%3s`%s/%s " % (chain,resn,resi,name),')
    print "%.2f" % cmd.dist("%s and ID %s" % (pairs[0][0],pairs[0][1]),"%s and ID %s" % (pairs[1][0],pairs[1][1]))
Exemplo n.º 18
0
 def rep_old(self,cleanup=0):
     if not cleanup:
         try:
             cmd.set("suspend_updates",1,quiet=1)
             cmd.disable()
             cmd.delete("pept")
             cmd.delete("pept_dist")
             cmd.load("$PYMOL_DATA/demo/pept.pdb")
             cmd.show("sticks","(pept and not i;5:7)")
             cmd.show("surface","(pept and i;5,6)")
             cmd.show("mesh","(pept and i;1,11,12,13)")
             cmd.show("spheres","(?pept & resi 2+12+9+4 &! name C+N+O+CA)")
             cmd.show("dots","(i;8)")
             cmd.dist("pept_dist","(pept and i;1&n;OD2)","(pept and i;13&n;OG1)")
             cmd.set("dot_width","2");
         finally:
             cmd.set("suspend_updates",0,quiet=1)
     else:
         cmd.delete("pept")
         cmd.delete("pept_dist")
Exemplo n.º 19
0
 def rep_old(self,cleanup=0):
     if not cleanup:
         try:
             cmd.set("suspend_updates",1,quiet=1)
             cmd.disable()
             cmd.delete("pept")
             cmd.delete("pept_dist")
             cmd.load("$PYMOL_DATA/demo/pept.pdb")
             cmd.show("sticks","(pept and not i;5:7)")
             cmd.show("surface","(pept and i;5,6)")
             cmd.show("mesh","(pept and i;1,11,12,13)")
             cmd.show("spheres","(?pept & resi 2+12+9+4 &! name C+N+O+CA)")
             cmd.show("dots","(i;8)")
             cmd.dist("pept_dist","(pept and i;1&n;OD2)","(pept and i;13&n;OG1)")
             cmd.set("dot_width","2");
         finally:
             cmd.set("suspend_updates",0,quiet=1)
     else:
         cmd.delete("pept")
         cmd.delete("pept_dist")
Exemplo n.º 20
0
 receptor = receptor_pdb.replace(".pdb", "")
 cmd.load(WORKDIR + "/" + receptor_pdb)
 ligname_pattern = receptor.replace("receptor1",
                                    "ligand[0-9]+") + ".pdb"
 ligpdb_list = list_files(WORKDIR, ligname_pattern, full_path=False)
 ligmol_list = [m.replace(".pdb", "") for m in ligpdb_list]
 cmd.set('h_bond_max_angle', 30)
 cmd.set('h_bond_cutoff_center', 3.6)
 cmd.set('h_bond_cutoff_edge', 3.2)
 for ligpdb in ligpdb_list:
     cmd.load(WORKDIR + "/" + ligpdb)
     ligmol = ligpdb.replace(".pdb", "")
     # contacts = cmd.dist('contacts', ligmol, receptor + " resid " + resids, 3.5, mode=2)
     cont399 = cmd.dist('cont399',
                        ligmol,
                        receptor + " and resid 399",
                        3.5,
                        mode=2)
     cont402 = cmd.dist('cont402',
                        ligmol,
                        receptor + " and resid 402",
                        3.5,
                        mode=2)
     cont403 = cmd.dist('cont403',
                        ligmol,
                        receptor + " and resid 403",
                        3.5,
                        mode=2)
     cont404 = cmd.dist('cont404',
                        ligmol,
                        receptor + " and resid 404",
Exemplo n.º 21
0
def fSumWSC(molecule, SGNameAngle, chain, residue, DieElecSC, SCchargeASP, SCchargeGLU, SCchargeOXT, SCchargeARG, SCchargeHIS, SCchargeLYS, SCchargeMET1, printSC):
    SumWSC = 0.0
    SGnameselect = "/" + SGNameAngle + "//" + "/" + "/SG"
    # Sidechain ASP
    nameselect = "/" + molecule + " and resn ASP and name CG and not resi " + residue
    cmd.select("SC", nameselect)
    SClist = cmd.identify("SC")
    for i in range(len(SClist)):
        ResDist = cmd.dist(residue + 'distASP', SGnameselect, molecule + " and id " + str(SClist[i]))
        WSC = fWSC(SCchargeASP, DieElecSC, ResDist)
        SumWSC = SumWSC + WSC
        if printSC == 'yes':
            print("SC ASP ", str(SClist[i]), " ", SCchargeASP, " ", DieElecSC, " ", ResDist, " ", WSC)
    cmd.delete(residue + 'distASP')
    # Sidechain GLU
    nameselect = "/" + molecule + " and resn GLU and name CD and not resi " + residue
    cmd.select("SC", nameselect)
    SClist = cmd.identify("SC")
    for i in range(len(SClist)):
        ResDist = cmd.dist(residue + 'distGLU', SGnameselect, molecule + " and id " + str(SClist[i]))
        WSC = fWSC(SCchargeGLU, DieElecSC, ResDist)
        SumWSC = SumWSC + WSC
        if printSC == 'yes':
            print("SC GLU ", str(SClist[i]), " ", SCchargeGLU, " ", DieElecSC, " ", ResDist, " ", WSC)
    cmd.delete(residue + 'distGLU')
    # print "GLU", cmd.count_atoms("SC"), SumWSC
    # Sidechain OXT
    nameselect = "/" + molecule + " and byres name OXT and not resi " + residue
    cmd.select("SC", nameselect)
    cmd.select("SC", "SC and name C")
    SClist = cmd.identify("SC")
    for i in range(len(SClist)):
        ResDist = cmd.dist(residue + 'distOXT', SGnameselect, molecule + " and id " + str(SClist[i]))
        WSC = fWSC(SCchargeOXT, DieElecSC, ResDist)
        SumWSC = SumWSC + WSC
        if printSC == 'yes':
            print("SC OXT ", str(SClist[i]), " ", SCchargeOXT, " ", DieElecSC, " ", ResDist, " ", WSC)
    cmd.delete(residue + 'distOXT')
    # print "OXT", cmd.count_atoms("SC"), SumWSC
    # Sidechain ARG
    nameselect = "/" + molecule + " and resn ARG and name CZ and not resi " + residue
    cmd.select("SC", nameselect)
    SClist = cmd.identify("SC")
    for i in range(len(SClist)):
        ResDist = cmd.dist(residue + 'distARG', SGnameselect, molecule + " and id " + str(SClist[i]))
        WSC = fWSC(SCchargeARG, DieElecSC, ResDist)
        SumWSC = SumWSC + WSC
        if printSC == 'yes':
            print("SC ARG ", str(SClist[i]), " ", SCchargeARG, " ", DieElecSC, " ", ResDist, " ", WSC)
    cmd.delete(residue + 'distARG')
    # print "ARG", cmd.count_atoms("SC"), SumWSC
    # Sidechain HIS
    nameselect = "/" + molecule + " and resn HIS and name CD2 and not resi " + residue
    cmd.select("SC", nameselect)
    SClist = cmd.identify("SC")
    for i in range(len(SClist)):
        ResDist = cmd.dist(residue + 'distHIS', SGnameselect, molecule + " and id " + str(SClist[i]))
        WSC = fWSC(SCchargeHIS, DieElecSC, ResDist)
        SumWSC = SumWSC + WSC
        if printSC == 'yes':
            print("SC HIS ", str(SClist[i]), " ", SCchargeHIS, " ", DieElecSC, " ", ResDist, " ", WSC)
    cmd.delete(residue + 'distHIS')
    # print "HIS", cmd.count_atoms("SC"), SumWSC
    # Sidechain LYS
    nameselect = "/" + molecule + " and resn LYS and name NZ and not resi " + residue
    cmd.select("SC", nameselect)
    SClist = cmd.identify("SC")
    for i in range(len(SClist)):
        ResDist = cmd.dist(residue + 'distLYS', SGnameselect, molecule + " and id " + str(SClist[i]))
        WSC = fWSC(SCchargeLYS, DieElecSC, ResDist)
        SumWSC = SumWSC + WSC
        if printSC == 'yes':
            print("SC LYS ", str(SClist[i]), " ", SCchargeLYS, " ", DieElecSC, " ", ResDist, " ", WSC)
    cmd.delete(residue + 'distLYS')
    # print "LYS", cmd.count_atoms("SC"), SumWSC
    # Sidechain MET1
    nameselect = "/" + molecule + " and resn MET and res 1 and not resi " + residue
    cmd.select("SC", nameselect)
    cmd.select("SC", "SC and name N")
    SClist = cmd.identify("SC")
    for i in range(len(SClist)):
        ResDist = cmd.dist(residue + 'distMET1', SGnameselect, molecule + " and id " + str(SClist[i]))
        WSC = fWSC(SCchargeMET1, DieElecSC, ResDist)
        SumWSC = SumWSC + WSC
        if printSC == 'yes':
            print("SC MET1 ", str(SClist[i]), " ", SCchargeMET1, " ", DieElecSC, " ", ResDist, " ", WSC)
    cmd.delete(residue + 'distMET1')
    # print "MET1", cmd.count_atoms("SC"), SumWSC
    cmd.delete("SC")
    return SumWSC
Exemplo n.º 22
0
#cmd.delete("all")
#cmd.load("2bem.pdb")

#cmd.color("white") # Pro jistotu
#cmd.show("lines")

cmd.select("cis", "resn CYS")
cmd.color("yellow", "cis")

list_of_bonds = []

# Projdi atom po atomu
for a_mol in cmd.index("CYS/SG", "cis"):
    for b_mol in cmd.index("CYS/SG", "cis"):
        if a_mol[1] < b_mol[1]:  # Neprchazej molekuly ktere uz mam
            if cmd.dist("tmp", a_mol, b_mol) < MAX_DIST:  # Seber Vzdalenost
                print "dist(" + str(b_mol[1]) + ", " + str(
                    a_mol[1]) + ") = " + str(cmd.dist("result", a_mol, b_mol))
                list_of_bonds.append(a_mol[1])
                list_of_bonds.append(b_mol[1])
                cmd.select(
                    "sulfidy",
                    "?sulfidy | (" + a_mol[0] + "`" + str(a_mol[1]) + ")")
                cmd.select(
                    "sulfidy",
                    "?sulfidy | (" + b_mol[0] + "`" + str(b_mol[1]) + ")")
            cmd.delete("tmp")
if len(list_of_bonds) > 0:
    cmd.color("orange", "sulfidy")

    # Jsem prase and i know it
Exemplo n.º 23
0
     0.399889141,   -0.795006156,   -0.456119299,\
    -0.090745762,   -0.529538393,    0.843419492,\
     0.000087761,   -0.000581503, -183.590560913,\
     8.321296692,  -66.967765808,  -33.590000153,\
   -36.799331665,  403.937011719,  -20.000000000'                                                  )

# constants
cutoff = 2

# Load the edges from file
with open(edgepath, 'r') as fin:
    data = fin.readlines()
edges = [line.strip().split() for line in data]

for n, e in enumerate(edges):
    t = cmd.dist('dist'+str(n),'3H4E//A/'+e[0]+'/CA',\
  '3H4E//A/'+e[1]+'/CA')

    if t < cutoff:
        cmd.delete('dist' + str(n))
    else:
        cmd.color('blue', 'dist' + str(n))
        cmd.hide('labels', 'dist' + str(n))
        cmd.show('spheres', '3H4E//A/' + e[0] + '/CA')
        cmd.show('spheres', '3H4E//A/' + e[1] + '/CA')
        cmd.color('yellow', '3H4E//A/' + e[0] + '/CA')
        cmd.color('yellow', '3H4E//A/' + e[1] + '/CA')

cmd.set('dash_radius', '0.2')
cmd.set('dash_gap', '0.0')
cmd.set('sphere_scale', '0.3')
#cmd.set('sphere_scale','0.8','retinal');
Exemplo n.º 24
0
        # PRESKOC TO CO UZ MAME
        if (int(atom_a.resi)) <= (int(atom_b.resi) + 1):  # +1  PRESKOC SUSEDA
            continue

        dist = sqrt((atom_a.coord[0] - atom_b.coord[0])**2 +
                    (atom_a.coord[1] - atom_b.coord[1])**2 +
                    (atom_a.coord[2] - atom_b.coord[2])**2)
        if maximal < dist:
            maximal = dist
            max_atom_a = atom_a
            max_atom_b = atom_b
        if dist < minimal:
            minimal = dist
            min_atom_a = atom_a
            min_atom_b = atom_b

print "MAX distance: " + str(maximal) + " " + "[" + str(
    max_atom_a.index) + ", " + str(max_atom_b.index) + "]"
print "MIN distance: " + str(minimal) + " " + "[" + str(
    min_atom_a.index) + ", " + str(min_atom_b.index) + "]"
cmd.dist("MAX_DISTANCE",
         cmd.index("index " + str(max_atom_a.index))[0],
         cmd.index("index " + str(max_atom_b.index))[0])
cmd.dist("MIN_DISTANCE",
         cmd.index("index " + str(min_atom_a.index))[0],
         cmd.index("index " + str(min_atom_b.index))[0])
cmd.color("orange", "MIN_DISTANCE")
cmd.color("white", "MAX_DISTANCE")

#"""
Exemplo n.º 25
0
    -0.090745762,   -0.529538393,    0.843419492,\
     0.000087761,   -0.000581503, -183.590560913,\
     8.321296692,  -66.967765808,  -33.590000153,\
   -36.799331665,  403.937011719,  -20.000000000' )

# constants
cutoff = 2

# Load the edges from file
with open(edgepath,'r') as fin : 
    data = fin.readlines();
edges = [line.strip().split() for line in data]


for n,e in  enumerate(edges) : 
    t = cmd.dist('dist'+str(n),'3H4E//A/'+e[0]+'/CA',\
		'3H4E//A/'+e[1]+'/CA')

    if t < cutoff  : 
        cmd.delete('dist'+str(n)) 
    else : 
        cmd.color('blue','dist'+str(n))
        cmd.hide('labels','dist'+str(n))
        cmd.show('spheres','3H4E//A/'+e[0]+'/CA')
        cmd.show('spheres','3H4E//A/'+e[1]+'/CA')
        cmd.color('yellow','3H4E//A/'+e[0]+'/CA')
        cmd.color('yellow','3H4E//A/'+e[1]+'/CA')

cmd.set('dash_radius','0.2');
cmd.set('dash_gap','0.0');
cmd.set('sphere_scale','0.3')
#cmd.set('sphere_scale','0.8','retinal');
Exemplo n.º 26
0
def fSumWSC(molecule, SGNameAngle, chain, residue, DieElecSC, SCchargeASP,
            SCchargeGLU, SCchargeOXT, SCchargeARG, SCchargeHIS, SCchargeLYS,
            SCchargeMET1, printSC):
    SumWSC = 0.0
    SGnameselect = "/" + SGNameAngle + "//" + "/" + "/SG"
    # Sidechain ASP
    nameselect = "/" + molecule + " and resn ASP and name CG and not resi " + residue
    cmd.select("SC", nameselect)
    SClist = cmd.identify("SC")
    for i in range(len(SClist)):
        ResDist = cmd.dist(residue + 'distASP', SGnameselect,
                           molecule + " and id " + str(SClist[i]))
        WSC = fWSC(SCchargeASP, DieElecSC, ResDist)
        SumWSC = SumWSC + WSC
        if printSC == 'yes':
            print("SC ASP ", str(SClist[i]), " ", SCchargeASP, " ", DieElecSC,
                  " ", ResDist, " ", WSC)
    cmd.delete(residue + 'distASP')
    # Sidechain GLU
    nameselect = "/" + molecule + " and resn GLU and name CD and not resi " + residue
    cmd.select("SC", nameselect)
    SClist = cmd.identify("SC")
    for i in range(len(SClist)):
        ResDist = cmd.dist(residue + 'distGLU', SGnameselect,
                           molecule + " and id " + str(SClist[i]))
        WSC = fWSC(SCchargeGLU, DieElecSC, ResDist)
        SumWSC = SumWSC + WSC
        if printSC == 'yes':
            print("SC GLU ", str(SClist[i]), " ", SCchargeGLU, " ", DieElecSC,
                  " ", ResDist, " ", WSC)
    cmd.delete(residue + 'distGLU')
    # print "GLU", cmd.count_atoms("SC"), SumWSC
    # Sidechain OXT
    nameselect = "/" + molecule + " and byres name OXT and not resi " + residue
    cmd.select("SC", nameselect)
    cmd.select("SC", "SC and name C")
    SClist = cmd.identify("SC")
    for i in range(len(SClist)):
        ResDist = cmd.dist(residue + 'distOXT', SGnameselect,
                           molecule + " and id " + str(SClist[i]))
        WSC = fWSC(SCchargeOXT, DieElecSC, ResDist)
        SumWSC = SumWSC + WSC
        if printSC == 'yes':
            print("SC OXT ", str(SClist[i]), " ", SCchargeOXT, " ", DieElecSC,
                  " ", ResDist, " ", WSC)
    cmd.delete(residue + 'distOXT')
    # print "OXT", cmd.count_atoms("SC"), SumWSC
    # Sidechain ARG
    nameselect = "/" + molecule + " and resn ARG and name CZ and not resi " + residue
    cmd.select("SC", nameselect)
    SClist = cmd.identify("SC")
    for i in range(len(SClist)):
        ResDist = cmd.dist(residue + 'distARG', SGnameselect,
                           molecule + " and id " + str(SClist[i]))
        WSC = fWSC(SCchargeARG, DieElecSC, ResDist)
        SumWSC = SumWSC + WSC
        if printSC == 'yes':
            print("SC ARG ", str(SClist[i]), " ", SCchargeARG, " ", DieElecSC,
                  " ", ResDist, " ", WSC)
    cmd.delete(residue + 'distARG')
    # print "ARG", cmd.count_atoms("SC"), SumWSC
    # Sidechain HIS
    nameselect = "/" + molecule + " and resn HIS and name CD2 and not resi " + residue
    cmd.select("SC", nameselect)
    SClist = cmd.identify("SC")
    for i in range(len(SClist)):
        ResDist = cmd.dist(residue + 'distHIS', SGnameselect,
                           molecule + " and id " + str(SClist[i]))
        WSC = fWSC(SCchargeHIS, DieElecSC, ResDist)
        SumWSC = SumWSC + WSC
        if printSC == 'yes':
            print("SC HIS ", str(SClist[i]), " ", SCchargeHIS, " ", DieElecSC,
                  " ", ResDist, " ", WSC)
    cmd.delete(residue + 'distHIS')
    # print "HIS", cmd.count_atoms("SC"), SumWSC
    # Sidechain LYS
    nameselect = "/" + molecule + " and resn LYS and name NZ and not resi " + residue
    cmd.select("SC", nameselect)
    SClist = cmd.identify("SC")
    for i in range(len(SClist)):
        ResDist = cmd.dist(residue + 'distLYS', SGnameselect,
                           molecule + " and id " + str(SClist[i]))
        WSC = fWSC(SCchargeLYS, DieElecSC, ResDist)
        SumWSC = SumWSC + WSC
        if printSC == 'yes':
            print("SC LYS ", str(SClist[i]), " ", SCchargeLYS, " ", DieElecSC,
                  " ", ResDist, " ", WSC)
    cmd.delete(residue + 'distLYS')
    # print "LYS", cmd.count_atoms("SC"), SumWSC
    # Sidechain MET1
    nameselect = "/" + molecule + " and resn MET and res 1 and not resi " + residue
    cmd.select("SC", nameselect)
    cmd.select("SC", "SC and name N")
    SClist = cmd.identify("SC")
    for i in range(len(SClist)):
        ResDist = cmd.dist(residue + 'distMET1', SGnameselect,
                           molecule + " and id " + str(SClist[i]))
        WSC = fWSC(SCchargeMET1, DieElecSC, ResDist)
        SumWSC = SumWSC + WSC
        if printSC == 'yes':
            print("SC MET1 ", str(SClist[i]), " ", SCchargeMET1, " ",
                  DieElecSC, " ", ResDist, " ", WSC)
    cmd.delete(residue + 'distMET1')
    # print "MET1", cmd.count_atoms("SC"), SumWSC
    cmd.delete("SC")
    return SumWSC
Exemplo n.º 27
0

fname = sys.argv[1]

with open(fname) as fin : 
	lines = fin.readlines()

tuples_list = []
for line in  lines : 
	tuples_list.append((line.split()[0],line.split()[2:]))

#lines = [(line.split()[0],line.split()[2:]) for line in lines ]

row = ('ASD00280000',
 ['subtilis',
  'site,339,Lys@@range,251,257,loop@@site,316,Lys@@site,318,Arg@@site,317,Asn'])

site_line = row[1][1]
nums = re.findall('\d+',site_line)

nicks_nums = [13,127,29,45]

#----------------------------------------------------------------------
# Pymol specific code

cmd.load('ASD00250000_3.pdb')
cmd.dist('resi '+str(nicks_nums[0]),', resi '+str(nicks_nums[1]))



Exemplo n.º 28
0
cmd.spectrum(palette = 'green_red', selection = '1F88 and chain A')
cmd.select('retinal','1F88 and het and chain A and resn ret')
cmd.show('spheres','retinal')
cmd.color('magenta','retinal')

# constants
cutoff = 2

# Load the edges from file
with open(edgepath,'r') as fin : 
    data = fin.readlines();
edges = [line.strip().split() for line in data]


for n,e in  enumerate(edges) : 
    t = cmd.dist('dist'+str(n),'1F88//A/'+e[0]+'/CA',\
		'1F88//A/'+e[1]+'/CA')

    if t < cutoff  : 
        cmd.delete('dist'+str(n)) 
    else : 
        cmd.color('blue','dist'+str(n))
        cmd.hide('labels','dist'+str(n))
        cmd.show('spheres','1F88//A/'+e[0]+'/CA')
        cmd.show('spheres','1F88//A/'+e[1]+'/CA')
        cmd.color('yellow','1F88//A/'+e[0]+'/CA')
        cmd.color('yellow','1F88//A/'+e[1]+'/CA')

cmd.set('dash_radius','0.2');
cmd.set('dash_gap','0.0');
cmd.set('sphere_scale','0.3')
cmd.set('sphere_scale','0.8','retinal');
Exemplo n.º 29
0
# constants
cutoff = 2

# Load the edges from file
with open(edgepath,'r') as fin : 
    data = fin.readlines();
edges = [line.strip().split() for line in data]

chains = ['A','B','C','D','E','F']



for n,e in  enumerate(edges) : 
    for ch in chains : 
       t = cmd.dist('dist'+ch+str(n),'3H4E//'+ch+'/'+e[0]+'/CA',\
		'3H4E//'+ch+'/'+e[1]+'/CA')

       if t < cutoff  : 
           cmd.delete('dist'+ch+str(n)) 
       else : 
           cmd.color('blue','dist'+ch+str(n))
           cmd.hide('labels','dist'+ch+str(n))
           cmd.show('spheres','3H4E//'+ch+'/'+e[0]+'/CA')
           cmd.show('spheres','3H4E//'+ch+'/'+e[1]+'/CA')
           cmd.color('yellow','3H4E//'+ch+'/'+e[0]+'/CA')
           cmd.color('yellow','3H4E//'+ch+'/'+e[1]+'/CA')

# Create a set of residues
set_res = []
for e_tup in edges : 
	set_res.extend(e_tup)
Exemplo n.º 30
0
        continue
    cmd.select("polar_atoms", "e. O or e. N or e. S")
    model_halogen = cmd.get_model(
        "halogen")  # create model for halogen selection
    for halo in model_halogen.atom:
        cmd.select("current_halogen", "id %s" % (halo.id))
        #cmd.select("current_neighbor", "current_halogen extend 1")
        #cmd.select("current_neighbor", "current_neighbor and not current_halogen")
        cmd.select("current_neighbor", "neighbor current_halogen")

        cmd.select("current_surroundings", "current_halogen expand 5.0")
        cmd.select("current_surroundings",
                   "current_surroundings and bindingsite")
        cmd.select("current_polar", "current_surroundings and polar_atoms")
        polar_distance = cmd.dist("polar_contacts",
                                  "ligand",
                                  "polar_atoms",
                                  mode=2)
        print("Polar contact: ")
        print polar_distance, halo.name, halo.resn, halo.resi
        model_polar = cmd.get_model("current_polar")
        for pol in model_polar.atom:
            cmd.select("current_polar", "id %s" % (pol.id))
            # check for halogen bonds, distances 5.0, angles: > 140
            current_distance = cmd.distance("current_distance",
                                            "current_halogen", "current_polar")
            current_angle = cmd.angle("current_angle", "current_neighbor",
                                      "current_halogen", "current_polar")

            if (current_angle >= 140) and (current_distance <= 5.0):
                print("Halogen bond: ")
                print current_distance, current_angle, pol.name, pol.resn, pol.resi
from pymol import cmd
from glob import glob
 
for file in glob("*.pdb"):
    print file
    cmd.load(file,'prot')
    for a in cmd.index("elem s and bound_to elem s"):
        if cmd.select("s1","%s`%d"%a) and \
           cmd.select("s2","elem s and bound_to %s`%d"%a):
            if cmd.select("(s1|s2) and not ?skip"):
                cmd.iterate("s1|s2","print ' ',chain,resn,resi,name")
                print '   ',round(cmd.dist("tmp","s1","s2"),3)
                cmd.select("skip","s1|s2|?skip")
    cmd.delete("all")

Exemplo n.º 32
0
def fSumWMC(molecule, SGNameAngle, chain, residue, MCNeighbour, DieElecMC,
            MCchargeC, MCchargeO, MCchargeN, MCchargeH, MCchargeProCA,
            MCchargeProCD, MCchargeProN, AmideName, printMC):
    # print "chain", MCNeighbour
    SumWMC = 0.0
    SGnameselect = "/" + SGNameAngle + "//" + "/" + "/SG"
    NBnameselect = "/" + molecule + "//" + chain + "/" + str(MCNeighbour)
    cmd.select("MC", NBnameselect)
    MCpdbstr = cmd.get_pdbstr("MC")
    MCsplit = MCpdbstr.split()
    residueName = MCsplit[3]
    # print NBnameselect, residueName
    if residueName == "PRO":
        # Proline CA
        CAnameselect = "/" + molecule + "//" + chain + "/" + str(
            MCNeighbour) + "/CA"
        ResDist = cmd.dist(residue + 'distProCA', SGnameselect, CAnameselect)
        WMC = fWMC(MCchargeProCA, DieElecMC, ResDist)
        SumWMC = SumWMC + WMC
        if printMC == 'yes':
            print("MC ProCA ", MCNeighbour, " ", MCchargeProCA, " ", DieElecMC,
                  " ", ResDist, " ", WMC)
        # Proline CD
        CDnameselect = "/" + molecule + "//" + chain + "/" + str(
            MCNeighbour) + "/CD"
        ResDist = cmd.dist(residue + 'distProCD', SGnameselect, CDnameselect)
        WMC = fWMC(MCchargeProCD, DieElecMC, ResDist)
        SumWMC = SumWMC + WMC
        if printMC == 'yes':
            print("MC ProCD ", MCNeighbour, " ", MCchargeProCD, " ", DieElecMC,
                  " ", ResDist, " ", WMC)
        # Proline N
        Nnameselect = "/" + molecule + "//" + chain + "/" + str(
            MCNeighbour) + "/N"
        ResDist = cmd.dist(residue + 'distProN', SGnameselect, Nnameselect)
        WMC = fWMC(MCchargeProN, DieElecMC, ResDist)
        SumWMC = SumWMC + WMC
        if printMC == 'yes':
            print("MC ProN ", MCNeighbour, " ", MCchargeProN, " ", DieElecMC,
                  " ", ResDist, " ", WMC)
        # Proline C
        Cnameselect = "/" + molecule + "//" + chain + "/" + str(
            MCNeighbour) + "/C"
        ResDist = cmd.dist(residue + 'distProC', SGnameselect, Cnameselect)
        WMC = fWMC(MCchargeC, DieElecMC, ResDist)
        SumWMC = SumWMC + WMC
        if printMC == 'yes':
            print("MC ProC ", MCNeighbour, " ", MCchargeC, " ", DieElecMC, " ",
                  ResDist, " ", WMC)
        # Proline O
        Onameselect = "/" + molecule + "//" + chain + "/" + str(
            MCNeighbour) + "/O"
        ResDist = cmd.dist(residue + 'distProO', SGnameselect, Onameselect)
        WMC = fWMC(MCchargeO, DieElecMC, ResDist)
        SumWMC = SumWMC + WMC
        if printMC == 'yes':
            print("MC ProO ", MCNeighbour, " ", MCchargeO, " ", DieElecMC, " ",
                  ResDist, " ", WMC)
    else:
        AmideProt = "/" + molecule + "//" + chain + "/" + str(
            MCNeighbour) + "/H01"
        Hnameselect = "/" + AmideName + "//" + chain + "/" + str(
            MCNeighbour) + "/H01"
        if cmd.count_atoms(AmideProt) == 0 and cmd.count_atoms(
                Hnameselect) == 0:
            HbuildSelect = "/" + molecule + "//" + chain + "/" + str(
                MCNeighbour) + "/N"
            cmd.h_add(HbuildSelect)
            cmd.create(AmideName, AmideName + " + " + AmideProt)
            cmd.remove(AmideProt)
        # Mainchain AmideH
        ResDist = cmd.dist(residue + 'distH', SGnameselect, Hnameselect)
        WMC = fWMC(MCchargeH, DieElecMC, ResDist)
        SumWMC = SumWMC + WMC
        if printMC == 'yes':
            print("MC H ", MCNeighbour, " ", MCchargeH, " ", DieElecMC, " ",
                  ResDist, " ", WMC)
        # Mainchain C
        Cnameselect = "/" + molecule + "//" + chain + "/" + str(
            MCNeighbour) + "/C"
        ResDist = cmd.dist(residue + 'distC', SGnameselect, Cnameselect)
        WMC = fWMC(MCchargeC, DieElecMC, ResDist)
        SumWMC = SumWMC + WMC
        if printMC == 'yes':
            print("MC C ", MCNeighbour, " ", MCchargeC, " ", DieElecMC, " ",
                  ResDist, " ", WMC)
        # Mainchain O
        Onameselect = "/" + molecule + "//" + chain + "/" + str(
            MCNeighbour) + "/O"
        ResDist = cmd.dist(residue + 'distO', SGnameselect, Onameselect)
        WMC = fWMC(MCchargeO, DieElecMC, ResDist)
        SumWMC = SumWMC + WMC
        if printMC == 'yes':
            print("MC O ", MCNeighbour, " ", MCchargeO, " ", DieElecMC, " ",
                  ResDist, " ", WMC)
        # Mainchain N
        Nnameselect = "/" + molecule + "//" + chain + "/" + str(
            MCNeighbour) + "/N"
        ResDist = cmd.dist(residue + 'distN', SGnameselect, Nnameselect)
        WMC = fWMC(MCchargeN, DieElecMC, ResDist)
        SumWMC = SumWMC + WMC
        if printMC == 'yes':
            print("MC N ", MCNeighbour, " ", MCchargeN, " ", DieElecMC, " ",
                  ResDist, " ", WMC)
    cmd.delete(residue + 'distProCA')
    cmd.delete(residue + 'distProCD')
    cmd.delete(residue + 'distProN')
    cmd.delete(residue + 'distProC')
    cmd.delete(residue + 'distProO')
    cmd.delete(residue + 'distH')
    cmd.delete(residue + 'distC')
    cmd.delete(residue + 'distO')
    cmd.delete(residue + 'distN')
    cmd.show("nb_spheres", AmideName)
    cmd.delete("MC")
    return SumWMC
# customize these lines to your protein.
cmd.fetch("6NEC")
cmd.select("prot","not resn XIN and not resn HOH and not chain C")
cmd.select("lig", "resn XIN and not chain C")

dist_list = {
pro_atoms = cmd.get_model("prot")
lig_atoms = cmd.get_model("lig")

for l_at in lig_atoms.atom:
    for p_at in pro_atoms.atom:
        dist_list[str(l_at.resn) +
                     ":" +
                      str(l_at.resi) +
                      " " +
                      l_at.name +
                      " ---- " + 
                      str(p_at.resn) +
                      ":" +
                      str(p_at.resi) +
                      " " +
                      p_at.name] = cmd.dist("foo", 
                                            "index " +
                                            str(l_at.index),"index " + str(p_at.index))
        cmd.delete("foo")
print("List of all pairwise ligand--protein atom-atom distances:")
# [print("Distance of " + d + " is " + str(dist_list[d])) for d in dist_list.keys()]

# More compact print statement. Need an f-string format statement.
[print( d + " " + str(dist_list[d])) for d in dist_list.keys()]