Displaying Molecular and Map Images

Images of 3-dimensional structures of molecules and maps are presented as rotatable and interactively manipulable graphical objects are displayed in the MAIN largest window.

There are three levels of user interface, which manipulate the image composition and setup:

There are additional sections like the "Image object code" reveals what image codes "Vva__1" mean, the section "Color and light hints" explains how to deal with colors and lights, the section "Background images" explains to you have you can keep images on screen even though MAIN does not remember them any more, the section "Making plots" brings the essentials about MAIN plot file creation and the section "Preparing slides" provides useful and maybe not that obvious instructions for creating slides.

Making images of molecules by commands

The general idea is that to a given selection of atoms color code and type of image object are assigned.


 image select segment name A end  col 200 bond stick

The selection in this case refers to segment with its name "A". Color 200 defines a green and the type of image object are bond sticks.

Image selections

The syntax for the selection specification ("SELECT ... END") is described in detail in the command syntax chapter MAIN_COM:select.html, wheres a brief insight into a few most common selection cases can be extracting from the "input.cop" file while clicking the nice selection menu items (MAIN_MENU:nice_sel.html).

Use of color

MAIN internally works with color maps (Video Lookup Tables or VLT in short) although they appear to a graphics hardware as floating point Red Green Blue (RGB) values. So when you try to color an image object, you refer to it by an index in the color map. Default color 0 is black, 1 is white, colors between 64 and 255 go around in a circle, when you rotate a dial, from blue(64), violet(90), red(110), orange(145), yellow(160), green(200), light blue(220), dark blue(245) and 255 and as next to 64.

Explicit use of color index

Molecular images can be colored using atomic colors


> image set

or an explicit color index.


> image color 90

After an image is displayed, you can enter the COLOR mode (click the COLOR in the image window) and then the object for which you want to adjust the color: A dial will be attached to this object and while you turn it, the image objects color will go around in the color interval index between 64 and 255. After a RE_DRAW this colors will be replaced by the initial values, so when you want to keep them you have to either grab their index (IMAGE LIST) or not press RE_DRAW or any function that modifies molecular model geometry. This does not apply to map images, they keep the color you have adjusted with a dial regardless of that what you do with the map.

Each atom has its color index defined by default on the basis of its atomic number. You can change atom colors with SET COLOR commands:


 set color sele atom name C .a segm name MOLB end col 200
 set color sele resi name ARG LYS .a segm name MOLB end col 110

or


 set color
 sele segm name A B C end col 180
 exit

Coloring by a property

Beside the explicit color addres, the colors can be assigned to atoms as a property of their PERIODIC system entry (DEFAULT) RESIDUE, CHAIN, SEGMENT number or from the ANALYSIS values.

Each time the lowest and maximal color index has to be provided to specify the range of applicable color entries from the MAIN color table. This range is then divided by the number of selected objects (SEGMENTS, CHAINS, RESIDUES) and increased for the result of the division for each new object found.

The "ANALYSIS" colors differs since the property of the "ANALYSIS" functions are stored as real values and the third "COLOR" integer (16) is provided, to define the number of colors used, whereas the "RANGE" keyword provides the mean of control of the interval of the analysis properties taken into consideration. "RANGE AUTO" is the usual way of specification, though explicit definition by "RANGE DEFINE" is possible too


 set col sele segm name A end anal aver color 64 180 16 raneg auto


 set col sele segm name A end anal aver color 64 180 16 range define 3. 80.

Light hints

