<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.pymol.org/index.php?action=history&amp;feed=atom&amp;title=Expand_To_Surface</id>
	<title>Expand To Surface - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pymol.org/index.php?action=history&amp;feed=atom&amp;title=Expand_To_Surface"/>
	<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Expand_To_Surface&amp;action=history"/>
	<updated>2026-07-17T21:14:52Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Expand_To_Surface&amp;diff=5833&amp;oldid=prev</id>
		<title>Pyadmin: 7 revisions</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Expand_To_Surface&amp;diff=5833&amp;oldid=prev"/>
		<updated>2014-03-28T01:46:41Z</updated>

		<summary type="html">&lt;p&gt;7 revisions&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Overview =&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' This script, once run in PyMOL, is called '''e2s'''.  See examples, below.&lt;br /&gt;
&lt;br /&gt;
= Example =&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# in PyMOL type the following&lt;br /&gt;
&lt;br /&gt;
# fetch 1cll&lt;br /&gt;
fetch 1cll&lt;br /&gt;
&lt;br /&gt;
# load your b-factor column; for &amp;quot;1cll&amp;quot; you can simulate fake data&lt;br /&gt;
# by writing 144 random integers to /tmp/bb.  If you have some real&lt;br /&gt;
# data, then put that there.  1 row for each alpha carbon.&lt;br /&gt;
f = open('/tmp/bb', 'r').readlines();&lt;br /&gt;
&lt;br /&gt;
# alter the alpha carbon coords&lt;br /&gt;
alter *,b=0&lt;br /&gt;
alter n. CA, b=f.pop(0)&lt;br /&gt;
&lt;br /&gt;
# color the surface&lt;br /&gt;
e2s 1cll&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can make fake data in a shell by quickly executing:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# in a BASH shell, type the following&lt;br /&gt;
&lt;br /&gt;
for ((i=0; i&amp;lt;144; i++)); do echo $RANDOM.$RANDOM &amp;gt;&amp;gt; /tmp/bb; done&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= The Code =&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
##########################################################&lt;br /&gt;
#&lt;br /&gt;
# Expand_to_surface (e2s): Expands alpha-carbon-only &lt;br /&gt;
# b-factor coloring to an entire surface of the protein&lt;br /&gt;
# of your choice.&lt;br /&gt;
#&lt;br /&gt;
# AUTHOR: Jason Vertrees -- Python code; Warren DeLano,&lt;br /&gt;
#         the original code.&lt;br /&gt;
#&lt;br /&gt;
# COPYRIGHT: BSDL.  Feel free to use it.&lt;br /&gt;
#&lt;br /&gt;
# DATE: 2007-12-03&lt;br /&gt;
#&lt;br /&gt;
##########################################################&lt;br /&gt;
from pymol import cmd&lt;br /&gt;
def e2s(sel):&lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
        e2s: Expand to surface&lt;br /&gt;
&lt;br /&gt;
        e2s will color a surface based upon the b-factors&lt;br /&gt;
        from the alpha carbons in your selection.&lt;br /&gt;
&lt;br /&gt;
        usage: e2s protName&lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
        cmd.create(&amp;quot;ca_obj&amp;quot;, sel + &amp;quot; and n. CA&amp;quot; )&lt;br /&gt;
        cmd.ramp_new(&amp;quot;ramp_obj&amp;quot;, &amp;quot;ca_obj&amp;quot;, [0, 10], [-1, -1, 0] );&lt;br /&gt;
        cmd.set(&amp;quot;surface_color&amp;quot;, &amp;quot;ramp_obj&amp;quot;, sel )&lt;br /&gt;
&lt;br /&gt;
cmd.extend(&amp;quot;e2s&amp;quot;, e2s);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
* [[alphaToAll]]&lt;br /&gt;
* [[surface]]&lt;br /&gt;
* [[isomesh]]&lt;br /&gt;
* [[isosurface]]&lt;br /&gt;
* [[ramp_new]]&lt;br /&gt;
* [[map_new]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library|Expand to Surface]]&lt;br /&gt;
[[Category:ObjSel_Scripts]]&lt;/div&gt;</summary>
		<author><name>Pyadmin</name></author>
	</entry>
</feed>