Expand To Surface: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
= Example = | = Example = | ||
<source lang="python"> | <source lang="python"> | ||
# in PyMOL type the following | |||
# fetch 1cll | # fetch 1cll | ||
fetch 1cll | fetch 1cll | ||
Line 22: | Line 24: | ||
</source> | </source> | ||
You can make fake data in a shell by quickly executing: | |||
<source lang="python"> | |||
# in a BASH shell, type the following | |||
for ((i=0; i<144; i++)); do echo $RANDOM.$RANDOM >> /tmp/bb; done | |||
</source> | |||
= The Code = | = The Code = | ||
Line 56: | Line 64: | ||
cmd.extend("e2s", e2s); | cmd.extend("e2s", e2s); | ||
</source> | </source> | ||
= See Also = | |||
* [[alphaToAll]] | |||
* [[surface]] | |||
* [[isomesh]] | |||
* [[isosurface]] | |||
* [[ramp_new]] | |||
* [[map_new]] | |||
[[Category:Script_Library|Expand to Surface]] | [[Category:Script_Library|Expand to Surface]] | ||
[[Category:ObjSel_Scripts]] |
Latest revision as of 17:11, 28 June 2010
Overview
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.
Note: This script, once run in PyMOL, is called e2s. See examples, below.
Example
# in PyMOL type the following
# fetch 1cll
fetch 1cll
# load your b-factor column; for "1cll" you can simulate fake data
# by writing 144 random integers to /tmp/bb. If you have some real
# data, then put that there. 1 row for each alpha carbon.
f = open('/tmp/bb', 'r').readlines();
# alter the alpha carbon coords
alter *,b=0
alter n. CA, b=f.pop(0)
# color the surface
e2s 1cll
You can make fake data in a shell by quickly executing:
# in a BASH shell, type the following
for ((i=0; i<144; i++)); do echo $RANDOM.$RANDOM >> /tmp/bb; done
The Code
##########################################################
#
# Expand_to_surface (e2s): Expands alpha-carbon-only
# b-factor coloring to an entire surface of the protein
# of your choice.
#
# AUTHOR: Jason Vertrees -- Python code; Warren DeLano,
# the original code.
#
# COPYRIGHT: BSDL. Feel free to use it.
#
# DATE: 2007-12-03
#
##########################################################
from pymol import cmd
def e2s(sel):
"""
e2s: Expand to surface
e2s will color a surface based upon the b-factors
from the alpha carbons in your selection.
usage: e2s protName
"""
cmd.create("ca_obj", sel + " and n. CA" )
cmd.ramp_new("ramp_obj", "ca_obj", [0, 10], [-1, -1, 0] );
cmd.set("surface_color", "ramp_obj", sel )
cmd.extend("e2s", e2s);