Default lights satisfy most needs, but one can use the light menu ("


...") or syntax to adjust them.

Lights affect only polygonal (AREA) images. Light is reflected on AREAS and not on lines (vectors), points and text objects. It is possible to manipulate at least ten lights (computer hardware dependent) simultaneously. A light can be ambient, directional, positional or a spot light. The following commands brig you the essentials of a light manipulation and its control.


 image light 3 on
 image light 3 directional
 set dial 1 light 3

For more details see IMAGE LIGHT commands and SET DIAL ... LIGHT manipulation of light parameters in the "Reference manual".

Bonds, hydrogen bonds and pair list

BONDS, HYDROGEN bonds and PAIRS are lists of connected atoms in a certain way. Therefore it is possible to present the images of this lists. "LINES", "STICKS" and "DISTANCES" are the choices. Only "STICKS" are used for making plots. Default connection type image is "LINE".

Lines

Lines can have thickness. Currently there is only a single line thickness, which is immediately applied to all displayed lines. Each graphic card and screen combination should have its own default:


 image line 3.0

where the real number unit defines width of a pixel.

In PostScript plots each line object can have its own thickness.

Here only bonds between covalently atoms will be displayed in cyan


 image sele atom name C* O* N* S* end col 220 bond

whereas the


 image sele atom name C* O* N* S* end set bond

command displays each atom in its own color, as defined with a "SET COLOR" command.

Sticks

"STICKS" have "RADII" and "DENSITY". The radii are changed to emphasize particular parts of the structure (for example the main chain) or to diminish their importance (more distance parts or side chains). The default values are


 set stick rad 0.15 dens 6


 image bond stick

Distances

Distance between the two connected atoms is displayed in the center of each connection. A useful tool for structure analysis.


 image bond distance

Atom balls

Each atom can be displayed as a sphere with a specified radius. Radii can represent VdW radii or can be set explicitly and/or scaled and as the displacement from the center corresponding to the atom B factor.


 set radi sele atom name CL end = 1.4


 image sele atom name CL end col 198 atom ball

Ribbons

The "RIBBON" points have to be created


 make poin from atom sele active .a atom name CA end ribb

before they can be displayed as a "STICK" or "LINE" object:


 image sele active end poin ribb stick


 image sele active end poin ribb lines

Filled surfaces

First atomic radii need to be assigned. By default they get the VdW value during the initialization, however, this can be later manipulated as shown above for the case of atom balls.

The MAIN_CMDS_NEW:image_gen_poin_surf.cmds is an example, how the surface points are created.

They are displayed with a command as


 image select active end poin 3angle

Image object codes and colors

Molecular images in MAIN are 3-dimensional rotatable geometrical objects appearing in the largest window, the MAIN image window on which top margin you find the "cool" words. Objects are lines, points, text, sticks and balls. Each molecular image consist of atoms that can be picked and thereby manipulated via menu items..

Graphical presentation of maps are either lines or polygons (AREAS) delimiting a specified map contour level.

Each object name has its own label for example as "Vva__1" (usually appearing on right within the "cool" window) starts with a character, that describes its kind (V for vectors or lines, C for text characters, A for areas or polygons, M for markers, which include points as well). Each image object name description has exactly the same color as its 3-dimensional presentation. The mark before the name (+,-) tells you whether the object is on or off (INCLUDED or REMOVED) from the list of displayed objects.

By setting the mode in the "cool" window menu (INCL_REM, COLOR, REFLECT), you can with clik(s) on labels of image objects INCLUDE and REMOVE them from the list of visible objects, interactively change their COLOR and surface REFLECTANCE properties using dials or mouse.

Manipulating the pickable atoms list

User control over the list of pickable atoms is achieved through access to the KEY "image". Each new IMAGE commands makes an logical ".or." to the already existing KEY "image". You can, however, edit the KEY any time, either by "KEY image SELECT ... END" commands or via the "SELECT" menu block.

When GROUP is ON then behind each image group label there is a key, which contains the list of atoms associated with a certain group name label. By removing and including the key "image" is automatically updated.

Map images

Map images are not bound to atoms and are not pickable. Names of displayed maps appear in the right top corner of the image window. Their COLOR, polygonal REFLECTANCE properties and INCLUDE REMOVE status can be controlled and adjusted in essentially the same way as for the molecular images. Maximally 10 maps can be displayed simultaneously and, in addition to the mouse, their INCLUDE/REMOVE control is bound to the number keys on the keyboard, where key "1" controls the status of the first map and "0"' the tenth.

Background images

Background images are images prevented from deletion when commands as 'IMAGE ERASE' and redraw ('IMAGE OVER FALSE') are invoked. A typed


> image from

command sets the image erase counter to the current number of image objects. A following IMAGE ERASE command will only clear the images from the MAIN memory, but will keep them on the screen. This is the only way to keep GRAPH images as Ramachandran plot on screen while doing molecular modeling, because MAIN does not remember them at all. The typed


> image from 0

command set the image erase counter to 0 and thereby enables deletion of every image object. You can off course set the counter to any valid integer number.

This happens automatically when using the menu item "BACK_PDB" or calling the MAIN_UTILS:background_file_image.com directly.

I recommend you to build this command in your startup file at the end of your initial background image construction. See also the chapter "A real case".

Making plots

MAIN has interfaces to three programs:

They can be used through the "PLOT" command item on the "MAIN" depp page and configured via the right button click GUI or by manual editing of the "RE_IMAGE" pathway as described below.

Postscript plot of lines, labels and dots

Herewith only lines and labels can be ploted to a PostScript file. Lwplot is mostly useful for preparing black and white figures, although it color can be used to.

The simplest way to prepare a plot of an image is to enter dialog mode and click on the menu item PLOT. The file name to which the image object are to be plotted is INQUIRED from the standard input window ("PLOT FILE NAME:"). The resulting file can be afterwards converted to a PostScript file by using the program 'lwplot' written and modified by a number of people. For MAIN users backup of typed answers, definition of window size and color use was added to it.

As well as when preparing slides, it makes sense to include the complete generation of an image that you will plot into a command file, which can be edited and used also at some other time.

The default use of fog or depth cuing routines gives you the advantage of the depth impression, because the images fade against the background from front to the back of the 3-D object displayed. When generating plots. The plot only knows clipping but nothing about depth cuing, so you are hindered to see what will really appear in the plot file. Therefore I recommend you to change the front to back CONTRAST to values close to 1.0, so that also things at the back become clearly visible as well.


> image contrast 0.9

Plot invokes redrawing of the entire image, therefore the background object and image objects displayed through using GRAPH command sentences can not be redrawn.

No polygons can be plotted (balls, sticks and map areas).

GRAPH objects can be plotted with some additional effort. Since there is no GARPH redraw option, you should do the redrawing explicitly by yourself. Once the desired GRAPH objects scaling is set OPEN a plot file and redraw the GRAPH objects by repeating the drawing commands (the best way to do it is to copy commands from the input.cop file):


> open unit 79 over file YOUR_PLOT_FILE_NAME
> image plot (  unit 79 lwplot on initialize )

here insert the GRAPH COMMANDS


> image plot off
> close unit 79

and close the file.

Any area objects (atom balls, bond stick and map areas) are not transfered to the plot file.

This MAIN plot file is later on processed with the program 'lwplot', which you can find in the directory 'main/progs' and should be in your 'PATH' already. 'Lwplot' is a simple program, so just try to run it. When executed it creates a backup file with all your answers to questions on a FORTRAN unit 79 (fort79 or similar). This file you can edit and use as input for later 'lwplot' runs. Do not forget to rename ('mv') it, otherwise it will be overwritten by the next run. With a few iterations it is usually possible to adjust scales and window sizes. The output of 'lwplot' is a PostScript file ready to be previewed or printed.

Bellow is such an input file: first comes the output file name, then some declarations of size and fonts, then the input MAIN plot file and then you have to answer which objects to see with which line style and thickness. It works with RGB colors from the screen, too.


 omit_map.ps
 omit map at 1.85
      !stereo
      3.80     !window
      6.00     !ch-siz
      0.00     !ch-offset
      8.00     !scale
      4.00     !stereo-sep
 omit_map.plot
    0     ! vl_1
      0.00
    0     ! vl_2
      2.00
    0     ! h_at
      0.25
    0     !  m_1
      0.05

Raster3d plots of sticks, balls, labels and polygonal surfaces

The idea is to compose an image by creating of object oriented raster3d "r3d" files, process labels and hydrogen bond list, merge them into a single "r3d" file andprocess it with the "RENDER3D" program.

Image is composed by including commands for generation of partial image objects into an re_image_MY_SLIDE.com file as described beneath and invoke it with an modified re_image.cmds file.

Before anything it may start to adjust the view:


 save over file MACRO + .view view
< MACRO + .view

by rerunning the macro with the "RE_IMAGE" cliks. After the view seems OK, comment the file save line:


 !save over file MACRO + .view view

Header

Header is inevitable, but it makes sense to created only once.


 open uni 24 file MACRO + _head.r3d over
 image plot ( raster3d unit 24 init on )
 image plot off
 clo uni 24

Labels

History labels are written to the file in the moment when raster3d plot is "INITIALIZED". Therefore create your history list on the top in front of your header generation.


 image hist init
 image hist atom name off
 image hist pick 4638
 image hist pick 4629
 image hist pick 4605

Later on you may edit the label records (changing coordinates and text), so comment the header generation when you start editing the header file.


 11
  41.703  -2.758  19.024 0.000 0.000 0.000
 HISH 253

Bond sticks

ALl bonds are drawn as cylinders with a of specified radius. If you want them closed create also small atom balls at their ends. Here is a code for side chain presentation of loop in the range between 247 and 255.

key active sele seq 247 : 255 .a segm name IA end


 ! balls end sticks


 if ( PLOT .eq. ON ) then
  open uni 24 file MACRO + _ball_stick.r3d over
  image plot ( raster3d unit 24 init on )
  rewind unit 24
 end_if


 set stick radi = 0.15
 image sele active .a .not atom name H* N C O end set bond stick


 if ( PLOT .eq. ON ) then
 image plot off
 clo uni 24
 end_if

Atom balls

All CL atoms are shown in green as large green atom balls with radii 1.4.


 ! atom balls


 if ( PLOT .eq. ON ) then
  open uni 24 file MACRO + _ball.r3d over
  image plot ( raster3d unit 24 init on )
  rewind unit 24
 end_if


 set radi sele atom name CL end = 1.4
 image sele atom name CL end col 198 atom ball


 if ( PLOT .eq. ON ) then
 image plot off
 clo uni 24
 end_if

Ribbon

Ribbon plot is generated for the segment name IA selection KEY "display". The segment is in this case colored by residue type (MAIN_CMDS:image_col2_by_resi.cmds).


 ! the ribbon plot


 if ( PLOT .eq. ON ) then
  open uni 24 file MACRO + _ribbon.r3d over
  image plot ( raster3d unit 24 init on )
  rewind unit 24
 end_if


 key display sele segm name IA end
<?MAIN_CMDS:image_color_set.cmds
<?MAIN_CMDS:image_col2_by_resi.cmds
<?MAIN_CMDS:image_do_rib_stick.cmds


 if ( PLOT .eq. ON ) then
 image plot off
 clo uni 24
 end_if

Maps

Usually one wants to show map only around a specified selection of atoms, in this case the "active" KEY selection.


 if ( PLOT .eq. ON ) then
 open uni 24 file MACRO + _map.r3d over
 image plot ( raster3d unit 24 init on )
 rewind unit 24
 end_if


<MAIN_CMDS:image_map_mask.cmds 1
 image map 3 stick rad 0.06
 image map 3 dens MAP_CONT stick on


 if ( PLOT .eq. ON ) then
 image plot off
 clo uni 24
 end_if

Surfaces

Surfaces can be generated with the "GEN_SURF" menu item onthe image page menu.


 if ( PLOT .eq. ON ) then


 open uni 24 file MACRO + _surf.r3d over
 image plot ( raster3d unit 24 init on )
 rewind unit 24


 end_if

Read points and assign them to the nearest atoms by "recapture".

Remember that ribbon generation always initializes the point array therefore 3ngles of GRASP surface has to be read just before the image generation.


 read file pro_1.r3d poin init \
  raster first sele segm name MOL1 .a chain name A end
 make poin from atom sele segm name MOL1 .a chain name A end recapture


 set col
 sele segm name MOL1 .a .n chain name A end = 227
 exit


 image set sele segm name MOL1 end poin 3ang


 if ( PLOT .eq. ON ) then
 image plot off
 clo uni 24
 end_if

Hydrogen bonds

Hydrogen bond list enters the header file at initialization (similarly as labels). So do not mix the hydrogen bonds and label files and history lists. You should edit the hydrogen bonds file and remove the header records before you submit the rendering procedure.


 image history initial
 image hist pick 4642
 image hist pick 4595
 image history distance


 open uni 24 file MACRO + _hbond.r3d over
 image plot ( raster3d unit 24 init on )
 image plot off
 clo uni 24

Stereo

Rotate the object for 7 degrees to obtain the stereo pair of the original image. Only the header file contains the orientation matrix, so there is no need to duplicate all other files.


 image matr y- 7.0
 open uni 24 file MACRO + _head_7.r3d over
 image plot ( raster3d unit 24 init on )
 image plot off
 clo uni 24

Rendering

"render.sh" is a shell script, which from your "r3d" files creates "png" or "tiff" files ready for slides and printing. "tiff" files can be viewed with "xv" or a similar program.

The size of labels is controlled the LABEL keyword. Fonts are scalable. Labels are displayed only for history atoms. You can edit the header file to move the labels around as well as to change the text.

To display broken cylinders sticks "HISTORY DISTANCE" commands are used. The list of cylinders comes at the end of the "header" file. The file needs to be edited before rendering. You should remove all lines on the top until the first "3" record is reached.


NAME="tetra_stand"
LABEL="3"


$MAIN/r3d/crke/labels.pl "$NAME"_label.r3d $MAIN/r3d/crke/ "$NAME".matr "$NAME"_lab.r3d $LABEL
cat "$NAME"_head.r3d "$NAME"_surf.r3d>  "$NAME".r3d
render -tiff "$NAME".tiff -labels<  "$NAME".r3d
 exit

The file "transparent_black.r3d" will define transparent colorless material properties suitable for rendering. Usually it is used last - to make only the last "r3d" object transparent.


 9  Here is an example of specifying a transparent material
 8
   40.0  0.8   0.9 0.9 0.97   0.52   1 0 0 0

Plots with POVRAY

Preparing slides

Slides are prepared for presentations. They should be clean and perfect. They should express what you want. Too many details distract observers attention. It can take several work sessions to prepare a sufficiently good slide. Therefore nothing should be left to coincidence, everything must be under control and reproducible. The major attention should be directed to the choice of colors. Colors should be different, but not exactly opposite according to the color wheel (violet-magenta-red-yellow-orange-green-light and dark blue). Dark blue maps go well with yellow model, but dark blue models are almost invisible. When displaying surfaces do not use the same color for surface points and for model behind, since they both will lost their clarity. When presenting complexes use color of the molecule B for the surface on molecule A and vice versa. This will evidently improve their differentiation.

The whole image should be brought to screen from a command file. After you have loaded the >cmds/load_depp_page.com use the item RE_IMAGE (on page 9 or 2) to redraw the whole image. Below I describe a rather complicated example, which hopefully includes quite a few useful approaches. After the image is done, remove the list of images and the image control menu from the image window (click MENU, press 'M' or type the command "image menu off"), enlarge the image window to the whole screen, make the first photo and for its stereo mate rotate the image for the stereo angle by pressing key '-' or '+'. For making slides one rotation is enough, for photos, however, the difference angle should be large, so press a key twice.

Reflection coefficients, sticks radii, ball approximations and line type keep their values as long they are not changed. So it is possible along a sequence of commands, effect all following created image objects. In contrary to them, modification of lights effect the whole scene simultaneously. (See commands SHOW LIGHTS, REFLECT, STICK, BALL that display the contemporary parameters and to them related IMAGE LIGHTS, REFLECT, SET STICK and POINT BALL that can modify these values.)

If Connolly surface points or vectors appear to dark when compared to area objects, display them twice or even three times in order to increase their image intensity.

The re_image.cmds calls right at the top the "image_active_dens.com macro which effectively displays the image:


> <image_active_dens
> return

The file "image_active_dens.com" displays parts of molecular model together with electron density. First the whole image is erased and line type set to 1 (continuous line).


> image line 1 erase

Sometimes we may wish to use some colors not available in the MAIN default color table (color indices between 64 and 255). For such cases I recommend the use of indices between 32 and 63. The VLT commands below define colors in their RED, GREEN and BLUE components explicitly. The valid component values are between 0.0 and 1.0. The color 32, defined below, is still white, but does not burn the film. The color 33 becomes dark green.


> vlt
> col 32 red 0.5 gree 0.5 blue 0.55
> col 33 red 0.3 green 0.7 blue 0.2
> exit

The view file includes orientation, scale, center and clipping of the image. As long you are trying to improve the view, keep the SAVE VIEW command below, so that the current view is written to a file just before invoking it. As soon as the view appears OK, the SAVE command should be commented. Sometimes you may wish to change the front to back contrast or light definitions. This is an appropriate place for insertion of the corresponding commands.


> save over file active_dens.view view
> <active_dens.view

The history list is initialized (erased) and then the desired atoms are picked and stored the key 'labels'. This part of the macro was created so, that the atoms were picked on the screen and the parts of the 'input.cop' file were later on included into this file and tailored. The history labels are then removed (HISTORY INITIALIZE) and displayed with the later IMAGE command, however, using the user defined color 32.


> image hist init history atom name off
> image hist pick 485
> image hist pick 473
> image hist pick 459
> image hist pick 1294
> image hist pick 413
> image hist pick 456
> image hist pick 430
> image hist pick 2936
> image hist pick 1306
> image hist pick 2465
> image hist pick 1754
> image hist pick 380
> image hist pick 71
> image hist pick 104
> image hist pick 917
> key labels sele history end
> image history init
> image sele labels end col 32 resi name sequ

Here some keys were defined to make the further atom assignments easier to handle.


> key procb_pact sele seq P2 P14 .o seq P30 P52 end
> key procb_eact sele around key procb_pact dist 20. .a procb_enz end

Radii of different parts can be specified differently. The propeptide atoms, because they are displayed inside the electron density map contours get slightly larger radii.


> set rad sele all end vdw
> scal 0.24 rad sele procb_pep end
> scal 0.14 rad sele procb_enz end

Bonds of the enzymatic parts of procathepsin B are then displayed in magenta (95) and light blue (224). The SET colors are used, because the bond connecting the two different colored segments should be displayed as well.


> set stick dens 6
> set stick rad 0.1
> set col
> sele procb_enz end col 95
> sele procb_enz .a seq 105 126 end col 224
> exit
> ima sele procb_enz .a procb_eact end set  bond stick

The atomic colors are now changed back to their default values. Only noncarbon atoms are shown as balls in order to simplify the image.


> set col sele procb_enz end default
> ima sele procb_enz .a procb_eact .a .not atom name C* end set atom ball

The propeptide bonds are shown with thicker sticks than the enzyme ones and the atoms balls are displayed similarly as specified above.


> set stick rad 0.14
> set col
> sele procb_pep end col 33
> sele procb_pep .a seq P1A P7 end col 162
> exit
> ima sele procb_pep .a procb_pact end set bond stick
> set col sele procb_pep end default
> ima sele procb_pep .a procb_pact .a .not atom name C* end set atom ball

The "IMAGE_MAP" (MAIN_MENU:image_map.html) menu block takes care of the map image. Click through the options for various images, and if you want to learn the syntax and use it in your slide macros, follow the links. For a slide you usually need a map around an selected group of atoms. The "MAP_MASK" item (MAIN_CMDS:image_map_mask.cmds) does it.

Displaying text

Strings can be displayed in any color and at any position on the screen. They are treated as GRAPH objects. The following sequence of commands brings a text on the screen and enables you to interactively adjust its position.


> graph
> object 1
> col 160
> x- 0.
> y- 0.
> text "JHG KJHG65_ HGIUG"
> exit
> set dial 1 graph obj 1 translate

The default (x,y) values for a position of the text are 0.0, however, you can place a text anywhere on the screen by changing the defaults. Each text can have its own color and position. With dials you can later move around the whole graph object. There are up to ten GRAPH objects, and each one of them can be composed of any number of strings or drawings. Ramachandran plot is an example of a graph object (see chapter "Utility macros", section "Ramachandran plot").

Image Trouble Shooting

IMPORTANT: only data that are known to the program can be displayed. If there are no atoms, you can not see them on a display, if atoms are not connected via covalent bonds, you can not expect to see their covalent bond network... When an image object exists, a string with its color is displayed on the right edge of the image window. If an object has no color (or a color equal to the background) you can not see it. The


> image list

command prints all molecular image names, their status (D-displayed, R-removed or E-erased) and their color (index). After a molecular image object has been created and you don't see it, then your SCALE or CENTER might be wrong. The


> image center calculate select ... end

command is usually successful, although the CENTER of atom selection (arithmetic average of all selected atom coordinates) may sometimes be placed into an empty region between atoms. This usually happens when you are displaying several molecules which are far apart from each other.

Cases