def mainchain(): #hide waters cmd.hide("(solvent and (all))") #hide cartoon cmd.hide("cartoon") cmd.hide("lines","not(name ca,c,n,o,h)") #show mainchain sticks cmd.show("sticks","((byres (all))&n;ca,c,n,o,h)") util.color_chains("(all and elem c)",_self=cmd)
def chaincleanup(): cmd.hide("(solvent and (all))") #cmd.hide("(all and hydro)") cmd.show("cartoon" ,"all") util.color_chains("(all and elem c)",_self=cmd) cmd.show("sticks","((byres (all))&n;ca,c,n,o,h)") cmd.hide("(all and hydro)") #cmd.set('cartoon_transparency','0.25') cmd.hide( 'sticks', 'elem H' ) cmd.hide( 'lines', 'elem H' )
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")
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")
def color_by_chains(): for obj in cmd.get_names('objects'): util.color_chains('%s and e. c' %obj)
def chain_cleanup(): cleanup() util.color_chains("(all and elem c)",_self=cmd)