ViTO macro language
ViTO has now a small macro language that can be used to create new coloration schemes and to create publication quality images.
The language is very simple and ressembles the Rasmol language. Single commands can be issued in the command entry at the bottom of the 3D panel or for more complicated macros that can be loaded or saved to files. The provided macro editor can deal with multiple macros. The macro panel is displayed in the next picture.
An example
The following macro can be used to color in red residus that are conserved within the colorization list and works on the structures that are selected in the alignment.
with selected;
select conserved;
color red;
The next creates a surface object, assuming that a structure named 1edo exist in the alignment (it doesn't need to be selected)
with 1edo;
select *;
color cpk;
surface topquality;
As you can see, macros begin with "with .. " which identify the list of structures to work with. The syntax of the commands enclosed is very similar to Rasmol except that each line must be terminated by a ";" character.
Detailed description of commands
Commands:
- wireframe on/off/rad : rad must be a positive number (in angstroms). It displays the bonds between the selected atoms in wireframe. The bonds are displayed as cylinders with conic caps if the radius rad is stricly positive. Otherwise the bonds are displayed as lines.
- sidechain on/off/rad : rad must e a positive floating point number (in angstroms). This command displays the bonds between the selected sidechain atoms. As above the bonds are displayed as cylinders if rad is strictly positive or as lines otherwise.
- backbone on/off/rad : same as above but for selected backbone atoms.
- catrace on/off: displays the lines linking C alpha carbons or P atoms in DNA/RNA. The line is thin and its width can not be changed. The resut of this command and of the next commands of the same group depends on the coloration mode the structure. If the structure is colored by alignment, the CA trace will be displayed as a yellow line between 2 aligned residues and as a dashed yellow/blue line if there is an insertion/deletion.
- strands on/off: displays a smoothed path between C alpha carbons or P atoms in DNA/RNA using 5 lines. The separation between the lines depends on the the secondary structure assignment. It is very similar to the strands command of rasmol. Same behaviour as above if the structure is colored by alignment.
- ribbons on/off : toggles the display of flat ribbons whose witdth depends on the secondary structure assignment. Same behaviour as above if the structure is colored by alignment.
- cartoons on/off: toggles the display of cartoons (i.e. ribbons whose width and thickness depends on the secondary structure alignment). This command does not add arrows to the end of beta strands and alpha helices. Same behaviour as above if the structure is colored by alignment.
- tube on/off: toggles the display of the C alpha trace as a smooth tube of elliptic section. The result is similar to what is obtained using Insight. Again the section of the tube cannot be custumized yet. Same behaviour as above if the structure is colored by alignment.
- surface crude/medium/accurate/topquality : Draws the surface of the selected atoms. The displayed surface is the Connoly surface using 1.8 angstroms as the solvent radius. There are 4 levels of detail to render a surface. crude is the fastest but of poorest quality. topquality gives the best surfaces but use more memory, results in longer computations and can slow down the display. If your computer does not have a recent graphic card or if you don't have a lot of memory it is recommended to not use this option. mesh topquality in conjonction with spacefill on can give a nice looking result while not slowing down the display too much.
- mesh crude/medium/accurate/topquality: Draws the surface of the selected atoms as a mesh. The displayed surface is the Connoly surface using 1.8 angstroms as the solvent radius. The meaning of the flags crude / medium /accurate / topquality is the same as above. Mesh do not slow down the display too much and spacefill on used along mesh topquality is an alternative to surface topquality.
- surface on/off : Toggles the display of a previously computed surface object. Because surface computation can be long, the surface off command does not remove the surface from memory but removes it from the display. If your computer does not have a powerful graphic card the displayed surface can slow down the display, using the surface on/off command you can speed up the display to look for the best orientation of you structure and afterwards show the surface again. To really remove the surface from memory, use the surface free command.
- mesh on/off : Same as above but for mesh. Mesh objects are usually faster to draw than surface objects but consume a lot of memory too, so it is a good idea to use the mesh free command when a mesh is not needed any more.
- mesh/surface free : release the memory used for surface or mesh. After this command as been issued the mesh/surface on command will have no effect until a new mesh/surface is computed.
- dots on/off : displays the surface of selected atoms as dots (like rasmol). The total number of atoms that can be drawn as dots is limited for performance reasons.
- spacefill on/off : displays the selected atoms as spheres whose radius are the Van der Waals radius of the atoms. No limitations on the number of atoms.
Commands that change the color of objects:
- color col / r g b : col is either a keyword, a color name or three numbers between 0 and 1 that defines the RGB component of the color. All selected atoms will be colored according to the given color.
- shade fact : fact is between 0 and 1. the color of the selected atoms is multiplied by this factor. This allow to alter the color of the seleted atoms. An exemple of this will be given later.
- color surface/mesh atoms: maps the color of atoms on the surface or mesh object. This is what is done when the surface/mesh is computed but the color of surface or mesh can be altered by other commands.
- color surface/mesh electrostatic: GRASP like coloration of surface or mesh.
Selection command and syntax
- select expr : select atoms that satisfy the predicate in expr. The syntax of expressions is explained in the next section.
- extend group/sidechain: extends the selection to the whole residue or to its sidechain (including CA for proteins).
Customization commands
- bg_color col : change the backgroung color of the 3D panel.
- material ambient diffuse specular : Changes the property of the material. All the coefficient will be between 0 and 1, it is possible to use values bigger than 1 but this can lead to very strange results. ambient corresponds the object's color, diffuse corresponds to a reflection component, the intensity of the diffuse component depends on the orientation of the normal to the surface of the object (a bond drawn as a cylinder for example) with respect to the incident light but does not depend of the position of the viewer (i.e. the diffuse reflection is emitted by the object with the same intensity in all directions). specular behaves like diffuse except that this time the position of the viewer is taken into account, the intensity is maximal when the viewer is in the direction of the reflected rays. Using a big specular component will make the material look metallic, like a mirror.
- fogdensity coeff: tunes the density of the fog. Parts of the structure which are far from the user are mixed with the background color and this effect increases with the distance from the view point. Sometimes this effect is too big or too small and it is needed to change the density of the fog. The values to use ranges from 0 to 0.2, 0 means that no fog is used. It is also possible to tune the fog with the mouse in the 3D window.
Detailed description of selection patterns
ViTO has a powerful way to select atoms, very similar to Rasmol (which guided the design). Many extensions are provided using the alignments (selection according to the conservation rate of amino acids, ...) . Instead of giving a BNF description of the syntax, we will give examples.
select amino/hetero; select the amino acids or hetero groups.
select ILE; selects all isoleucine residus.
select ILE:34; select the 34 isoleucine;
select within(10.0, ILE:34); selects all atoms that fall at at less than 10.0 angstroms from isoleucine 34.
select 20,30; selects the residus from 20 to 30. (PDB numbers).
select selected and water; select water among the selected residus.
select selected or hetero; adds the hetero groups to the selection.
select not selected; inverts the selection.
select *; selects everything.
select 20,30:A; selects from 20 to 30 in chain A.
Combinations of this simple rules lead to powerful selection patterns. For example:
select within(7.0,ADP) and not hetero; will select amino acids around ADP.
Some selection expression deals with the alignment:
select conserved; will select those group which are conserved among the family defined with the "set colorization list" menu command.
select aligned; select the aligned residues.
select variability(80,100); will select residus whose conservation rate falls between 80 to 100% in the family.
These "alignment aware" selection commands are useful to map phylogenic information on the 3D structure. It is possible with simple macros to do what programs like consurf do.
Using the macro panel
ViTO has a build-in macro editor to create, load and save macros. The window looks like :
The file menu allows you to load or save macros or to create new macros. The currently created or loaded macros names are displayed in the left part of the window. In the second part the commands corresponding to the selected macro in the list are displayed.
Next to come
As you probably noticed, the language is very simple and cannot be considered as a programming language. There is no control structures, no way to define functions, and it is impossible to do any calculations. We are currently working to develop a full featured programming language. This is a work in progress but it won't be released before the next version of the program.
Examples of macros
As an example, we will give two macros that map phylogenic information onto the 3D structure. These macros can be readily used using the macro panel.
# highlighting conserved residus
with 1efn;
select not conserved;
shade 0.7;
select conserved;
sidechain 0.3;
This small macros makes the the conserved residues apparent. Note that line beginning with # are treated as comments.
A more complicated example :
with 1edo;
select *;
color white;
spacefill on;
select conserved;
color red;
select variability(80,99.99);
color orange;
select variablity( 50,79.99);
color yellow;
select variablity( 20,49.99);
color 1.0 1.0 0.5;
In this second example a color ramp is built which highlights the most selected areas in the 1edo structure.