[Bioperl-l] Subclassing Bio::Seq ? Extending Bio::Perl

JK (Jesper Agerbo Krogh) JK at novozymes.com
Tue Oct 24 10:28:22 EDT 2006


We're trying to "extend" bioperl in our own setup. We have some funtions

that we'd like to "allways" have available on a Bio::Seq-object. As an
I'd like to have the sequence-digest available on ->digest that just
A hex-encoded message-digest of the sequence in the object. This is
really comfortable
when trying to figure out wether we've got some computations stored in
the cache
for this particular sequence. 

Another example is that we have some fields we want to be mandatory in
the objects,
thus adding additional checks in the constructor is nessesary. 

Our approach has been to "subclass" Bio::Seq in a new object: (Nz::Seq)
and add 
the functionality there. This generally works fine (->translate() calls
and instantiates the correct subclassed object. 

But the logic fails when the ->seq of a feature just instantiates a
without trying to get the subclassed object. 

So the question basically is: 
What is the preferred way of extending/subclassing Bio-perl -objects
our own methods? 


More information about the Bioperl-l mailing list