my $blast_factory = Bio::Tools::Run::RemoteBlast -> new ( '-prog' => 'blastn', '-data' => 'nr', '-expect' => '1e-10', '-readmethod' => 'SearchIO'); print Dumper ($blast_factory); #ok #loop over all sequences input and count how many sequences are found my $count = 0; while (my $seq = $seqio -> next_seq) { $count++; #loop to blast each sequence against the database my $job = $blast_factory -> submit_blast ($seq); print "Blasting sequence number $count\n"; print Dumper($job); #returns 1, ok #loop to load rids returned for the blast job submitted while (my @rids = $blast_factory -> each_rid) { #loop over rids to check server for a result foreach my $rid (@rids) { print Dumper ($rid); #returns rid#, ok my $blast_results = $blast_factory -> retrieve_blast($rid); print Dumper ($blast_results); #returns -1, PROBLEM #check to see if a result object is returned if ( !ref($blast_results) ) { #if error returned remove rid from stack if ($blast_results == 0) { print STDERR "retrieve_blast returns 0\n"; #watch dots sleep 5; #pause between submitting requests to genbank server } elsif ($blast_results == (-1)) { print STDERR "retrieve_blast returns -1\n"; $blast_factory -> remove_rid($rid); } last if $blast_results == (-1); } #if result, use Bio::SearchIO to return a Bio::SeqIO result object if ( ref($blast_results)) { print "Receiving blast results...\n"; my $result = $blast_results -> next_result(); $blast_factory -> remove_rid($rid); #remove rid from stack