Das Erwachen

Bioinformatics

"Python looks to me like the illegitimate spawn of C and BASIC, but then I used to program in 6502 machine code so what do I know ..." (Laurence Pearl, PyMOL user)

 
 

Tips for PyMOL from the PyMOL mailing list

Disclaimer: All the contributions displayed on this page were made by subscribers of the PyMOL mailing list at sourceforge.net and Warren L. DeLano himself. Although i have checked most of the things listed here, i cannot guarantee that everythings works well. I cannot even guarantee that i have understood everything written on this page. Please be cautious.

Kristian Rother

Available Subtopics:


Coloring molecules


   

Coloring secondary structures

Examples:

 color red, ss h
 color yellow, ss s
 color green, ss l+''
When "the colour bleeds from the ends of helices and sheets into loops," try setting cartoon_discrete_colors to 'on' (or 1).
  set cartoon_discrete_colors, 1
or from the the "Cartoon" menu of the external GUI find "Discrete Colors" as the last item in the menu.
Robert Campbell


 

Color by atom type from a script

The "util" module contains a number of functions that color the atoms according to type, with different colors for the C atoms. For instance,

  util.cbay three
in a .pml script will color object "three" by atom type, with the carbon atoms in yellow ("color by atom yellow").

Other functions from ../modules/pymol/util.py are cbag, cbac, cbas, cbap, cbak, cbaw and cbab (grey (carbon), cyan, salmon, purple, pink, white (hydrogen) and slate).
Lieven Buts


 

Use CMYK-safe Colors

Some RGB triplets do have equivalents in CMYK space, and as a result, a figure that looks great on a screen can come out with unpredictable colors when printed.

Most applications do a good job with RGB-to-CMYK conversions for photos, but do not do such a good job with graphics that use pure primary colors. For example, reds are generally OK, but pure blues and greens do not translate very well.

Here are some RGB values that are within the CMYK gamut (i.e. are "CMYK-safe"). In general, colors in PyMOL can be assigned manually:

set_color green= [0.00 , 0.53 , 0.22]

Note that there are default atom colors such as "carbon", "nitrogen", "oxygen", "hydrogen", "sulfur", etc. which should also be redefined:
set_color carbon= [0.00 , 0.53 , 0.22]

Here's still another URL. Although the list of colors is not extensive, you can see colors: CMYK-safe RGB colors
Gil Prive, Dave Fahrney and Warren DeLano


 

Assign color by B-factor

Robert Campbell has a color_b.py python script on his PyMOL web page that you can use.
it has a number of options including the selection and two types of colouring schemes (rainbow versus a blue-magenta-red gradient) and two types of binning of the colours (equal number of atoms in each colour or equal spacing of colours along the B-factor range).

See http://biophysics.med.jhmi.edu/rlc/work/pymol to download. There are other scripts there as well.

Robert L. Campbell


 

Creating a Color bar

To show a vertical/horizontal color bar indiacting the b-factor variation, use the script pseudobar.pml on the structure pseudobar.pdb, or do the following:
1. Create a pdb-file which contains CA positions only, whereas the numbers correspond to your wanted increments of colors. Be sure that CA's are separated by a contant value, say 5 Angstroem.
2. Load this new pseudobar-pdb file into PyMOL, make bonds between increment 1 and increment 2 [increment 2 and increment 3 and so on...], define/assign a smooth color for each increment (copy colors definition from automatically created colors made by b-factor script) and show the b-factor bar as lines (or sticks).

Bartholomeus Kuettner


 

Coloring insides and outsides of helices differently

Q: does anyone know how to color the inside of helices a different color than the outsides?
A:

set cartoon_highlight_color, red

Warren L. DeLano


 

Coloring all objects differently

Q: Is there a simple way to colour each object currently loaded, with a different colour?

A: There is a script
color_obj.py that does the job.
The script is also available at
http://www.ebi.ac.uk/~gareth/misc

USAGE

        color_obj(rainbow=0)

	This function colours each object currently in the PyMOL heirarchy
	with a different colour.  Colours used are either the 22 named
	colours used by PyMOL (in which case the 23rd object, if it exists,
	gets the same colour as the first), or are the colours of the rainbow

Gareth Stockwell


 

List the color of atoms

To retrieve the color for a residue as identified in an expression, you can either iterate over a selection from the PyMOL command line

iterate all, print color
Alternatively, this can be done from a
Python script.
Warren DeLano

 
Rubor : http://www.rubor.de
Post an Kristian Rother: kristian.rother@charite.de

Last modified: Wed Apr 28 07:24:35 CEST 2004