# # Copyright (C) 1999-2004 Liz Potterton, Peter Briggs # # This code is distributed under the terms and conditions of the # CCP4 Program Suite Licence Agreement as a CCP4 Library. # A copy of the CCP4 licence can be obtained by writing to the # CCP4 Secretary, Daresbury Laboratory, Warrington WA4 4AD, UK. # #CCP4i_cvs_Id $Id$ #=========================================================================== # # astex_viewer.script # #=========================================================================== #---------------------------------------------------------------------- proc AstexViewerWriteFileHeader { title } { #---------------------------------------------------------------------- # Writes the header for the html page to display structures ligands and # maps, including Javascript codes for manipulating the display. WriteToLog " AstexViewer: $title

AstexViewer: $title

" -noheader -nofooter return } #---------------------------------------------------------------------- proc AstexViewerWriteMapControls { map_file n contour0 contour1 contour2 } { #---------------------------------------------------------------------- # Write the controls for the map viewing in the AstexViewer applet set name "map$n" WriteToLog "$map_file" -noheader -nofooter for { set i 0 } { $i < 3 } { incr i } { # Set the colour for this contour control switch $i { 0 { set bgcolor "red" } 1 { set bgcolor "orange" } 2 { set bgcolor "blue" } } # Write the opening table element for this contour control WriteToLog "" -noheader -nofooter set select_name "c[subst $name]$i" WriteToLog "\n" -noheader -nofooter # Make sure checkbox is checked for first contour set checked "" if { $i == 0 } { set checked "checked" } # Write the control WriteToLog "" -noheader -nofooter WriteToLog "" -noheader -nofooter } # End the table row WriteToLog "" -noheader -nofooter return } #---------------------------------------------------------------------- proc AstexViewerOpenApplet { height width } { #---------------------------------------------------------------------- # Write the applet code for creating the AstexViewer embedded in a # html page WriteToLog "

0 } { WriteToLog "center molecule ligand*; display wide molecule ligand*; colour purple (atom C* and molecule protein*) and not sphere 12 around molecule ligand*;" -noheader -nofooter } # Write the end of the applet WriteToLog "\">

" -noheader -nofooter return } #================================================================= # Initialise set first_protein "" set first_ligand "" # First the header which contains the Javascript commands for # interacting with the viewer applet AstexViewerWriteFileHeader $TITLE # Write the table with the list of proteins to # be displayed if { $NPROTEINS > 0 } { WriteToLog "

Proteins
" -noheader -nofooter # Write a line for each structure for { set n 1 } { $n <= $NPROTEINS } { incr n } { set name "protein$n" if { $n == 1 } { set checked "checked" } else { set checked "" } set label [file tail $XYZIN($n)] WriteToLog "" -noheader -nofooter } # End the table WriteToLog "
$label

" -noheader -nofooter } # Write the table with the list of ligands to # be displayed if { $NLIGANDS > 0 } { WriteToLog "

Ligands
" -noheader -nofooter # Write a line for each ligand for { set n 1 } { $n <= $NLIGANDS } { incr n } { set name "ligand$n" if { $n == 1 } { set checked "checked" } else { set checked "" } set label [file tail $LIGAND($n)] WriteToLog "" -noheader -nofooter } # End the table WriteToLog "
$label

" -noheader -nofooter } # Write a table with the map controls if { $NMAPS > 0 } { WriteToLog "

Maps
\n" -noheader -nofooter # Write out a line for each map for { set n 1 } { $n <= $NMAPS } { incr n } { set map_file [file tail $MAPIN($n)] AstexViewerWriteMapControls $map_file $n $CONTOUR_LEVEL(1) \ $CONTOUR_LEVEL(2) $CONTOUR_LEVEL(3) } # End the table WriteToLog "

" -noheader -nofooter } # Write out the start of the applet code AstexViewerOpenApplet $APPLET_HEIGHT $APPLET_WIDTH # Proteins for { set n 1 } { $n <= $NPROTEINS } { incr n } { if { $first_protein == "" } { set first_protein "protein$n" } WriteToLog "molecule load protein$n '$XYZIN($n)';" -noheader -nofooter } # Ligands for { set n 1 } { $n <= $NLIGANDS } { incr n } { if { $first_ligand == "" } { set first_ligand "ligand$n" } WriteToLog "molecule load ligand$n '$LIGAND($n)';" -noheader -nofooter } # Maps for { set n 1 } { $n <= $NMAPS } { incr n } { set name "map$n" WriteToLog "map load $name '$MAPIN($n)'; map $name contour 0 off; map $name contour 1 off; map $name contour 2 off; map $name contour 0 $CONTOUR_LEVEL(1); map $name contour 1 $CONTOUR_LEVEL(2); map $name contour 2 $CONTOUR_LEVEL(3); map $name contour 0 on;" -noheader -nofooter } # Close the applet and end the file AstexViewerCloseApplet $NLIGANDS $first_protein $first_ligand WriteToLog "

Documentation for the AstexViewer controls can be found here.

Please read and abide by the Conditions of Use.

" -noheader -nofooter