Problems with opening files using Bioperl(Bio::SearchIO) in CGI script

Marcus Claesson m.claesson at student.ucc.ie
Mon Jan 27 21:12:43 EST 2003


Hello,

I want to use Bioperl's blast parser as an cgi script but have run into
some problems. The purpose of the script is for web users to
parse their local blast output files and upload the result file onto my
server.

The Bio::Search module behaves differently than the "PerlCGI-way" to open
files. Here's an example:

Both these methods work fine when I run the script on a local file with
the right permissions:

#!/usr/bin/perl -wT
use CGI qw(:standard);
use Bio::SearchIO;
print $q->filefield(-name=>'file',      #A cgi function to browse and
select files to open
                    -size=>20),$q->br;
print $q->submit(-name  =>'upload',
                 -value =>'Upload file'),$q->br;
if (param('upload')) {
    $fh = $q->upload('file');
    $in = new Bio::SearchIO(-format => 'blast',
                            -file   => $fh);
    while(<$fh>) { #The 'normal' way to output the file contents in the browser
        print $_; 
    }
    while($result = $in->next_result) {
      etc,etc... 
    }
}

But when I try to open C:\Temp\blastfile.out from a remote windows station
I get this error message:

Mon Jan 27 10:58:38 2003] [error] [client 143.239.131.75] [Mon Jan 27
10:58:38 2003] bxbrowser1.pl: ------------- EXCEPTION  -------------,
referer: http://nsfm39.ucc.ie/cgi-bin/bxbrowser1.pl
[Mon Jan 27 10:58:38 2003] [error] [client 143.239.131.75] [Mon Jan 27
10:58:38 2003] bxbrowser1.pl: MSG: Could not open C:\Temp\blastfile.out
for reading: No such file or directory, referer:
http://nsfm39.ucc.ie/cgi-bin/bxbrowser1.pl
[Mon Jan 27 10:58:38 2003] [error] [client 143.239.131.75] [Mon Jan 27
10:58:38 2003] bxbrowser1.pl: STACK Bio::Root::IO::_initialize_io
/usr/lib/perl5/site_perl/5.8.0/Bio/Root/IO.pm:244, referer:
http://nsfm39.ucc.ie/cgi-bin/bxbrowser1.pl
[Mon Jan 27 10:58:38 2003] [error] [client 143.239.131.75] [Mon Jan 27
10:58:38 2003] bxbrowser1.pl: STACK Bio::Root::IO::new
/usr/lib/perl5/site_perl/5.8.0/Bio/Root/IO.pm:192, referer:
http://nsfm39.ucc.ie/cgi-bin/bxbrowser1.pl
[Mon Jan 27 10:58:38 2003] [error] [client 143.239.131.75] [Mon Jan 27
10:58:38 2003] bxbrowser1.pl: STACK Bio::SearchIO::new
/usr/lib/perl5/site_perl/5.8.0/Bio/SearchIO.pm:121, referer:
http://nsfm39.ucc.ie/cgi-bin/bxbrowser1.pl
[Mon Jan 27 10:58:38 2003] [error] [client 143.239.131.75] [Mon Jan 27
10:58:38 2003] bxbrowser1.pl: STACK Bio::SearchIO::blast::new
/usr/lib/perl5/site_perl/5.8.0/Bio/SearchIO/blast.pm:200, referer:
http://nsfm39.ucc.ie/cgi-bin/bxbrowser1.pl
[Mon Jan 27 10:58:38 2003] [error] [client 143.239.131.75] [Mon Jan 27
10:58:38 2003] bxbrowser1.pl: STACK Bio::SearchIO::new
/usr/lib/perl5/site_perl/5.8.0/Bio/SearchIO.pm:134, referer:
http://nsfm39.ucc.ie/cgi-bin/bxbrowser1.pl
[Mon Jan 27 10:58:38 2003] [error] [client 143.239.131.75] [Mon Jan 27
10:58:38 2003] bxbrowser1.pl: STACK toplevel
/var/www/cgi-bin/bxbrowser1.pl:25, referer:
http://nsfm39.ucc.ie/cgi-bin/bxbrowser1.pl
[Mon Jan 27 10:58:38 2003] [error] [client 143.239.131.75] [Mon Jan 27
10:58:38 2003] bxbrowser1.pl: , referer:
http://nsfm39.ucc.ie/cgi-bin/bxbrowser1.pl
[Mon Jan 27 10:58:38 2003] [error] [client 143.239.131.75] [Mon Jan 27
10:58:38 2003] bxbrowser1.pl: --------------------------------------,
referer: http://nsfm39.ucc.ie/cgi-bin/bxbrowser1.pl

Thus, Bio::Search can't even find the file. But to open it and print the
contents in the 'normal cgi-way' works fine i.e
    while(<$fh>) {
        print $_;
    }

Howcome do you think?

Regards,
Marcus




More information about the Comp-bio mailing list