Bioperl: Bio::Tools::Blast->new on sequence file w/no hits, throws fatal exception. Any ideas?

Steven E. Brenner brenner@hyper.stanford.edu
Thu, 27 May 1999 23:09:23 -0700 (PDT)


Steve,

> You might wonder: why does the blast object throw an exception when
> I gave it a perfectly valid, parsable blast report? Well, when you
> specify a -signif criterion, you are adding a requirement that the
> blast object should only contain hits at or below the indicated
> significance value. Since hits are the raison d'etre of a parsed blast 
> object, the object dies since it cannot attach any hits to itself (am
> I personifying the blast object too much?).

I am afraid I have to disagree with your logic here.  I think that finding
nothing is a perfectly valid behavior.   It doesn't seem reasonable to me
that it would throw an exception.  

An exception would indicate (to me) that the operation failed in some
technical way (e.g., the file wasn't found; the file was corrupted).  


> Throwing an exception guarantees that a blast object won't be used any
> further. It also provides a convenient screen, since you know that
> every object created will have at least one hit at or below your
> -signif cutoff.

This does not seem a convenient screen to me!  This lumps illegal calls
(to bad or missing files) with valid calls on files with no matches.  I
would much rather have the exception status indicate whether or not the
parsing worked.  It's easy to check for matches later.


> BTW, I'd strongly recommend using the above eval {} strategy when
> doing any reasonably complex operation in a situation where an
> exception could halt a long-running script prematurely. It's a good
> "safe scripting" practice.

Agreed.  But an exeception should basically only be thrown when the
program cannot continue in its documented manner.  (Hence, the need for an
exeption to the standard behavior.)  Finding no hits definitely doesn't
meet this criterion for me.

Steve


P.S.  No angered Bioperl modules were used in the composition of this message.

=========== 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
====================================================================