Running a Demo

A Chimera demo can be started by opening a demo source file or a Chimera web data file that has a demo embedded. Demos included within the Chimera installation directory can be started from the Tools... Demos menu.

At each stage or "panel" of a demo, changes may occur within the main Chimera window, and explanatory text is shown in a separate dialog. Buttons on the dialog control the demo:

The models in the demo can be moved as desired; changes in position and scale are automatically corrected for by the demo mechanism. The demo currently in use can be saved.

Within a demo, text shown as a link may be a standard link to a web page (URL) or may connect to a set of commands or code that will execute when the text is clicked. Right-clicking on the link text brings up a context menu to:

In addition, a linked URL will be shown in a balloon when the cursor is hovered over the link text.

Creating a Demo

The Demo extension provides for the creation and replay of demos in Chimera. A demo consists of operations in Chimera and explanatory text shown in a dialog window. One demo may include several panels, where a panel generally consists of:

Operations that may be included are currently limited to those which can be expressed as commands.

Within a Chimera installation, each directory under share/Demo/demos/ represents one demo and must contain a source file (instructions for the demo) named demo.src. For example, the file share/Demo/demos/COX_Demo/demo.src contains the instructions for the demo that is started by choosing Tools... Demos... Cyclooxygenase Demo from the menu. The name that appears in the menu is set within the file share/Demo/ChimeraExtension.py.

Any demo (regardless of whether it is in the Chimera installation directory) can be run by opening the associated demo source file. Data files opened by the demo should be in the same directory as the source file.

Tools... Demos... Save Current Demo As... brings up a dialog for saving the source file of the current demo. Any associated data files will be saved in the same directory as the source file.

Demo includes a built-in mechanism for resetting positions to correct for any manipulations by the user. Clicking Next regenerates the position directly due to the commands of the current panel (in case the user had subsequently moved anything) before executing the commands of the following one. Clicking Back executes any undo commands and then regenerates the position due to the commands of the previous panel.

Chimera Demo Source Files

The Chimera demo source file type can be designated by the suffix .src (part of the filename) or the prefix demo: (not part of the filename).

The demo source file format is similar to XML in that tags delimit different types of information. The tags are described formally below; it may also be useful to view an example. Each tag must be on a line by itself. If the start tag for a certain element is included, the corresponding end tag must also be included.

TagMeaning
[INFO]
[END INFO]
Start and end of general information about the demo (optional). Possible contents:
  • TITLE demo title
    where demo title is the title shown on the demo dialog; if this is not supplied, the title will be derived from the name of the demo directory (any underscores will be changed to spaces).

  • AUTODELAY N
    where N is the global autodelay in seconds (default 5); this is the time to pause after executing the commands for a panel when AutoRun is being used and an individual autodelay has not been specified.

  • AUTORUN_ON
    meaning that the demo should start in AutoRun mode

  • IMAGE mypic
    where mypic is a file containing the image shown on the demo dialog; possible formats are bitmap (*.bmp), GIF (*.gif), JPEG (*.jpg), PNG (*.png), and TIFF (*.tif). The unscaled image will be placed in the upper left; dimensions of roughly 100 by 100-250 pixels (width by height) are recommended. If no image is specified, the dialog will show the Chimera logo on a black background.

  • BG_COLOR color
    where the background color is used to fill in the left side of the demo dialog under the specified image. The width of the rectangle of color will match the width of the image. If an image is specified but the background color is not, a light gray will be used (the same color as the rest of the demo dialog). If no image is specified, the dialog will show the Chimera logo on a black background.
[START]
[END]
Start and end of information pertaining to a given panel, without specification of an individual autodelay.
[START AUTODELAY=n]
[END]
Start and end of information pertaining to a given panel, with specification of an individual autodelay n. This is the time in seconds to pause after executing the commands in the panel when AutoRun is being used. An individual autodelay overrides any global autodelay.
[TEXT]
[END TEXT]
Start and end of a block of explanatory text for a given panel (optional). The use of several HTML tags is supported within this section:
  • headers (but h1, h2, and h3 give the same result)
  • bold, italic, and underlined text
  • font color specifications (all Chimera color names can be used)
  • relative and absolute font size specifications
  • paragraphs and line breaks
  • ordered and unordered lists
  • preformatted text
  • links to web pages:
    <a href="http://www.cgl.ucsf.edu/chimera/">Chimera home page</a>
In addition, links to Chimera commands or Python statements to be executed in Chimera can be constructed analogously to links to web pages:
  • Chimera commands:
    <a cmd="open 3fx2">open the structure</a>
    <a cmd="color red; repr sphere">show as red spheres</a>
  • Python: <a pycode="chimera.openModels.open('3fx2', type='pdb')">open the structure with Python</a>
Only single quote marks should be used within a command or statement, to avoid confusion with the double quote marks enclosing the command or statement.
[COMMANDS]
[END COMMANDS]
Start and end of commands for a given panel (optional).
[UNDO]
[END UNDO]
Start and end of commands that undo the commands for a given panel (optional). If undo commands are present, the demo dialog Back button will be enabled for the panel.

The demo developer is responsible for determining what commands are needed to undo all operations other than positioning/scaling. If the commands for the panel only change positioning and/or scaling, an empty set of undo tags can still be included so that the Back button will be enabled.

UCSF Computer Graphics Laboratory / October 2004