Expand To Surface: Difference between revisions
Jump to navigation
Jump to search
(New page: = 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 co...) |
No edit summary |
||
Line 57: | Line 57: | ||
</source> | </source> | ||
[[Category: | [[Category:Script_Library|Expand to Surface]] |
Revision as of 16:29, 6 December 2007
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
# 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
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);