[Bioperl-l] Parsing Blast Output

AUnderwood@PHLS.org.uk AUnderwood@PHLS.org.uk
Tue, 11 Jun 2002 15:56:50 +0100


Hi Mat and Brian,

Thank you for both your help. Together we're getting there. thanks.

The code that Mat wrote was

      while ( my @rids = $remote_blast_object->each_rid ) {
        foreach my $rid ( @rids ) {
          $rc = $remote_blast_object->retrieve_blast($rid);
          "retrieving results...\n";
          if( !ref($rc) ) {   # $rc not a reference => either error
                              # or job not yet finished
            if( $rc < 0 ) {
              $remote_blast_object->remove_rid($rid);
              print "Error return code for BlastID code $rid ... \n";
            }
            sleep 5;
          } else {
            $remote_blast_object->remove_rid($rid);
            while ( my $sbjct = $rc->nextSbjct ) {
              print "sbjct name is ", $sbjct->name, "\n";
              while ( my $hsp = $sbjct->nextHSP ) {
                print "score is ", $hsp->score, "\n";
              }




This method doesn't seem to work with the BioPerl 1.0 release since it comes
up with this message:


Can't locate object method "database" via package "Bio::SearchIO::blast"
(perhaps you forgot to load "Bio::SearchIO::blast"?) at blast_test4.pl line
34, <GEN14> line 228.

So I never got the problems with the $result and $rc variables and an error
that said
Can't locate object method "next_result" via package "Bio::Tools::BPlite" at
testremoteblast.pl line 32

However from your code I think that I can use methods in the
Bio::Search::HSP::HSPI module (which is the kind of object $hsp is) to
generate the same kind of output as in your script

$hsp->query_string
$hsp->hit_string
$hsp->homology_string.

SO the code I 'm using is
                 print "hit name is ", $hit->name, "\n";
                 while( my $hsp = $hit->next_hsp ) {
                 print "score is ", $hsp->score, "\n";
		 print "evalue is ", $hsp->evalue, "\n";
		 print $input->display_id,"\t\t", $hsp->query_string, "\n";
		 print "\t\t", $hsp->homology_string, "\n";
		 print $hit->description, "\t\t", $hsp->hit_string, "\n";
		 

Has this all changed again with Bioperl 1.01? I seem to understand that from
Brian's message about the next_result as opposed to next_Sbjct. Will this
all change again with 1.1??
My one remaining problem is that
$hsp->query_string/hit_string/homology-string generates very long strings if
there is a long region of homology. Is there a way of formatting these in
blocks of 50?

Thanks again for all your help,

Anthony




**************************************************************************
The information contained in the EMail and any attachments is confidential
and intended solely and for the attention and use of the named addressee(s).
It may not be disclosed to any other person without the express authority of
the PHLS, or the intended recipient, or both. If you are not the intended
recipient, you must not disclose, copy, distribute or retain this message or
any part of it.

For information on how to send data to the PHLS in encrypted form via
E.Mail, visit www.phls.org.uk.

This footnote also confirms that this EMail has been swept for computer
viruses, but please re-sweep any attachments before opening or saving.

HTTP://www.phls.org.uk
**************************************************************************