RasCtrl Sample: MotVis
Download Sample
MotVis is a C# application using an embedded RasCtrl to visualize motifs with
special visual effects. It also allows a user to interactively select interested motifs. This sample demonstrates how to add motifs to RasCtrl, how to set drawing styles of the added motifs, and how to response to events invoked by user actions, such as selecting a motif.
In RasCtrl, a motif is defined as a substructure of protein containing a number of atoms. This definition is more general than the definition in the
Motif Space project, which defines a motif as a substructure containing a number of amino acid residues. This generalization enables motifs be visualized in more flexible ways. For example, a motif in the Motif Space project is commonly visualized as alpha carbons of the amino acids that constitute the motif. This visualization task can be achieved by define a motif in
RasCtrl, which only contains the alpha carbons.
Motifs are rendered by OpenGL, which enables rich rendering effects. Motifs can be shown as sphere, stick, or triangle representation. The color, transparency, and shading of a representation can be set arbitrarily. A motif can be labeled
using text.
New commands are defined to support adding motifs, removing motifs, and setting the appearance of motifs. Similar to the
RasMol
commands, these commands are executed by calling the ExecuteCommand method.
Refer to the motif command reference for the detailed description of the newly defined commands.
This sample shows how to handle the StringFeedbackEve event. StringFeedbackEve events are fired by the RasCtrl component to inform the client about user actions,
changes of RasCtrl internal state, and error messages caused by executing invalid commands.
Please run the application in the following three steps:
Step1: Download and run the application.
Step2: Copy the following script to the left textbox of the application window and press the Execute button. The lines starting as
'#' sign are comments of the script. If the PDB protein files are not in the c:\RasCtrl\data
folder, please modify the script to load proteins from the correct folder.
|
#clear old motifs
motif remove all
#clear old proteins
zap all
#load the first protein and set its appearance
load c:\RasCtrl\data\1CQD.pdb
wireframe off
spacefill off
ribbon off
backbone on
select all
color backbone yellow
#load the second protein and set its appearance
load c:\RasCtrl\data\1CS8.pdb
wireframe off
spacefill off
ribbon off
backbone on
select all
color backbone green
#disable picking atoms
set picking off
#enable picking motifs
motif picking on
#add the first motif.
#The motif ID is 0.
#the motif is in Chain A, the first protein.
#The motif includes 4 alpha carbons of the amino acids with residue number: 40 31 52 47
motif add 0 1 A 4 40 31 52 47
#Set the appearance of the motif with motifID 0
motif color 0 1 0 0
motif style 0 sphere 1.05
motif transparency 0 1.0
motif shading 0 on
motif label 0 sphere
motif labelcolor 0 1 1 1
#add the second motif.
#The motif ID is 1.
#the motif is in Chain B, the second protein.
#The motif includes 4 alpha carbons of the amino acids with residue number: 12 116 24 101
motif add 1 1 B 4 12 116 24 101
#set the appearance of the motif with motifID 1
motif color 1 0 1 0
motif style 1 triangle 12 0 1 2 0 1 3 0 2 3 1 2 3
motif transparency 1 0.6
motif shading 1 off
motif label 1 triangle
motif labelcolor 1 1 1 1
#add the third motif.
#The motif ID is 2.
#the motif is in the second protein.
#The motif includes 4 atoms with serial numbers: 15 200 500 800
motif add 2 2 4 15 200 500 800
#set the appearance of the motif with motifID 2
motif color 2 0 0 1
motif style 2 stick 12 0 1 1 2 2 0 0 3 1 3 2 3
motif linewidth 2 5
motif label 2 stick
motif labelcolor 2 1 1 1
#set the font size of motif labels
motif labelsize 25
|
The messages, which reflect the changes of RasCtrl internal state, are sent from the RasCtrl component to the client by invoking the StringFeedbackEve event. These messages are shown in the right textbox. The screenshot after executing the script is shown as following.
Step3: Select motifs by moving the mouse pointer to a motif and pressing down the left
mouse key. Multiple motifs can be selected by holding the shift key in selection. The messages, which contain motifIDs of the selected motifs, are shown in the right textbox.