Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: JK (Jesper Agerbo Krogh) <JK <at> novozymes.com>
Subject: Subclassing Bio::Seq ? Extending Bio::Perl
Newsgroups: gmane.comp.lang.perl.bio.general
Date: Tuesday 24th October 2006 14:28:22 UTC (over 11 years ago)
Hi. 

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
example, 
I'd like to have the sequence-digest available on ->digest that just
returns
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
->can_call_new()
and instantiates the correct subclassed object. 

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

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

Jesper
 
CD: 3ms