next up previous
Next: 0.3.2 Using Multipart (almost Up: 0.3 Data Processing Previous: 0.3 Data Processing

0.3.1 Naive way (almost specifically Sequence data)

In this subsection we will check out how we can pass data (text pretty much, I guess) from one HTML/CGI script to another using a textfield or textarea. This is quite a naive way of doing it especially as the size of data goes up. Either way we do come across a lot of webpages with such an interface.

Create a HTML file called ``/var/www/html/L529guest/agopu/clustalw.html'' (as usual replace `agopu' ....) with the following content. A brief discussion follows the source code.

 
<html>
<title> Clustalw TEST </title></head><body><br>
<nobr>
<h1> Clustalw TEST </h1> <br>
                                                                                                                             
<form action="/cgi-bin/L529guest/agopu/clustalw.pl" method="post">
<input type="submit" value="Do it "><input type="reset" value="Clear">
<br>
Type or cut and paste your sequence in FASTA format in here <br>
<textarea rows=10 cols=50 name="atext">
</textarea>
</form>
                                                                                                                             
</body></html>

Create a CGI script called ``/var/www/cgi-bin/L529guest/agopu/clustalw.pl'' (as usual replace `agopu' ....) with the following content.

#!/usr/bin/perl
                                                                                                         
use CGI qw(:cgi-lib);
ReadParse();
                    
$q = $in{CGI};
                    
my      $CLUSTALW="/usr/local/bio/bin/clustalw";
my      $DIR="/tmp/";
my      $TMPSEQS=$DIR."myseqs".$$;
                                                                                                         
$|=1;
print "Content-type: text/html\n\n";
                                                                                                         
print "<pre>";
print "<br> Temp sequence file is $TMPSEQS <br>\n";
                                                                                                         
open(THISF, ">$TMPSEQS") or die "open $TMPSEQS failed";
print THISF  $q->param(-name=>'atext');
close THISF;
                    
system ("$CLUSTALW $TMPSEQS > $TMPSEQS.out 2>&1");
                    
open(FILE, "$TMPSEQS.aln") or die "open $TMPSEQS.aln failed";
print "<br> Alignment: <br>\n";
while(<FILE>) {
  print "$_";
}
close FILE;

Do not forget to change permissions for these files as shown in the previous section:

[L529guest@biokdd agopu]\$ chmod 755 /var/www/cgi-bin/L529guest/agopu/*.pl
[L529guest@biokdd agopu]\$ chmod 644 /var/www/html/L529guest/agopu/*.html
This is the stuff you can expect to see on your browser if you visit:

http://biokdd.informatics.indiana.edu/L529guest/agopu/clustalw.html

(Replace `agopu' with your user name or whatever you named your directory to be. Remove `L529guest' if you are using your own account.)

Figure 1: Screen shot of Clustalw.html
\begin{figure}\epsfig{file=images/clustalw1.ps, width=16cm}
\end{figure}

Enter some sequence data in the textarea and hit the ``Do It'' button. This is what you can expect to see:



Figure 2: Screen shot of Clustalw.pl script output
\begin{figure}\epsfig{file=images/clustalw2.ps, width=16cm}
\end{figure}


next up previous
Next: 0.3.2 Using Multipart (almost Up: 0.3 Data Processing Previous: 0.3 Data Processing
Arvind Gopu 2006-03-24