PiPE
Implementation
A document within Protein
Explorer
This document can be ignored by users of Protein
Explorer and authors of PiPEs. It provides a technical description of
the PiPE javascript for programmers interested in understanding or
modifying PiPE.
Generally, code that sets up the PiPE control panel is in protexpl and
shared, while code that operates after the PiPE control panel is set up
is in protexpl/pipe_sup. PiPE documentation is in protexpl/pipedoc.
- After thorough browser and Chime
compatibility testing, PE loads fs_1.htm which sets up two frames, the control frame
(fr_control) and the molecular image frame (fr_chime).
-
fs_1.htm loads queryids.js which sets top.pipemode from
query parameter pm= with possible values of "a", "i", "d" for audience,
individual, or development, or "" if unspecified..
-
When a PDB file is pre-specified (as a query parameter in
the link to
PE), PE loads the PDB file
into Chime in the molecular image frame.
-
If the PDB filename ends in _pipe.pdb or _pipe.mmol, PE hides the molecule so it can fetch
the view01 script from the PDB file header.
- The PDB file header is
retrieved via messageCallback() by sending "show pdbheader" to
Chime (or by loading filename_pipe_h.htm in IE, because in IE, "show pdbheader"
causes the browser to crash). (shared/hcquery.js)
-
If the
PiPE block exists (has nonzero length), hcquery.js
calls setup_pipe(), defined in
protexpl/pipe.js.
- setup_pipe() initializes font size etc. according to top.pipemode (audience, individual,
development). Default is development.
-
setup_pipe() calls parse_pipe() which parses the PiPE block into typed
subsegments or (sub) "blocks", emitting alerts if formatting errors are
detected.
-
js.init javascript is executed.
-
setup_pipe() calls set_pipe_controls() based on javascript variable assignments
processed in js.init. All variables have default values and are
optional except for the title.
- top.pec_cmdpct is set to 1 (%) or "" according to
pipe_show_commands (default: false)
- top.pec_bgcolor is set to pipe_background_color (default
"white")
- top.tpx_xld is set to pipe_title (no default, error alert
if missing)
- top.pec_start_spinning is set to pipe_start_spinning
(default "" = PE's preference setting)
-
The PiPE
control panel document defaults to
pipe_sup/pipe_cp1.htm (but a custom control panel document can be set
in js.init with pipe_cp1="filename.htm"). The filename is assigned to
- top.tpx_fn (used for links from the Site Map or other
control panels that return to the PiPE control panel)
- top.docfn_ur (used by fs_rite1.htm to display the initial
control panel).
-
fs_rite1.htm is loaded into the control frame -- now it
knows how large to make the lower left frame (large for the
message box,
or small for only the
PiPE controls).
-
pipe_cp1.htm, onLoad, executes write_pipe_control_page()
defined in pipe.js, which lays out the control panel and buttons
(calls to put_button()), diplaying
the PiPE control panel.
- If there is no view01 script defined in the PDB file
header, the molecular image remains blank with the correct background
color.
-
If there is a view01 script defined in the PDB file
header, it is sent to Chime, and if a button has that script attached,
that button is checked.
- The background color starts as specified (default white, or
specified with pipe_background_color in the js.init). Pressing the Bkg
button toggles the background in both the molecular image and in the
control panel. Button-scripts don't change the background
(unless individual scripts contain
commands to force the background), so the user
is free to toggle it at will.
-
Pressing a button executes button_visited(n) (defined in
pipe_sup/present.js) where n is the button number on the control panel
and an index into the array of scripts butspt[n].
- If put_button() specifies the name of a block of details,
a window is popped up to display the details (see popwin() in
pipe_sup/present.js).
- If put_button() specifies a secondary PDB filename, that PDB file
is loaded before the script is sent to Chime. If the secondary PDB file
contains a PiPE block in its header, it is ignored (top.isPIPE in
shared/hcquery.js).