[BioPython] blast parser ideas

Jeffrey Chang jchang@SMI.Stanford.EDU
Wed, 10 Nov 1999 17:18:16 -0800 (PST)


>  > This event-oriented design decouples the parsing from the handler, so
>  > you can use the same consumer for multiple versions and flavors of
>  > BLAST.  Plus, you can ignore data that you're not interested in by not
>  > implementing handler methods in your consumer.
> 

[Thomas]
> Is it possible to have the idea of a lazy parser - even if the parser is
> event-oriented - or is that already in the event-oriented design ? 

Yes and no.  The Parser passes the Consumer the relevant text, and the 
Consumer decides what information to extract from the text.

However, there is some unnecessary overhead because Parser has to examine
every line of text whether the Consumer wants it or not.

According to the current design, the Parser calls the proper method in the
Consumer and passes it the appropriate line of text.  If the Consumer does
not have the right method implemented, the method call falls through to
the "unhandled" method.  Since it's impossible to know what the client may
have put in "unhandled", the Parser cannot skip any lines.

However, it may be possible to devise some way where the Consumer can pass
the Parser hints about what information it's interested in.  Hmmm...

Jeff