Example 10

<!-- Meaning short title to appear in Hot List etc. --> <TITLE> MOOSE - Fast Protein Structure Search by Conformational Likeness </TITLE> <!-- Set background color to white --> <BODY BGCOLOR="#FFFFFF" > <!-- CGI script to accept input from the form --> <FORM METHOD="GET" ACTION="http://xtal1.sdsc.edu/misha/cgi-bin/misha1.cgi"> <P> <CENTER> <H2>Fast Protein Structure Search by Conformational Likeness</H2> <B>Other Queries:</B> <A HREF="http://db2.sdsc.edu/moose">Moose</A> | <A HREF="misha.html">Alignment</A><P> <HR> <!-- Define a text box that can contain up to 8 characters and with an initial value of 4HHBA. The value entered will be assigned to the name value of entity_code1 --> <B>Entity:</B> <INPUT NAME = "entity_code1", VALUE="4HHBA", SIZE=8> <HR></CENTER> <!-- Define a radio button which is on by default (CHECKED). The value "julia" will be passed to the CGI and equated with the name "ent_or_frag" --> <INPUT TYPE="radio" NAME="ent_or_frag" VALUE="julia" CHECKED> <B> Entity Search </B><P> <!-- Define a second radio button which is not on. Since the name value is the same selecting this button will deselect the previous button --> <INPUT TYPE="radio" NAME="ent_or_frag" VALUE="misha" > <B> Fragment Search <!-- Associate two additional text boxes with the radio button. Note that this is a loose association, that is, values entered here will not be used unless the button is selected (this is controlled by the CGI script not the form). --> From </B> <INPUT NAME = "entity_frag1", VALUE="10", SIZE=4><B> To </B> <INPUT NAME = "entity_frag2", VALUE="30", SIZE=4> <HR> <!-- Define a scrollable list of options. Since this list lacks the MULTIPLE attribute the single option selected will be equated with the name variable "mode" . SIZE = 10 indicates that 10 options on the list will be visible without scrolling. The OPTION designated as SELECTED is the default. --> <CENTER> <B>Select Mode:</B> <SELECT NAME="mode" SIZE = 10> <!-- Without the VALUE attribute "mode" is defined by the option value e.g., LocalDist --> <OPTION> LocalDist <OPTION> LocalAngle <OPTION> LocalTwist <OPTION> LocalSurface <OPTION> LocalPhiPsi <OPTION SELECTED>LocalSecStr <OPTION> SeqPAMatrix <OPTION> FeatSurface <OPTION> FeatShape <OPTION> FeatFreq <!-- Options omitted here --> </SELECT> <HR><P> <B>Length Criterion:</B> <!-- Define a pop-up list (distinguished from a scrolling list by the lack of a SIZE attribute). Again the SELECTED OPTION defines the default value. --> <SELECT NAME="length"> <OPTION VALUE=10 SELECTED> 10% <OPTION VALUE=50> 50% <OPTION VALUE=200> 200% <OPTION VALUE=300> 300% <OPTION VALUE=1000> Any </SELECT> <B>Likeness Criterion:</B> <!-- A text box as describe above. --> <INPUT NAME="likeness", VALUE="0.25", size=6> <P> <I> Click <A HREF="julia_help.html"><B>here</B></A> for details.</I> <HR><BR> <!-- The input type hidden does not appear on the Web form but sends the value "search" to the CGI with a name value of "query_type". The VALUE attribute for the submit and reset buttons defines the text that appears in the buttons. --> <iINPUT TYPE=hidden NAME="query_type" VALUE="search"> <INPUT TYPE=submit VALUE="EXECUTE QUERY"> <INPUT TYPE=reset VALUE="RESET FORM"><BR> </CENTER> </FORM> <!-- End of form --> <HR> </BODY>
#!/usr/local/bin/perl # This script simply takes the input from the Web form (Figure 103) and # converts it to a command string that is executed on the server and the results # are returned as HTML to the client Web browser. # Define locations (server dependent) for temporary files. $SCRATCH_PATH = "/scratch/s1/moose_output"; $SCRATCH_URL = "http://xtal1.sdsc.edu/scratch"; # Include a Perl library which contains a routine to parse the input string from # the GET operation. require "cgi-lib.pl"; # Routine from cgi-lib.pl to parse the input stream into array input. &ReadParse(*input); # Build a variable "command" from the input parameters. Note that the # "query_type" is the hidden variable in the above form. In the above form # the value of "query_type" is "search" hence this part of the script will # get executed by submitting the above form. This offers a convenient way to have # a single Perl script process multiple Web forms. if($input{'query_type'} eq 'search') # Build the command string from the input array. { $ent1=$input{'entity_code1'}; $mode=$input{'mode'}; $length=$input{'length'}; $likeness=$input{'likeness'}; $ent_or_frag=$input{'ent_or_frag'}; $command ="/misc/x1/moose/pon/"."$ent_or_frag"." "."$ent1"." "."$mode".","."$length".","."$likeness"; # Modify the command string for the fragment case. if($ent_or_frag eq 'misha') { $frag1=$input{'entity_frag1'}; $frag2=$input{'entity_frag2'}; $command .=","."$frag1".","."$frag2"; } # Define the output to be sent back to the Web client. # First define the content type and header information. print "Content-type: text/html\n\n"; print "<TITLE>Pure Output</TITLE>\n"; print "<BODY BGCOLOR=\"#ffffff\">\n"; # Execute the command appending an HTML line break to each line. open (RES, "$command |"); while (<RES>) { print; print "<BR>"; } print "</BODY>\n"; }