Colour Overview (980217)

Colour is used within O in the user interface and in the 3D objects that can be created within the program.

Every window within the user interface can be configured by the user to reflect his/her preferences. The graph pull-down, for example, is described by the following entry in the menu.o file

.graph t 17 50

origin -1.000 .85

pane_size .300 0.05

step 100

colour_background black

colour_text magenta

colour_inverse_background red

colour_inverse_text green

text Molecule

text Y Db

text X Db

text Graph it

text Ramachandran

child 1 graph_mol

child 2 graph_y

child 3 graph_x

child 4 graph_graph

child 5 graph_rama

and 4 commands describe the colour of the background, the text, inverse background (as the mouse pointer moves over thge pane), and inverse text.

The prompt and dials objects take their colour from the text colour in the highest level window object (.parent_menu). Colour commands can be introduced in the user's menu (.menu), to assist in separating commands with different functions, or macros, for example. In the following, the user's menu would appear as 2 lines of green, then 2 of red, then 2 of yellow

.menu t 9 50

colour_text green

Yes

No

colour_text red

Save

Quit

colour_text yellow

@skel25a

@mc100a

Molecular objects are controlled by a pull-down menu (Display/Paint pull-down) or by the O line parser Paint commands. For skeleton objects, colour is controlled via a one-to-one relationship between the skeleton status codes and the colours in the datablock .bones_colour

Within contoured electron density objects, colour can either be explicitly defined (Fm_setup) or via an on screen slider (Density pull-down).

Colour of 3D text is controlled by the value of an entry in the database (.molec_obj_integer, entry 8 as a packed RGB integer 16711680 isred)

The Paint commands

The paint commands affect the colour properties of molecules or molecular objects. Each molecule has an associated atomic property called <mol>_atom_colour, and each molecular object has a property called .obj_col_<object_name>. These are integer arrays of colour values. The difference between these two lists of colours is subtle, but it is important that the difference between them is understood. If you make a molecular object, for example using the command Zone or Ca, the current colour property of the molecule is copied to the object colour array. Therefore, you can make an object of a molecule coloured according to element type, with carbons white, oxygens red etc. Now, you can change the colours associated with each atom, to represent, for example the magnitude of their temperature factors, and make another object. Now there are two objects, representing the same molecule. However, the colours of the first object you created (the one with atom colouring) did not change when you changed the colour property of the molecule, because they are saved in the O database along the description of the object.

Some of the commands in the Paint menu change the colour property of the objects. These are Paint_object, Paint_obj_zone and Paint_obj_atom, and can be used to colour objects with the current active colour, set by Paint_colour. The molecular colours have to be set according to some atom or residue property. There is a selection of commands for doing this in different ways, namely Paint_property, Paint_ramp, Paint_case and Paint_zone.

O makes use of the RGB (Red-Green-Blue) colour scheme, where the relative intensities of the three major colour components are set, using numbers between 0.0 and 1.0. Thus, red is (1,0,0), blue is (0,0,1) and so on. In the program, these 3 numbers are converted to 3 eight bit numbers between 0 and 255, and packed into a 32 bit integer word. These numbers are extremely strange when written out in decimal format, and are not understandable by normal human beings. Unless you're really into changing certain datablocks in the database, you should never have to deal with these strange integer numbers. The normal way to specify colours in O is by typing the name of a colour. In the default startup.o and colour_default.o files, there are 71 colours to choose from and are the colours defined in X-windows. These are

O > pai_col ?

Paint>Available colors:

Paint> aquamarine black blue

Paint> blue_violet brown cadet_blue

Paint> coral cornflower_blue cyan

Paint> dark_green dark_olive_green dark_orchid

Paint> dark_slate_blue dark_slate_gray dark_slate_grey

Paint> dark_turquoise dim_gray dim_grey

Paint> firebrick forest_green gold

Paint> goldenrod gray green

Paint> green_yellow grey indian_red

Paint> khaki light_blue light_gray

Paint> light_grey light_steel_blue lime_green

Paint> magenta maroon medium_aquamarine

Paint> medium_blue medium_forest_green medium_goldenrod

Paint> medium_orchid medium_sea_green medium_slate_blue

Paint> medium_spring_green medium_turquoise medium_violet_red

Paint> midnight_blue navy navy_blue

Paint> orange orange_red orchid

Paint> pale_green pink plum

Paint> red salmon sea_green

Paint> sienna sky_blue slate_blue

Paint> spring_green steel_blue tan

Paint> thistle turquoise violet

Paint> violet_red wheat white

Paint> yellow yellow_green

 

If this is not enough for you, the program will in most places accept 3 numbers for the RGB value when the colour prompt comes up. To get the list of colour names, type a question mark (?) as argument to the Paint_colour command. When specifying a colour name, you are allowed to abbreviate to a unique set of letters.

 

(If you insist on fooling around with the strange colour numbers, for modifying menu.o, for example, there is a macro @Colcod to do the conversion for you).

 

