[ Graphics learning | Nice image | Image rotation | Mol translation | Image annotation | Image | Color background example | Image center | Color by bfactor | Color by hydrophobicity | Color by accessibility | Color by charge ]
How to learn the ICM molecular graphics commands in 30 seconds |
To master ICM graphics you only need to know the following words:
commands: display, undisplay, color, center, delete, connect ;
nouns: wire, cpk, ball, stick, xstick, surface, skin, ribbon, label, residue, atom ;
selections : e.g.
a_1. # the first object
a_1.1 # the first molecule
a_1.1/5:10 # residues from 5 to 10
a_1.1//ca,c,n # the backbone atoms
Sphere(a_1.1 a_2. 10.) # atoms around a_1.1 in a_2.
colors: white, black, blue, green, etc. (see file icm.clr ).
output image formats: png , tif (default) , targa, gif , rgb .
Now start from the command word and type what you need, and use
controls to rotate, translate, label, zoom, mark and color.
Example:
read pdb "1crn"
display ribbon
color ribbon a_/4:8 blue
display xstick a_1.1/10 green
center a_/6:12
display residue label a_/6:12
display string "Crambin" 36 red
write image rgb "crn" # use IRIX imgview to check the image
write image window=2*View(window) # hi-res picture
More advanced topics: connect , graphics objects .
How to make a nice high-resolution image |
So called computational biology is primarily about generating nice pictures.
Here are a few tips.
- image display. Display your molecule or molecule the way you like.
Running the nice macro (e.g. nice "1est") is a good start.
- start ICM with option -24 (see options). Graphics will start blinking upon
rotations, etc., but this is OK.
- make sure that the l_antiAlias variable is set to yes (applies only to some platforms).
- background. Change background color with Ctrl-E and Ctrl-Q to your liking.
Set IMAGE.generateAlpha to no is you want to preserve the background, rather than make it transparent.
- fog. It is a great visual effect. Use it!
Switch on the depth-cueing effect, i.e. fog with Ctrl-D (depth).
Move the bright front clipping planes with Ctrl-MidMB and move the back clipping
plane closer with vertical movements with MidMB at the right margin of your graphics window
(the mapping of the mouse controls to effects is defined by the icm.clr file).
You may color the fog with color volume color command and modify
fogStart to increase or decrease the unfogged slice of the molecule.
- grobs. Make them smooth with select g_.. and pressing Ctrl-X
and unselecting with the Esc button.
To shine light from outside sometimes you need to say display reverse .
- quality of graphic elements. set IMAGE.quality=12 or 15.
This parameter determines the number of triangles in shapes like spheres and cylinders.
The default value is only 5. because at routine interactive work you prefer speed to quality.
- image resolution. Let us count pixels. Your screen window is usually about 600x600 pixels
which corresponds to 2x2inch picture at 300dpi resolution, or 1x1 inch at 600dpi. Therefore,
if you want to generate image at high resolution use two tricks:
Be careful, the window option will not save the text labels. It is preferable to add text labels outside
ICM anyway.
- The picture is ready. Enjoy the attention.
How to rotate one molecule around its own center of mass |
First, you need to move the molecule of interest to the center of the screen:
center to this molecule and use the connect a_molselection
command to 'connect' your mouse
to just this molecule and leave everything else unchanged.
You will see that
E.g.
read pdb "2ins"
center a_b
connect a_b # use mouse LB to rotate and translate
How to rotate or translate one or several molecules with respect to the rest. |
You can rotate/translate/zoom the whole scene with all molecules (see the set view command),
or rotate/translate a selection of molecules with respect to the rest.
To achieve the second goal from a script, learn about these elementary operations
Memorizing and resetting position of an ICM object
To memorize rotation and translation of an object or a group of molecules in an object,
use the Value function and memorize the values of six positional variables for each molecule
which have names tvt1,avt1,bvt1,tvt2,avt2,tvt3 and can be selected as v_molecules//?vt* .
build string "AAA;GGG;WERR" # (or read pdb and convertObject )
v1 = Value( v_1,2//?vt* )# MEMORIZE 6-var per molecule.
connect a_1,2 # move the connected 2 molecules around
set v_1,2//?vt* v1 # RESET the values
Translating the selected molecules
build string "AAA;GGG;WEGG"
translate a_1,2 add {0., 0., 1.}
for i=1,10
translate a_1,2 add i*{0.,0.,0.2} # incremental translation
endfor
Calculating translation vectors
Follow these steps:
- choose one representative atom (e.g. the first virtual atom a_1//vt1 ) )
- memorize its coordinates using the Xyz function (e.g. r1 = Xyz( a_1//vt1 ) )
- set you molecules to another position (e.g. connect )
- memorize the position again (e.g. r2 = Xyz( a_1//vt1 ) )
- calculate the difference: vtr = Rarray( r2 - r1 ) . The Rarray function
will convert a 3x1 matrix to a 3-dim. vector
Now one can translate the first molecule only with respect to the rest.
It can be done iteratively like this:
build string "AAA;GGG;WEGG"
for i=1,10
translate a_1 0.1*i*vtr
endfor
Rotating selected molecules around specified axes.
First one needs to do the following:
Making grob gradually disappear in the backround
One needs to use Color (grob) function.
See examples in the description of the color grob command.
How to annotate a molecular image in the graphics window |
Simply use
display string
command allowing to place a string into the graphics screen. The string
can be dragged later to any location with the middle mouse button.
You can set font, color and positions you like. Obsolete strings can
also be
undisplayed
or removed by the command
delete label,
or by the BACKSPACE key when the cursor is in the graphics
window (see
keyboard and mouse controls
).
How to save and print the generated image |
Save the image using
write image
command, preview it with the IRIX imgview, convert it to
the PostScript format and print it. You may also save image directly in PostScript format,
either as a bitmap snapshot or as a vectorized high-quality model of linear, triangular and
string primitives, as they are rendered on your display. See
write image
and
write postscript
for details.
How to change the color of the graphics window background |
The
color background
command allows to set any color from those specified in the file
icm.clr,
for example
color background white # or
color background black # or
color background aquamarine
Note that numeric values may also be used, for example:
display string "background\ncolor test" 0.4, 0.9
ncolor = 127
for icolor = 1, ncolor, 1
color background icolor
display string "color number " + String (icolor)
delete label 2
endfor
delete label
display string "the end"
color background black
See also icm.clr file, set color .
See also Image , make image , set background image.
How to return a molecule to the center of the graphics window |
Use the
center
command.
How to color atoms according to their B-factors |
Command color can use any real array
as a set of individual color numerical specifications. The smallest
number corresponds to the red color, the largest number to the blue
one. Function Bfactor( as_ ) returns the real array of B-values for each selected atom.
Examples:
read pdb "1crn"
color a_1crn.//* Bfactor(a_1crn.//*)
How to color residues according to their hydrophobicities |
It is very simple:
read object "4pti"
display a_//!h* white
display surface a_1.1 a_1.1
s_method = "surface" # s_method = "xstick" or "cpk" is also possible
# hydrophobic
color $s_method yellow a_/ala,val,phe,ile,leu,pro,met/!c,n,o,hn
# polar
color $s_method pink a_/ser,thr,tyr,cys,asn,gln,his,trp,gly
# charged (+)
color $s_method blue a_/lys,arg/nz,hz*,nh*,hh*
# charged (-)
color $s_method red a_/asp,glu/oe*,od*
display string yellow "hydrophobic: yellow" 25, -0.9, 0.9
display string pink "polar: pink" 25, -0.9, 0.6
display string blue "charged(-)" 25, -0.9, 0.8
display string red "charged(+)" 25, -0.9, 0.7
See also
How to color atoms according to their charges.
How to color residues according to their accessibilities |
Function Area is required.
Example:
read object "crn"
show surface area # calculate the surface energy contribution
# (hence, the accessibilities are also calculated)
assign sstructure a_/* "_"
# remove current secondary structure assignment
# for "tube" representation
display ribbon
# calculate smoothed relative accessibilities
# and color the tube according
# to the accessibilities of the residues
color ribbon a_/* Smooth(Area(a_/*)/Area(a_/* type) 5)
# plot residue accessibility profile
plot Count(1 Nof(a_/*)) Smooth(Area(a_/*)/Area(a_/* type) 5) display
How to color atoms according to their charges |
Use function Charge .
For example:
read object "crn"
display surface
color a_//* Charge(a_//*)
Another example is selected residues coloring:
display a_*./asp,glu/o?* cpk red
display a_*./lys,arg/nz,n?* cpk blue