[Bioperl-l] write_sequence cgi perl problem

Paulo Almeida paulo.david at netvisao.pt
Fri May 21 10:23:35 EDT 2004


The header is for the server to know what kind of data to expect, 
something like "Content type: text/plain", followed by a blank line. You 
can add it by including the following lines in the beginning of your script:

$cgi = new CGI;
print $cgi->header;

However, that won't do you any good until you can solve the other 
problem, and I don't know what it might be, as it works fine for me. 
It's true that it can't be the internet connection, since it works from 
the command line, so I was thinking it might be related to the webserver 
configuration, but I have no idea.

As for the error, I think it's a consequence of not being able to get 
the sequence. The error happens because get_sequence fails, and so the 
$seq_object variable is undefined, which is the non object passed to 
write_sequence. Try replacing your get_sequence line with:

$seq_object = get_sequence('genbank',"NM_173283") || die $!;

and then see what's in the error log.

-Paulo

Baranidharan P wrote:

>  
>
>Dear paulo,
>Thanx for ur valuable comments.what kind of header u were talking about?
>if its  problem of internet connection it shouldnt work in the command line even right ? 
>and can u plz tell me what does this mean 
>-------------------------------------->
>You have a non object [] passed to write_sequence. It maybe that you want to use new_sequence to make this string into a sequence object? at /usr/lib/perl5/site_perl/5.8.1/Bio/Perl.pm line 283
>Bio::Perl::write_sequence('>ILGF1.gb','genbank','undef') called at /var/www/cgi-bin/getgenseq.cgi line 12
>-----------------------------------------
>i am getting this only when  i make the perl script as cgi-perl script. 
>
>i request your valuable suggestions once again.
>
>Regards,
>baranidharan
>
>On Thu, 20 May 2004 Paulo Almeida wrote :
>  
>
>>It works for me. Maybe it was a temporary connection problem, since error_log was giving you that "Bad hostname" error? Also, I think you need to write a header for the CGI to work (I get a "Premature end of script headers" if I don't), but that's a different issue.
>>
>>-Paulo Almeida
>>
>>Baranidharan P wrote:
>>
>>    
>>
>>> Dear all,
>>>
>>>The following perl script works fine from the command line....
>>>___________________________________________
>>>use Bio::Perl;
>>>
>>># this script will only work with an internet connection
>>># on the computer it is run on
>>>$seq_object = get_sequence('genbank',"NM_173283");
>>>#print "$seq_object";
>>>write_sequence(">ILGF1.gb",'genbank',$seq_object);
>>>___________________________________________
>>>
>>>but the following cgi-perl script in /var/www/cgi-bin
>>>____________________________________________
>>>#!/usr/bin/perl -w
>>>
>>>use strict;
>>>use CGI::Carp qw(fatalsToBrowser);
>>>use CGI qw(:standard);
>>>use Bio::Perl;
>>>
>>># this script will only work with an internet connection on the computer it is run on
>>>my $seq_object = get_sequence('genbank',"NM_173283");
>>>write_sequence(">ILGF1.gb",'genbank',$seq_object);
>>>__________________________________________________
>>>
>>>returns an error in the browser as
>>>---------------------------------------------------
>>>You have a non object [] passed to write_sequence. It maybe that you want to use new_sequence to make this string into a sequence object? at /usr/lib/perl5/site_perl/5.8.1/Bio/Perl.pm line 283
>>>Bio::Perl::write_sequence('>ILGF1.gb','genbank','undef') called at /var/www/cgi-bin/getgenseq.cgi line 12
>>>----------------------------------------------------
>>>
>>>and the /etc/httpd/logs/error_log file says
>>>---------------------------------------------------
>>>[Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: , referer: http://10.22.32.3/getgenseq.html
>>>[Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: ------------- EXCEPTION -------------, referer: http://10.22.32.3/getgenseq.html
>>>[Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: MSG: WebDBSeqI Request Error:, referer: http://10.22.32.3/getgenseq.html
>>>[Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: 500 (Internal Server Error) Can't connect to www.ebi.ac.uk:80 (Bad hostname 'www.ebi.ac.uk'), referer: http://10.22.32.3/ge
>>>tgenseq.html [Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: Content-Type:
>>>text/plain, referer: http://10.22.32.3/getgenseq.html [Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: Client-Date:
>>>Tue, 11 May 2004 04:23:36 GMT, referer: http://10.22.32.3/getgenseq.html [Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: Client-Warnin
>>>g: Internal response, referer: http://10.22.32.3/getgenseq.html [Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: , referer: ht
>>>tp://10.22.32.3/getgenseq.html [Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: 500 Can't con
>>>nect to www.ebi.ac.uk:80 (Bad hostname 'www.ebi.ac.uk'), referer: http://10.22.32.3/getgenseq.html [Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: , referer: ht
>>>tp://10.22.32.3/getgenseq.html [Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: , referer: ht
>>>tp://10.22.32.3/getgenseq.html [Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: STACK Bio::DB
>>>::WebDBSeqI::_stream_request /usr/lib/perl5/site_perl/5.8.1/Bio/DB/WebDBSeqI.pm:728, referer: http://10.22.32.3/getgenseq.html
>>>[Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: STACK Bio::DB::WebDBSeqI::get_seq_stream /usr/lib/perl5/site_perl/5.8.1/Bio/DB/WebDBSeqI.pm:460, referer: http://10.22.32.3
>>>/getgenseq.html [Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: STACK Bio::DB
>>>::RefSeq::get_seq_stream /usr/lib/perl5/site_perl/5.8.1/Bio/DB/RefSeq.pm:155, referer: http://10.22.32.3/getgenseq.html
>>>[Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: STACK Bio::DB::WebDBSeqI::get_Stream_by_acc /usr/lib/perl5/site_perl/5.8.1/Bio/DB/WebDBSeqI.pm:312, referer: http://10.22.3
>>>2.3/getgenseq.html [Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: STACK Bio::DB
>>>::WebDBSeqI::get_Seq_by_acc /usr/lib/perl5/site_perl/5.8.1/Bio/DB/WebDBSeqI.pm:181, referer: http://10.22.32.3/getgenseq.html
>>>[Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: STACK Bio::Perl::get_sequence /usr/lib/perl5/site_perl/5.8.1/Bio/Perl.pm:508, referer: http://10.22.32.3/getgenseq.html
>>>[Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: STACK toplevel /var/www/cgi-bin/getgenseq.cgi:10, referer: http://10.22.32.3/getgenseq.html
>>>[Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: , referer: http://10.22.32.3/getgenseq.html
>>>[Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: --------------------------------------, referer: http://10.22.32.3/getgenseq.html
>>>[Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] , referer: http://10.22.32.3/getgenseq.html
>>>[Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] -------------------- WARNING ---------------------, referer: http://10.22.32.3/getgenseq.html
>>>[Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] MSG: acc (NM_173283) does not exist, referer: http://10.22.32.3/getgenseq.html
>>>[Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] ---------------------------------------------------, referer: http://10.22.32.3/getgenseq.html
>>>[Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: Use of uninitialized value in length at /usr/lib/perl5/site_perl/5.8.1/Bio/Perl.pm line 271., referer: http://10.22.32.3/getgenseq.html
>>>[Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.1/Bio/Perl.pm line 283., referer: http://10.22.32.3/getgenseq.html
>>>[Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: You have a non object [] passed to write_sequence. It maybe that you want to use new_sequence to make this string into a sequence object? at /usr/lib/perl5/site_perl/5.8.1/Bio/Perl.pm line 283, referer: http://10.22.32.3/getgenseq.html
>>>[Tue May 11 09:53:36 2004] [error] [client 10.22.32.3] [Tue May 11 09:53:36 2004] getgenseq.cgi: Bio::Perl::write_sequence('>ILGF1.gb','genbank','undef') called at /var/www/cgi-bin/getgenseq.cgi line 12, referer: http://10.22.32.3/getgenseq.html
>>>
>>>      
>>>
>
>  
>



More information about the Bioperl-l mailing list