Paint_property

paint_property <property> <operator> <value> <colour>

Paint according to the residue or atomic property. For example, paint all phenylalanine residues blue and all tryptophanes violet:

 

paint_prop residue_type = phe blue

paint_prop residue_type = trp violet

z ; end

 

Or, colour the first 15 residues red, the remaining yellow:

 

paint_prop residue_name < A16 red

paint_prop residue_name >= A16 yellow

z ; end

 

Paint_ramp

paint_ramp <property> <min_value max_value> <start_colour> <end_colour>

Colour ramp according to the individual value of the property. The default property is the residue internal number, stored as a datablock with a residue property <mol>_residue_irc. If this property does not exist, it is created. The minimum and maximum values are those in the specified property vector.

This option can be used make pretty Ca drawings where the colour changes as one goes from N-terminal to the C-terminal:

 

paint_ramp ; ; red blue ca ; end

 

We could also ramp according to temperature factors, so that the smallest values are blue and the highest values are red:

 

paint_ramp atom_b ; violet red zone ; end

 

or we could colour the real space residue fit from salmon pink to cyan:

 

paint_ra res_rsfit ; salmon cyan z ; end

 

 

Paint_case

paint_case <property> <#values> <values> <colours>

Colour residue or atomic properties according to discrete values, all in one go. The default is <mol>_atom_z. The following commands will colour the current molecule according to atom name:

 

paint_case atom_name 5 c* n* o* s* p* white blue red yellow green

z ; end

 

Notice that for the specification of character value properties such as atom names or residue types, you can use the wildcard character '*' in the specification. Thus, for residue types, T* could be Tyr, Thr or Trp. This is not the case in command, property or colour specification.

 

Another way to paint atoms according to the type of atom is to use the element number property:

 

pa_ca atom_z 3 6 7 8 white blue red z ; end

 

This will colour atoms with Z = 6 (carbon) white, atoms with Z = 7 (nitrogen) blue and atoms with Z = 8 (oxygen) red. The zone containing the whole molecule will be drawn. In fact this way of colouring according to atom type is faster, because there is less computation involved in the comparison, than is the case for character properties like atom_name. Now let us try to paint according to the charges on residues. To do this, you need to load the residue table containing the charges:

 

db_table_res charge i table_charge

paint_case residue_charge 3 -1 0 1 red white blue z ; end

 

The latter line could be abbreviated even further:

 

p_ca r_c 3 -1 0 1 re whi blue z ; end

 

Paint_zone

paint_zone <mol> <start end> <colour>

Paint a zone of a molecule a particular colour. The following command will paint residues A1 to A23 of the current molecule green, and draw all the Ca's :

 

paint_z ; a1 a23 green ca ; end

 

Paint_select

paint_select

Paint a selection. See the section on the Select commands for examples.

 

Paint_object

paint_object <id an atom> or <object>

The user is required to identify an object, which is painted with the current colour. The object can be specified by identifying an atom in the object or by by typing on the same line , e.g.

pa_obje m14 90 sph

 

Paint_obj_zone

paint_obj_zone <id two atoms> or <mol res1 res2 object>

The user is required to identify a zone in an object, which gets painted with the current colour. Useful for interactively making a picture where for example a-helices are one colour, and b-strands another. The object can be specified by identifying two atoms in the object or by by typing on the same line , e.g.

 

pa_obj_z m14 90 110 ca

 

 

Paint_obj_atom

paint_obj_atom <id an atom> or <mol res atom object>

The user is asked to identify an atom, which gets painted with the current colour.

 

Paint_colour

Select the current colour. The colour is be given as a colour name. There are 71 standard colours to choose from, and the list of colour names can be listed by answering with a question mark (?) in response to the prompt. The colour name is converted internally to a mysterious integer code. The current colour code is stored in the datablock .active_colour, the name of the current colour is stored in the datablock .active_colour_name. If an unknown colour input is given, the current colour remains unchanged. It is also possible to specify a colour directly using the RGB triple.

 

Personalized Colours

The colours available to the user are stored in the O database, and can be changed. There are two datablocks, one containing the names,.colour_names, and one containing the corresponding RGB triplets, .colour_rgb. The latter is a real datablock, and the values are normalized to the range [0:1]. You can easily configure your own colours from the standard X colour database. First make a text copy onto your working directory:

 

/usr/bin/X11/showrgb > myrgb.txt

 

Edit this file to weed out the colours you don't need. There will be quite a few; the XR11.4 database contains > 200. If you want a feel for the look of the different colours, use the UNIX shell script dispcol:

 

% dispcol < myrgb.txt > tmp

 

The file tmp contains a series of ODL drawing instructions that can be displayed in O using the Draw command:

 

O > draw tmp

 

There is another script, mkcol, that will generate the relevant datablocks.

 

% mkcol < myrgb.txt > junk

 

Then, inside O, read the file using Read_formatted:

 

O > read junk

 

and you are set to go.