https://wiki.pymol.org/index.php?title=Expand_To_Surface&feed=atom&action=historyExpand To Surface - Revision history2024-03-29T10:15:03ZRevision history for this page on the wikiMediaWiki 1.35.1https://wiki.pymol.org/index.php?title=Expand_To_Surface&diff=5833&oldid=prevPyadmin: 7 revisions2014-03-28T01:46:41Z<p>7 revisions</p>
<p><b>New page</b></p><div>= Overview =<br />
This little script will color the surface of your protein the same color as the b-factors from the alpha carbons of each amino acid. This script is useful when you want to color a protein by the b-factor column, but all you have in the b-factor for each alpha carbon. If you try to color a surface based only on the alpha carbon b-factors, then the surface isn't rendered as you typically want.<br />
<br />
'''Note:''' This script, once run in PyMOL, is called '''e2s'''. See examples, below.<br />
<br />
= Example =<br />
<source lang="python"><br />
# in PyMOL type the following<br />
<br />
# fetch 1cll<br />
fetch 1cll<br />
<br />
# load your b-factor column; for "1cll" you can simulate fake data<br />
# by writing 144 random integers to /tmp/bb. If you have some real<br />
# data, then put that there. 1 row for each alpha carbon.<br />
f = open('/tmp/bb', 'r').readlines();<br />
<br />
# alter the alpha carbon coords<br />
alter *,b=0<br />
alter n. CA, b=f.pop(0)<br />
<br />
# color the surface<br />
e2s 1cll<br />
</source><br />
<br />
You can make fake data in a shell by quickly executing:<br />
<source lang="python"><br />
# in a BASH shell, type the following<br />
<br />
for ((i=0; i<144; i++)); do echo $RANDOM.$RANDOM >> /tmp/bb; done<br />
</source><br />
<br />
= The Code =<br />
<source lang="python"><br />
##########################################################<br />
#<br />
# Expand_to_surface (e2s): Expands alpha-carbon-only <br />
# b-factor coloring to an entire surface of the protein<br />
# of your choice.<br />
#<br />
# AUTHOR: Jason Vertrees -- Python code; Warren DeLano,<br />
# the original code.<br />
#<br />
# COPYRIGHT: BSDL. Feel free to use it.<br />
#<br />
# DATE: 2007-12-03<br />
#<br />
##########################################################<br />
from pymol import cmd<br />
def e2s(sel):<br />
"""<br />
e2s: Expand to surface<br />
<br />
e2s will color a surface based upon the b-factors<br />
from the alpha carbons in your selection.<br />
<br />
usage: e2s protName<br />
"""<br />
<br />
cmd.create("ca_obj", sel + " and n. CA" )<br />
cmd.ramp_new("ramp_obj", "ca_obj", [0, 10], [-1, -1, 0] );<br />
cmd.set("surface_color", "ramp_obj", sel )<br />
<br />
cmd.extend("e2s", e2s);<br />
</source><br />
<br />
= See Also =<br />
* [[alphaToAll]]<br />
* [[surface]]<br />
* [[isomesh]]<br />
* [[isosurface]]<br />
* [[ramp_new]]<br />
* [[map_new]]<br />
<br />
<br />
[[Category:Script_Library|Expand to Surface]]<br />
[[Category:ObjSel_Scripts]]</div>Pyadmin