Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Fields, Christopher J <cjfields <at> illinois.edu>
Subject: Re: Please help me on the piece of code throwing exception
Newsgroups: gmane.comp.lang.perl.bio.general
Date: Tuesday 9th October 2012 19:13:28 UTC (over 4 years ago)
The error returned indicates this may be an intermittent issue on NCBI's
end, but it could also be a proxy issue as Jason pointed out (so try it
again, and try it with proxy settings as Jason indicated).  Locally this is
working for me at the moment, though I admittedly removed the Error stuff
(I try to avoid using that particular module).  

chris

On Oct 9, 2012, at 8:02 AM, Shailesh Maurya - Network

 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      =>
[email protected]',
>                                       -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:
[email protected]
> 
> _______________________________________________
> Bioperl-l mailing list
> [email protected]
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
 
CD: 4ms