I. Design Concept: Presentation Contents Go Within the PDB File Header
In a scheme begun in 2003, the entire contents of a presentation are within the header of the PDB file(s) that contain the atomic coordinates needed for the presentation. The presentation contents are specified in a PiPE block inserted at the top of the PDB file header. Here is a schematic illustration of this.
The in-PDB-header scheme occurred to us only when we had begun to work with the PDB header within PE in late 2002. Access to the PDB header within PE (javascript) was problematic until Jean Holt of MDL kindly implemented a new feature in Chime 2.6 (released December 2000) at the request of Eric Martz. This new feature is a command "show pdbheader" that conveys the entire PDB file header to javascript via Chime's messageCallback() mechanism. Jean-Philippe Demers implemented the initial code that obtains the header from the message stream and parses it (September 2001).
II. Format of the PiPE Block in the PDB File Header
What is the "PiPE block"? Ordinary PDB files can be thought of has having two "blocks" of different kinds of infomation: the "header block" and the "atomic coordinate block". PDB files used in PiPEs are modified by adding a third block, the "PiPE block", to the beginning of an ordinary PDB file. The "PiPE block" is a block of text lines that specify what your Presentation looks like, and what views it produces. It contains the html, javascript, and PE/Chime command scripts that make up your Presentation. Here is a schematic diagram of the PiPE block.
Structure of the "PiPE block":. The PiPE block is a single, uninterrupted block of lines inserted into the PDB file header that specifies a presentation. Although the PiPE block can be located anywhere within the header, it is recommended that the PiPE block be first, followed by the original PDB file header. The format of the PiPE block is as follows.
!html Here is some <b>bold text</b>.
!html This sentence is completed ! on a continuation line.
!html This sentence is completed !! (this comment line is ignored) ! on a continuation line.
!js put_button("@spt view05", "details_view05", ! "1d66.pdb");
!js.init pipe_background_color = "black"; ! pipe_start_spinning = true;
!spt #name=view03_uncertainty ! select all ! color temperature # uncertainty of atomic position ! spacefillIn command scripts, anything after "#" (until the end of the line) is a comment when processed by Chime. The "#name=whatever" is ignored by Chime, but it is not ignored by PE, which uses it to assign the specified name to the script. "# uncertainty of atomic position" is ignored by both Chime and PE.
!color color_medium_blue A0A0FF !color color_dark_red D00000 #optional comment here
!details #name=details_EF_hand ! <center><big> ! The EF Hand ! </big></center> ! ! The EF hand of recoverin binds calcium with oxygens of two ASP's, one GLU, ! one THR, and one ASN. Mostly sidechain oxygens are involved, but ! also two backbone oxygens. !
Don't worry about the details of Chime command script language lines shown in the examples below. The command language is documented at MolviZ.Org, but you don't need to learn it. PE's Recorder will record the commands you need, and you can simply paste them into named scripts in the PiPE block, and then call them as explained below.
!js.init pipe_title = "Structure of Collagen"; ! pipe_title_enlarged = true; // set to false for smaller title ! pipe_subtitle = "Chapter One";Warning: The titles themselves must be quoted as shown. Failing to quote them will produce a javascript error that will cause PE to stall during startup! In contrast, the variable named "pipe_title_enlarged" can be assigned values of true or false, and these words must not be quoted (they are Boolean values).
By default, the background color is white, and the message box is hidden. A PiPE chapter will start with a black background and a visible message box when:
!js.init ! pipe_background_color = "black"; // default is white. ! pipe_show_commands = true; // default is hide message box, etc.
It is a good idea to leave the molecule spinning at all times during a talk. Your audience is not familiar with the structure, and when it stops spinning, the 3D structure becomes flat and dead. Therefore, PE's default is to start spinning. However, to conserve computer CPU resources (especially when concurrent PE sessions are running), spinning stops by default after 3 minutes. (Of course it can be turned back on by clicking the Spin button, but only for 3 more minutes per click.) PE has a Preference setting that determines whether spinning will be on or off at the outset of a new session. This preference setting can be overridden in a PiPE chapter. To guarantee that the molecule is spinning at the outset, and to prevent spinning from stopping automatically after 3 minutes, use these javascript assignments:
!js.init ! pipe_start_spinning = true; // default is PE's Preference setting. ! top.nonStopSpin = true; // default: spinning stops after 3 min.A mechanism is also provided to guarantee that a particular molecular-view button will always start its view spinning (or not spinning). Include these lines at the end of the command script.
... [script starts above] ... ! spin on ! javascript top.spin = true;Note that the last line is a script command, not a !js statement. ("javascript" is a command to Chime, causing Chime to execute the specified javascript command.)
Similarly, a mechanism is provided to guarantee that a particular molecular-view button will always produce a view with a specified background color, regardless of the background color prior to pressing the button. To guarantee a black background, add this line to the end of the command script:
... [script starts above] ... ! javascript top.force_background_color("black");
A script named, for example, active_site_spt, is invoked in another script with the syntax "@spt active_site_spt;".
!js put_button("select :a; color purple;");Alternatively, the button can call a named command script, for example (assuming a script named "view01" has already been defined)
!js put_button("@spt view01;");The word "@spt" preceding the script name signals calling a named script. Scripts can call other scripts, for example
!spt #name=view02 ! @spt view01 ! select :b ! backboneSimilarly, calls to scripts can be included among other commands in a molecular-view button script, for example
!js put_button("@spt view02; select :c; cartoon;");In addition to changing the molecular view by sending commands or command scripts to Chime, the put_button() function can specify a named block of details to be displayed in a popup window. The details must always be defined and named earlier in the PiPE block with a "!details" line (see above) The details-name must always be the second parameter, for example:
!js put_button("@spt view01;", "details_view01");All the above examples of "put_button()" employ the atomic coordinates ("molecule") included in the primary PDB file -- the same file that includes the PiPE block. However, a third parameter to "put_button()" may specify that the script be applied after a different PDB file (a secondary PDB file) is loaded into Chime. For example:
!js put_button("@spt view03;", "", "1d66.pdb");Note that in the above example, when no details were specified, the second parameter must be given as "" (an empty string of characters) in order to make the PDB filename the third parameter. Alternatively, the name of a details block could have been given in the second parameter.
Once a secondary PDB file has been loaded, any "put_button()" that does not specify an explicit PDB file will re-load the primary PDB file coordinates before applying its script.
If a molecular-view button's script should be applied to whatever PDB file is loaded when the button is pressed, the third parameter in that "put_button()" must be "*".
Only one copy of a large PDB file need be present. This is illustrated by the following hypothetical example:
!spt #name=dull_green_ligand ! select ligand ! color @color_dull_green ! !spt #name=color_ssbonds ! color ssbonds @color_sulfur
!html <font @color_dull_green><b>Ligand</b></font>The above html fragment writes the word Ligand in color_dull_green and boldface.
!spt #name=c1 ! @for $=0, 2 ! @spt select_grade$ ! @spt select_and_chain ! color @color_grade$ ! spacefill ! @endfor
Formatting requirements are as follows. Failure of any of these requirements will generate an appropriate fatal error message.
When properly formatted, the above script will be expanded to the following. Note that a copy of the segment between @for and @endfor is repeated once for each iteration, and that in each copy, $ is replaced with the number of the iteration.
!spt #name=c1 ! @spt select_grade0 ! @spt select_and_chain ! color @color_grade0 ! spacefill ! ! @spt select_grade1 ! @spt select_and_chain ! color @color_grade1 ! spacefill ! ! @spt select_grade2 ! @spt select_and_chain ! color @color_grade2 ! spacefill
In order for the above script to work script must have been defined with names select_grade0, select_grade1, etc. and colors must have been defined with names color_grade0, color_grade1, etc.
Again, most of the elements described above are illustrated in the PiPE Template.