MOOSE - Fast Protein Structure Search by Conformational Likeness
#!/usr/local/bin/perl
# This script simply takes the input from the Web form (Figure 10–3) 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 "Pure Output\n";
print "\n";
# Execute the command appending an HTML line break to each line.
open (RES, "$command |");
while () {
print; print " ";
}
print "\n";
}