Dear PyMOLers,
I've revised the B-factor colouring script that I published on this list
back on May 24th. The function now allows you to choose the style of
colour ramp (blue-magenta-red or rainbow), the way in which the B-value
ranges are chosen (histogram or smooth ramp) plus the number of colours
to use (nbins). I include it here as an attachment. The documentation at
the top of the file says:
USAGE
color_b(selection='sel',ramp=0 or 1, rainbow=0 or 1, nbins=10)
or
color_b selection='sel',ramp=0 or 1, rainbow=0 or 1, nbins=10
This function allows coloring of a selection as a function of B-value,
either in a range of hues from blue through magenta to red (rainbow=0,
the default) or in the colors of the rainbow (rainbow=1). The division
of B-value ranges can either be as a histogram (equal-sized B-value
increments leading to unequal numbers of atoms in each bin: ramp=0)
or as a ramp of B-value ranges with an equal number of atoms in each
group (ramp=1).
The module must first be imported into PyMOL, either by including it
in the contrib.py module in the modules/pymol directory of your pymol
distribution, or by importing it from another directory or by using the
"run color_b.py" command. If you then just say "color_b", it will color
all of your molecular objects with ten colors ranging from blue to red
(via magenta).
Because I included the line:
cmd.extend("color_b",color_b)
Then you don't need the parentheses around the arguments, but if you
"import" the color_b.py module, then you'll need to say, for example:
color_b.color_b(arguments...)
or just
color_b arguments...
One question for the gurus. Is pymol/modules/pymol/contrib.py the
accepted place to put new (or personal) functions? I noticed that if I
include my function within the contrib.py module, it is ready for use
as soon as I start up PyMOL (i.e. I don't have to explicitly "import"
it or "run" it (although with parenthese, it needs to be called as
"contrib.color_b(...)"). I couldn't find any other python module that
imports from contrib.py, so I wasn't sure.
Cheers and happy colo(u)ring,
Robert
--
Robert L. Campbell, Ph.D. http://biophysics.med.jhmi.edu/rlc
rl...@k2... phone: 410-614-6313
Research Specialist/X-ray Facility Manager
HHMI/Dept. of Biophysics & Biophysical Chem., The Johns Hopkins University
PGP Fingerprint: 9B49 3D3F A489 05DC B35C 8E33 F238 A8F5 F635 C0E2
|