3. A New MOE-Script for Improved Visualization of PLS-QSAR-Equations
3.4. Concepts of Visualization
3.4.5. A Pseudo-Multiple-View Mode for Comparison
The script allows for visualizing one compound. As a result, an inter-molecule comparison of contributions is hardly possible, especially for complex molecules: The user first has to view molecule one, remember the general picture of colour-codings, switch to molecule two and compare it with the memorized properties from molecule one. One solution supporting the user’s efforts in comparing different molecules is a simultaneous depiction of more than one molecule, as an example by splitting the screen or opening a new graphics window.
Tripos SYBYL. Tripos SYBYL offers four display areas into which molecules or group of molecules, each represented by a so-called molecule area, can be loaded independently. Additionally, various view modes are available, ranging from superimposing all four areas in
the center of the screen to a quartered screen mode, where each display area has its own section of the whole graphics screen. Each molecule area can be hidden or adapted in visualization style separately, allowing for flexibly adapted individual view modes. Most importantly, the user can move or rotate each display area and even each molecule separately using the “Mouse Focus” tool or a special key combination to set the focus. SYBYL does not only rotate the molecule structure, but also includes all graphics objects associated with the currently focused atoms, as an example surfaces. Resultingly, the molecules including their graphics objects like wirespheres can be oriented easily as the user prefers (compare [73]).
MOE. In contrast to SYBYL, MOE does not implement a multiple view environment, al- though a special split mode in principle would be available via Render — Stereo — Left-Right. This view mode just serves as a stereo view, so the content of one side is “mirrored” and the sides cannot be addressed separately. As a result, it is of no use for our intention. Of course, it is possible to load more than one molecule to the so-called MOE Window, but these molecules are not independent of each other. There doesn’t exist an easy option to arrange molecules within the window, and when using the standard dials at the bottom, MOE moves the camera position looking at the atom system and not the molecules themselves [34, MOE Window]. Neverthe- less, it is possible to rotate or shift an individual molecule by pressing <SHIFT>+<ALT> during dialling, but in this case, only the atoms and bonds are included. Other graphics objects like surfaces or the wirespheres used as an activity marker introduced in section 3.4.1, and even text labels are ignored, making the whole system uninterpretable.
Workaround. Due to the necessity of a comparison mode, we decide to provide a very basic multiple-view mode, which is only “virtual” as it doesn’t separate the molecules from each other, but allows for shifting and rotating molecules including graphics objects attached to them. It also offers some basic distribution options for up to four compounds. Additionally, we implement a script-specific tool for switching through the database, which also helps the user to keep control over the displayed molecules. As a result, it is possible to display up to four compounds simultaneously, re-orientate molecules to the user’s requirements without losing touch with the attached graphics objects. Still, this is just a basic workaround, which does not have independent work areas resulting in possibly wrong calculation of 3D-descriptors and the like, as the molecules can act out influence on each other. It neither provides shortcuts nor options to easily select and move a molecule, which still has to be done using MOE’s shortcut methods pressing <SHIFT>+<ALT>.
Basically, the concept relies on one watchdog task for each presented molecule, which controls the atom positions in very short time intervals. We set this period to 0.2s, and if any position
coordinate of one atom differs more than 0.01 from the previous check, the attached wirespheres and labels are moved for the same distance. In MOE, each graphics object is assigned a key after it has been created usingGCreate ’title’(compare section 3.4.1). This key can be used to modify properties, as an example positions using GTranslate[], which expects a graphics key as well as a translation vector as parameters [34, Graphics Objects Functions]. To keep track on the molecules and objects, some static variables are needed which are accessible throughout the whole programme file. molKeysholds the database keys of molecules currently displayed, moleculesthe molecules themselves. Another variable is needed to keep track on the objects, runningChildTasks(i) saving the keys of all child tasks associated with the ith
molecule currently displayed. The task creation function, goFollow[atoms, obj_keys], is called every time textual labels or wirespheres are created (functionswiresphereAtoms[]and drawView[]), with the atoms to be watched and the keys to the graphic objects to be moved as parameters. After determining the initial atom positions viaaPos, the main parent task is split usingtask_fork(see listing 3.21). This MOE function returns both the ID of the parent/child task and the type of the current task, in this case “” for the parent task and “child” for the child. So from this line on, two separate tasks are continuing with the script. Subsequently, an if
.... then structure allows for differentiating between the tasks — if the second item given back is equal to “child”, which is only true for the child task, the script enters the watching function. It consists of a simpleloopand compares old and the positions of the atoms to watch. The parent task continues within theelsebranch, returning the ID of the child task.
1 function goFollow[atoms, gokeys] 2 local oldpos = aPos atoms;
3 local newtask = task_fork[master:’parent’]; 4 if second newtask == ’child’ then
5 loop
6 local newpos = aPos atoms;
7 if anytrue (abs(newpos - oldpos) > 0.01) then 8 local pos_div = tr (newpos-oldpos);
9 gokeys = cat gokeys;
10 local trans = app cat apt append [gokeys,pos_div]; 11 app GTranslate trans;
12 oldpos = newpos; 13 endif 14 sleep 0.2; 15 endloop 16 exit[]; 17 else
19 endif
20 endfunction
Listing 3.21: The task splitting functiongoFollow[].
If a molecule is deleted from the area, we kill the associated child tasks and remove all graphic objects as well as the molecule itself. This is done by the functionremoveMolecule[number] and its helper functionremoveViewOptions[].
Another problem of a multiple view mode is the positioning of the individual molecules. By default, MOE arranges all molecules in the center of the MOE Window producing an over- lay. To simulate different drawing areas in order to avoid graphical interference, the function setMolPositions[]is called every time the display window is redrawn or a molecule is closed. This function distinguishes between a single molecule, where the molecule’s position remains default, and a two-, three- and four-molecules case. For two molecules, we arrange the items on the left and the right side for two reasons: On the one hand, the navigation bar displayed at the top blocks horizontal screen space, on the other hand, typical computer displays’ screens have changed from 4:3 to 16:10, thus giving more horizontal space. For the three molecules view, we arrange the molecules in three columns. If four molecules have to be displayed, they are arranged within a 2 × 2 matrix.
Before adjusting the molecules’ positions, we have to center them in the middle of the screen, which is necessary if the distribution method before has already spread the items. We simply take the arithmetic average over all atoms of each molecule, which then represents the deviation of the molecules’ middle points from the real center having in MOE Window the coordinates [0, 0, 0]. Then the atoms are translated usingaSetPos[]. After the centering step, the molecules are redistributed. For two in parallel, we get the maximum x-coordinate of the first as well as the minimum of the second, shifting the first molecule this maximum value to the left (subtracting), the second to the right (adding). The three molecules view takes also both the minimum and maximum values of the third molecule into account, which remains in the center. Then the first molecule is shifted by the summed up maximum x-coordinate plus the minimum x-coordinate of the third molecule to the left, the second similarly to the right. To obtain the matrix of four molecules, the y-coordinates are additionally taken into account. The first is moved its mini- mum y-value and maximum x-value to the top and left, respectively, the second its minimum y-value and minimum x-value to the top and right, and so on. Theoretically, additional view options could be specified for five or more molecules, they simply have to be added via an elseifto thesetMolPositions[]function.
At any case, we additionally put a one-unit-wide space between all molecules to additionally separate them. The associated objects which are already in place during molecules translation
are automatically translated by the watchdog.