[Bioperl-l] BLASTing with a seqio/seq object...

Samantha Thompson st537 at york.ac.uk
Thu Nov 30 13:50:17 EST 2006


Chris Fields wrote:

>>Hi,
>>Thanks for helping me with the BLAST code, when I made the 
>>corections in ran fine, I'm assuming the returned object 
>>$blast_result is a kind of searchio object, although I'm not 
>>sure. I tried the code on the bioperl tutorial page for 
>>processing a searchio object returned from blast....
>>http://www.bioperl.org/wiki/Bptutorial.pl#Parsing_BLAST_and_FA
>>STA_reports_with_Search_and_SearchIO
>>this seems to be the next stage after blasting in the bioperl 
>>tutorial but I'm sure how to process it correctly to get hit 
>>and alignment information regards,
>>
>>Samantha Thompson
>>    
>>
>
>It is a SearchIO object.  FYI, you also have the option of saving the raw
>BLAST output to a file if needed (it should be described in the RemoteBlast
>POD).
>
>There is also a great HOWTO which goes into more detail about hits/HSPs and
>how to get alignments:
>
>http://www.bioperl.org/wiki/HOWTO:SearchIO
>
>
>chris
>
>_______________________________________________
>Bioperl-l mailing list
>Bioperl-l at lists.open-bio.org
>http://lists.open-bio.org/mailman/listinfo/bioper
>  
>

Hi,

OK, I tried the code at the SearchIO HOWTO, I've pasted it below, you 
can see where I've added the SearchIO handling part I've changed $in to 
the $blast_report as this is returned from the submit_blast ... what 
happens when I run this however is that I get the following error:

Can't call method "next_result" without a package or object reference at 
bioptest2.pl line 31, <GEN0> line 1.

Line 31 being:
while( my $result = $blast_report->next_result ) {

Not sure why this is happening. Thanks for any help...

Samantha Thompson



use strict;
use Bio::Perl;
use Bio::Seq;
use Bio::SeqIO;

use Bio::Tools::Run::RemoteBlast;
use Bio::SearchIO;

#seq bit

#$seq_obj = Bio::Seq->new(-format => 'fasta');

my $seqio_obj = Bio::SeqIO->new(-file => 
"/biol/people/mres/st537/MalEfasta.txt", -format => 'fasta');

my $seq_obj = $seqio_obj->next_seq;



#blast bit

my $remote_blast = Bio::Tools::Run::RemoteBlast->new (
         -prog => 'blastp', -db => 'nr', -expect => '1e-15' );

my $blast_report = $remote_blast->submit_blast($seq_obj);




#new part for SearchIO...

while( my $result = $blast_report->next_result ) {
  while( my $hit = $result->next_hit ) {
   while( my $hsp = $hit->next_hsp ) {
    if( $hsp->length('total') > 100 ) {
     if ( $hsp->percent_identity >= 75 ) {
      print "Hit= ",       $hit->name,
            ",Length=",     $hsp->length('total'),
            ",Percent_id=", $hsp->percent_identity, "\n";
     }
    }
   } 
  }
}



More information about the Bioperl-l mailing list