[Bioperl-l] remoteblast xml problem

Hubert Prielinger hubert.prielinger at gmx.at
Thu Jun 1 16:33:45 EDT 2006


hi,
I have the following program and it worked quite well, for retrieving 
remoteblast results in a textfile,
now I have altered it to to xml, and it didn't work anymore.....
it takes all the parameter at the commandline, submits the query, but I 
don't retrieve any results file anymore.....

it seems that it hangs in a endless loop......
the only output I get is:  $rc is not a ref! over and over..... it 
doesn't enter the else term anymore....

every help is appreciated, thanks in advance


#!/usr/bin/perl -w

use strict;
use warnings;
use Bio::SeqIO;
use Bio::Tools::Run::RemoteBlast;
use Bio::Seq;
use IO::String;
use Bio::SearchIO;


#use lib qw(/usr/local/bioperl/bioperl-1.5.1);

print "Please insert database:\t";
my $db_STD = <STDIN>;
chomp $db_STD;

print "Please insert matrix:\t";
my $matrix_STD = <STDIN>;
chomp $matrix_STD;

print "Please insert count:\t";
my $count_STD = <STDIN>;
chomp $count_STD;

print "Please insert gapcosts:\t";
my $gapcosts_STD = <STDIN>;
chomp $gapcosts_STD;

my $prog   = 'blastp';
my $db     = $db_STD;           
my $e_val  = '20000';
my $matrix = $matrix_STD;               
my $wordSize = '2';


my @data;
my $line_dataArray;
my $rid;
my $count = $count_STD;           
my @params = (
  '-prog'   => $prog,
  '-data'   => $db,
  '-expect' => $e_val,
  '-MATRIX_NAME' => $matrix,
  '-readmethod' => 'xml',
  '-WORD_SIZE' => $wordSize,
);

my $seqio_obj = Bio::SeqIO->new(
  -file   => "aloneblosum62.txt",
  -format => "raw",
);

print "entering blast....";

my $xmlFactory = Bio::Tools::Run::RemoteBlast->new(@params);


    
$Bio::Tools::Run::RemoteBlast::HEADER{'COMPOSITION_BASED_STATISTICS'} = '1';
    $Bio::Tools::Run::RemoteBlast::HEADER{'GAPCOSTS'} = 
$gapcosts_STD;                   
    $Bio::Tools::Run::RemoteBlast::HEADER{'DESCRIPTIONS'} = '1000';
     $Bio::Tools::Run::RemoteBlast::RETRIEVALHEADER{'ALIGNMENTS'} = '1000';
    $Bio::Tools::Run::RemoteBlast::RETRIEVALHEADER{'FORMAT_TYPE'} = 'XML';
   

print "Blast entered successfully \n";

while ( my $query = $seqio_obj->next_seq ) {
  print "submit Sequence...just do it....\n";
 
  my $r = $xmlFactory->submit_blast($query);
  print $query->seq;
  print "\n";
 
 
#    sleep 30;

  # Wait for the reply and save the output file
  print "entering while loop for saving Output.... \n";
 
  while ( my @rids = $xmlFactory->each_rid ) {
      foreach my $rid (@rids) {
           
          my $rc = $xmlFactory->retrieve_blast($rid);
          if ( !ref($rc) ) {
              print '$rc is not a ref!', "\n";
              if ( $rc < 0 ) {
                  print "Remove rid ...\n";
                  $xmlFactory->remove_rid($rid);
              }
              # sleep 5;
          }
          else {

              print "retrieved Results successfully \n";
              print $rid;
              print "\n";
              my $filename = "comp80swiss$count.xml";
              $xmlFactory->save_output($filename);
              print "File saved successfully \n";
              my $checkinput = $xmlFactory->file;
              open(my $fh,"<$checkinput") or die $!;
              while(<$fh>){
                print;
              }
              close $fh;
              $count++;
              $xmlFactory->remove_rid($rid);
          }
      }
      print "\n";
      print "\n";

  }
}



More information about the Bioperl-l mailing list