[Chimera-users] Coloring by bfactor
Thomas Goddard
goddard at cgl.ucsf.edu
Fri Apr 23 14:22:20 PDT 2004
Hi Padma,
We have developed a Chimera tool to color by bfactor or other attributes
but it is not yet released. We expect to have a new release in the middle of
May.
Here are a couple approaches you could use now.
You can use the color command like the following to color all atoms
with bfactor between 10 and 15 green.
color green @/bfactor>=10 and bfactor<=15
You could put a series of these commmands in a file to color several
intervals different colors to get a rainbow effect. Use the "open"
command to run the file of coloring commands.
A more flexible route is to use some Python code. Putting the code
shown below in a file bcolor.py and then opening this file will make a
rainbow coloring by bfactor for the selected atoms. A fancier version
of this could have a dialog popup to specify bfactor range and colors.
If you make a molecular surface with Actions/Surface/Show the default
coloring of this surface is to use the atom colors. So coloring the
atoms by any of the above means will allow you to get the same coloring
on a surface.
Tom
-----
code bcolor.py follows:
# -----------------------------------------------------------------------------
#
def color_atoms_by_bfactor(atoms, b0, rgb0, b1, rgb1):
for a in atoms:
if hasattr(a, 'bfactor'):
b = a.bfactor
if b < b0: f = 0
elif b < b1: f = (b - b0) / (b1 - b0)
else: f = 1
r,g,b = ((1-f)*rgb0[0] + f*rgb1[0],
(1-f)*rgb0[1] + f*rgb1[1],
(1-f)*rgb0[2] + f*rgb1[2])
import chimera
a.color = chimera.MaterialColor(r,g,b)
# -----------------------------------------------------------------------------
#
from chimera import selection
atoms = selection.currentAtoms() # currently selected atoms
b0 = 5
rgb0 = (0,0,1) # blue
b1 = 20
rgb1 = (1,0,0) # red
color_atoms_by_bfactor(atoms, b0, rgb0, b1, rgb1)
> To: Thomas Goddard <goddard at cgl.ucsf.edu>
> Subject: One more Chimera question!
> From: Padmaja Natarajan <nataraja at scripps.edu>
> Date: Fri, 23 Apr 2004 13:31:38 -0700
>
> Hi Tom,
>
> Is it possible to make a molecular surface based on PDB coordinates
> and be able to view this surface colored (as a spectrum going from blue
> for smallest to red for largest value),
> depending on values stored in say B-factor column of the PDB file.
> (as shown in figure below created using AVS)
>
> thanks again
> regards
> Padma
More information about the Chimera-users
mailing list