Perl CGI Script : for a bioinformatics project

haravallabhan
haravallabhan used Ask the Experts™
on
Hi,

A client of mine wants to run the following script on a server /CGI. Basically the script shoud take an input from an user through a webinterface and then processes it through a variety of  scientific programs(in the server) and gives an output which can be downloaded.

I have attached the script as a txt file.

I would like to test the script for any errors that is attached and help modify it so that the script accepts an input via webinterface and processes it and provides the output in a different screen.

Can someone help on this ?
bioinfo-perl.txt
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
There really should just be a couple of steps involved in making this work...
To start off though, you need to make sure that you have all the necessary perl modules installed on your server to make this work...  At the top of the perl script you supplied, there are several lines that start with 'use'...   Besides 'use warnings' and 'use strict', you will need to make sure that you have installed the other modules...  You should be able to do this from linux command line by typing:
'perl -MCPAN -e shell'
This will bring you into CPAN's interface for dynamically installing perl modules on your server.
Then type:
'install Bio::Seq'
repeat the above line for each of the 'use' statements at the top of your perl script...

Once this is done you can start with making this work on the web in your 'web interface'...
First make an html page with a simple form which posts  to your perl script: <form action='bioinfo-perl.cgi' method='post'>
The form should contain an input field for the 'sequence'.  This 'sequence' is the variable which will be passed to your perl script.

Next edit your perl script.  Near line 45 you see '$sequence = .......'
Above that line insert (You should have CGI installed by default, if not use the MCPAN stuff above to install it):
use CGI qw(:standard);
$sequence = param('sequence');

Next either comment out or remove the original '$sequence = "PQITLW......' line, it is no longer needed...
Now you have accomplished creating your 'webinterface' which passes the data to your perl script!
The only thing left to do is make it so you can see the result, which appears to be the 'output' files described around line 20.   Now around line 124 is the exit of the perl script...
Just before that exit line, you can insert a couple of lines which will create output to the webpage...
For simplicity lets just make the output be 1 link to the output file you want the end user to see:
print header();  ### This uses a CGI qw(:simple) function to essentially begin your webpage...
print "<html><body><a href='http://www.domain.com/$output4'>$output4</a></body></html>";

That should now do it...   You may need to adjust the path (URL) for the link to the file to accomidate whereever the file is actually being saved on the server...   I have not gone through all of the 905 lines of your perl script, but it is possible you may need to hunt down a different file other than the ones listed around line 20 to find the real output you want to display...

One problem you are going to run into is the fact that this perl script was made to be run on the command line, so errors and other messages are just printed when the script is running, and they will not show up in the files your dealing with...  You can see this by searching within the perl script for:
print "
(That is print<SPACE><DOUBLEQUOTE>)
This will show you each line that is simply just printing its output to the command line, which you will not see in the files...
One solution to this could be to move the "print header();" line described above to the top of the file, just below 'use strict;' ... Then moving the 'use CGI qw(:standard);' line just above the print header() line...
This could force all of the printing that is done to be run through CGI and therefore all output to the page...   But now though, it will be all un-html-formatted text, therefore all run togeather...   You could then edit each print line to include <br> tags and such... You could play with it a lot and make it look pretty even  :)

I hope this helps you out!!
You could also just set the output type to text/plain with the print_header(), and the browser will render it in a fixed-width font, preserving linebreaks, spacing, etc.  If pretty isn't a prerequisite...
This is the part of Experts Exchange that sucks... People that ask questions and offer points for an answer, yet then don't ever check back or reply or anything...  

Just a big waste of everyones time!!!!

Author

Commented:
Hi,
Expert exchange offers a gap of about 28 days till which time the question can keep receiving answers. Expert exchange itself sends reminders to those who posted the question to allocate points once this period expires, otherwise they allocate the points themselves.

Patience pays.

Good luck

Author

Commented:
thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial