Bioperl:Bio:Tools:Blast-> parse - failing on the first report in stream

Michael B. Thornton lost@sea.incyte.com
Wed, 4 Aug 1999 17:53:18 -0700


Hi All,

I have just started to use the bioperl package, in jest for now, but very
soon in anger.
I would eventually like to take lots of blast reports streaming in on stdin
and do things to them.  To that
end I have a very simple perl script, pretty much lifted from the Blast.pm
docs plus stuff
reccommended by Steve Chervitz on this board.  When I feed a stream of blast
reports to my script (below)
I get a fatal exception, *only*  for the first blast report.  The exception
is as follows:

***1Blast reports produced fatal errors:

-------------------- EXCEPTION --------------------
MSG: Can't determine program type from BLAST report.
NOTE: Checked for: blastp blastn blastx tblastn tblastx.
CONTEXT: Error in object Bio::Tools::Blast "anonymous Bio::Tools::Blast"
SCRIPT: /usr/people/lost/perl/bioperl/cog_blast_parser1.pl
STACK:
Bio::Tools::Blast::_parse_header(1899)
Bio::Tools::Blast::__ANON__(1744)
Bio::Root::IOManager::read(736)
Bio::Root::Object::read(2055)
Bio::Tools::Blast::_parse_blast_stream(1623)
Bio::Tools::Blast::parse(1474)
main::/usr/people/lost/perl/bioperl/cog_blast_parser1.pl(13)
---------------------------------------------------



My perl script:
------------------------------------------------
use Bio::Tools::Blast qw(:obj);

sub process_blast {
    my $BlastObj = shift;
    print $BlastObj->table_tiled(0);
    $BlastObj->destroy;
}

while (<>){
    eval {
    $Blast->parse (    -parse             =>1,
                                    -exec_func    =>\&process_blast,
                                    -stream        => 1,
                            );
        };

    # catch exceptions and ignore until done
    if ($@) {
    push @errs, $@;
    }
}

# print errors to stderr when done
if (@errs){
printf STDERR "\n***%dBlast reports produced fatal errors:\n",
scalar(@errs);
foreach(@errs) {print STDERR $_; }
}


If anyone could explain why this happens and tell me some graceful way to
get around it, I'd be really grateful.
\
cheers,

ok
mbt

Michael B. Thornton
Incyte Pharmaceuticals - Palo Alto, CA

=========== Bioperl Project Mailing List Message Footer =======
Project URL: http://bio.perl.org/
For info about how to (un)subscribe, where messages are archived, etc:
http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html
====================================================================