[Bioperl-l] Please help me on the piece of code throwing exception

Jason Stajich jason.stajich at gmail.com
Tue Oct 9 16:23:02 UTC 2012


Do you have a proxy server at your network connection? It appears you
cannot reach website - you can set proxy server with the http_proxy
environment variable I believe.

http://www.bioperl.org/wiki/Installing_BioPerl_on_Unix

Do other simple queries with Bio::DB::GenBank work for you that do not use
eutils?

Jason Stajich
> jason at bioperl.org
> http://bioperl.org/wiki/User:Jason
>
>
>
> On Tue, Oct 9, 2012 at 6:02 AM, Shailesh Maurya - Network <
> maurya_shailesh at network.lilly.com> wrote:
>
>> Hi,
>>
>>
>>
>> I'm trying to execute a script for downloading rna sequences of
>> Cricetulus griseus from NCBI site using eutils. But while execution I'm
>> stuck up with the exceptions. Here's the script and the exception it is
>> throwing -
>>
>>
>>
>> *****
>>
>> #!/usr/local/bin/perl
>> use Bio::DB::EUtilities;
>> use Error qw(:try);
>>
>>
>>
>> try {
>> # set optional history queue
>> my $factory = Bio::DB::EUtilities->new(-eutil      => 'esearch',
>>                                        -email      => '
>> maurya_shailesh at network.lilly.com'<mailto:'
>> maurya_shailesh at network.lilly.com'>,
>>                                        -db         => 'nuccore',
>>                                        -term       => 'Cricetulus
>> griseus[porgn:__txid10029] AND mrna',
>>                                        -usehistory => 'y');
>>
>> my $count = $factory->get_count;
>> # get history from queue
>> my $hist  = $factory->next_History || die 'No history data returned';
>> print "History returned\n";
>> # note db carries over from above
>> $factory->set_parameters(-eutil   => 'efetch',
>>                          -rettype => 'fasta',
>>                          -history => $hist);
>>
>> my $retry = 0;
>> my ($retmax, $retstart) = (500,0);
>>
>> open (my $out, '>', 'seqs_rna') || die "Can't open file:$!";
>>
>> RETRIEVE_SEQS:
>> while ($retstart < $count) {
>>     $factory->set_parameters(-retmax   => $retmax,
>>                              -retstart => $retstart);
>>     eval{
>>         $factory->get_Response(-cb => sub {my ($data) = @_; print $out
>> $data} );
>>     };
>>     if ($@) {
>>         die "Server error: $@.  Try again later" if $retry == 5;
>>         print STDERR "Server error, redo #$retry\n";
>>         $retry++ && redo RETRIEVE_SEQS;
>>     }
>>     print "Retrieved $retstart";
>>     $retstart += $retmax;
>> }
>>
>> close $out;
>> }
>> catch Bio::Root::Exception with {
>>         my $err = shift;
>>         print "A Bioperl exception has occured:\n$err\n";
>> };
>>
>> *****
>>
>> And the exception is -
>>
>>
>>
>> A Bioperl exception has occured:
>>
>> ------------- EXCEPTION: Bio::Root::Exception -------------
>> MSG: Response Error
>> Can't connect to eutils.ncbi.nlm.nih.gov:80 (timeout)
>> STACK: Error::throw
>> STACK: Bio::Root::Root::throw
>> /usr/local/perl-5.12.1/lib/site_perl/5.12.1/Bio/Root/Root.pm:368
>> STACK: Bio::DB::GenericWebAgent::get_Response
>> /usr/local/perl-5.12.1/lib/site_perl/5.12.1/Bio/DB/GenericWebAgent.pm:215
>> STACK: Bio::DB::EUtilities::get_Parser
>> /usr/local/perl-5.12.1/lib/site_perl/5.12.1/Bio/DB/EUtilities.pm:222
>> STACK: Bio::DB::EUtilities::get_count
>> /usr/local/perl-5.12.1/lib/site_perl/5.12.1/Bio/DB/EUtilities.pm:580
>> STACK: load.pl:15
>> -----------------------------------------------------------
>>
>>
>>
>> Please help me on this piece of code. Also there is humble request to
>> suggest some other logic or script to perform the task.
>>
>>
>>
>> Hope for a positive response.
>>
>>
>>
>> --
>>
>> Thanks and Regards,
>>
>> Shailesh Maurya
>> LRL IT COE
>> Eli Lilly ODC @ TCS, Noida 2, India
>> Work :+91-9911666572
>> EMail: maurya_shailesh at network.lilly.com<mailto:
>> maurya_shailesh at network.lilly.com>
>>
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>>
>
>



More information about the Bioperl-l mailing list