[Bioperl-l] Bio::Tools::Run::StandAloneBlast

Wes Barris wes.barris at csiro.au
Thu Nov 13 00:26:55 EST 2003


Mehta, Perdeep wrote:

> You are right. I mixed up the things I'm not sure of. I had tried write_blast() also and that also threw errors. Then I thought to try the method with $in ... and drop the write_blast() call altogether. I thought $in... gives more control. However, it didn't as well. Here is the right error message that I got with the code included earlier. I'm sorry for the confusion.

Change these lines:

my $blast_result = $factory->blastall($seq_object);
# Parse Blast results
my $in = new Bio::SearchIO(-format => 'blast',
                            -file   => $blast_result);
while( my $result = $in->next_result ) {

to this:

my $blast_result = $factory->blastall($seq_object);
# Parse Blast results
while( my $result = $blast_result->next_result ) {


>>test2.pl
> 
> ------------- EXCEPTION  -------------
> MSG: Could not open Bio::SearchIO::blast=HASH(0x140b4c910) for reading: No such file or directory
> STACK Bio::Root::IO::_initialize_io /usr/local/lib/perl5/site_perl/5.6.1/Bio/Root/IO.pm:260
> STACK Bio::Root::IO::new /usr/local/lib/perl5/site_perl/5.6.1/Bio/Root/IO.pm:206
> STACK Bio::SearchIO::new /usr/local/lib/perl5/site_perl/5.6.1/Bio/SearchIO.pm:123
> STACK Bio::SearchIO::new /usr/local/lib/perl5/site_perl/5.6.1/Bio/SearchIO.pm:155
> STACK toplevel test2.pl:21
> --------------------------------------
>  
> Also isn't that $blast_result contains the result from blastall search.
>  
> Thanks,
> perdeep
> 
> 	-----Original Message----- 
> 	From: Jason Stajich [mailto:jason at cgt.duhs.duke.edu] 
> 	Sent: Wed 11/12/2003 6:18 PM 
> 	To: Mehta, Perdeep 
> 	Cc: bioperl-l at bioperl.org 
> 	Subject: Re: [Bioperl-l] Bio::Tools::Run::StandAloneBlast
> 	
> 	
> 
> 	Are you SURE you're running the same script which giving that error - you
> 	must be missing the write_blast() call in your code.
> 	
> 	The problem seems to be whereever you are calling write_blast, you are
> 	passing in $in (A Bio::SearchIO::blast object) NOT $result (A
> 	Bio::Search::Result::ResultI object).
> 	
> 	
> 	-jason
> 	
> 	On Wed, 12 Nov 2003, Mehta, Perdeep wrote:
> 	
> 	> Hi,
> 	>
> 	> I'm struggling to find the reason why my following test code to parse Blast output is not functioning. Just beginning to learn Bioperl and couldn't figure out what's missing.
> 	>
> 	> #!/usr/bin/perl -w
> 	> #
> 	> use strict;
> 	>
> 	> use Bio::Perl;
> 	> use Bio::Tools::Run::StandAloneBlast;
> 	> use Bio::SearchIO;
> 	>
> 	>   # this script will only work with an internet connection
> 	>   # on the computer it is run on
> 	>
> 	>   # Get the protein sequence
> 	>    my $seq_object = get_sequence('swissprot',"ROA1_HUMAN");
> 	>
> 	>   # Set database to search against
> 	>    my $DB = "/refseqdb/complete/rs_rel2";
> 	>
> 	>   # Create factory for stand alone Blast and search
> 	>    my @params = ('program'  => 'blastp','database' => $DB);
> 	>    my $factory = Bio::Tools::Run::StandAloneBlast->new(@params);
> 	>    my $blast_result = $factory->blastall($seq_object);
> 	>
> 	>   # Parse Blast results
> 	>    my $in = new Bio::SearchIO(-format => 'blast',
> 	>                               -file   => $blast_result);
> 	>    while( my $result = $in->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";
> 	>            }
> 	>           }
> 	>         }
> 	>       }
> 	>    }
> 	>
> 	> exit;
> 	>
> 	> Blastall runs fine though. Error appears to be Blast result parsing related. Here is the error message that I get;
> 	> >test.pl
> 	> Can't locate object method "algorithm" via package "Bio::SearchIO::blast" (perhaps you for
> 	> got to load "Bio::SearchIO::blast"?) at /usr/local/lib/perl5/site_perl/5.6.1/Bio/SearchIO/
> 	> Writer/TextResultWriter.pm line 146, <STREAM> line 197.
> 	>
> 	> Thank you in advance for any help.
> 	> perdeep
> 	>
> 	> Perdeep K. Mehta, PhD
> 	> Hartwell Center for Bioinformatics & Biotechnology
> 	> St. Jude Children's Research Hospital
> 	> Memphis, TN 38105-2794
> 	> Tel: 901-495 3774
> 	> http://www.hartwellcenter.org
> 	>
> 	>
> 	>
> 	> _______________________________________________
> 	> Bioperl-l mailing list
> 	> Bioperl-l at portal.open-bio.org
> 	> http://portal.open-bio.org/mailman/listinfo/bioperl-l
> 	>
> 	
> 	--
> 	Jason Stajich
> 	Duke University
> 	jason at cgt.mc.duke.edu
> 	
> 	
> 	
> 
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l


-- 
Wes Barris
E-Mail: Wes.Barris at csiro.au



More information about the Bioperl-l mailing list