[Bioperl-l] RemoteBlast save_output
   
    Wiepert, Mathieu
     
    Wiepert.Mathieu@mayo.edu
       
    Fri, 20 Sep 2002 14:22:47 -0500
    
    
  
Some small potatoes, I put a new method in RemoteBlast, to allow saving the last blast retrieved.  The way it works for the moment is to do something like this stripped down bit of code (setup needed, didn't want to make a big email of code)
my $factory = Bio::Tools::Run::RemoteBlast->new();
my $r = $factory->submit_blast($inseqfile);
#start of progress monitoring
print STDERR "waiting..." if( $v > 0 );
#go through results
while ( my @rids = $factory->each_rid ) {
  foreach my $rid ( @rids ) {
    my $blastobj = $factory->retrieve_blast($rid);
    if( !ref($blastobj) ) {
      if( $blastobj < 0 ) {
        #This is an error condition, should be a warning or something
        $factory->remove_rid($rid);
      }
      print STDERR "." if ( $v > 0 );
      sleep 5;
    } else {	
      my $result = $blastobj->next_result;
      #only saves the last result gotten.  requires a filename to be passed in.  
      $factory->save_output($result->query_name()."\.blastoutput");
      $factory->remove_rid($rid); 
    }
  }
}
The call is 
$factory->save_output($filename)
There is also a fix to get the query line to appear in the output.
-Mat