[Bioperl-l] generic sequence factory in SeqIO

Matthew Pocock matthew_pocock@yahoo.co.uk
Tue, 23 Apr 2002 11:22:44 +0100


Jason Stajich wrote:

> yeah - it's going to have to call 'can' on all of those.  Kind of silly.
> 
> Other option is to cache all the parsed information and do a big sequence
> init at the end - because of the way our initialization is done, init
> fields which the seq object doesn't know about (i.e. dates, division, etc
> would be unknown by a PrimarySeq) would just get ignored - psuedo event
> throwing that way!
> 

BioJava collects all the 'unhandled' events and puts them into an 
Annotation object as key-value pairs so that even if a sequence or 
feature implementation doesn't have an explicit accessor for that 
property e.g. f.getFrame() then the data is available e.g. 
f.getAnnotation().getProperty("frame") and the more ontology-rich 
biojava2 will probably make all of this utterly transparent. To drop it, 
you would add a listener in the parsing pipeline that explicitly dropped 
that event. Perl has much easier ways of invoking arbitrary methods 
(ever called $thing->$method(@params) or even $foo->can($bar) anyone?) 
and generating custom object methods is a doddle (eval, symbol tables, 
AUTOLOAD, blessed sub closures etc.) so it would not be impossible to 
generate dumb accessors for the stuff you weren't expecting. Throwing 
stuff away usually confuses people.

Matthew