[Bioperl-l] Cloning seqfeatures
Chris Mungall
cjm@fruitfly.bdgp.berkeley.edu
Fri, 24 Aug 2001 13:14:01 -0700 (PDT)
I'm in favour of reblessing
I'm actually for getting the biology out of the object model as much as
possible these days; ie everything is a SeqFeature.
But if there are going to be biospecific subclasses I like the idea that
all the core attributes are in the base class and the different methods
are just lite wrappers for existing methods; eg $gene->exons() just calls
grep {$_->type eq 'exon'} $self->sub_Features
a good test of whether this design pattern is working is whether you can
just switch types by reblessing. i know it's maybe not in keeping with
java style good software engineering practices but I kind of like it.
On Fri, 24 Aug 2001, David Block wrote:
> I am having second thoughts after sleeping on my transcript object (ouch,
> that prickly part hurt!)...
>
> Should we take an existing SeqFeatureI object and simply bless it into a
> new class? Or should we clone the feature, leaving the original and
> creating a new feature which is now a Bio::SeqFeature::Gene::Exon or
> whatever?
>
> My first stab cloned the feature, but what I realized overnight is the
> cloning threw out all the annotation of the feature except for
> start/stop/strand/frame/primary/source. Is there an easy way to transfer
> all the tag-values?
>
> foreach $tag($fea->all_tags) {
> foreach $value($fea->each_tag_value($tag)) {
> push @{$taghash{$tag}},$value;
> }
> }
>
> This is the point at which re-blessing looks
> attractive.
>
> Opinions welcome - and all tests still pass right now...
>
> --
> David Block
> dblock@gene.pbi.nrc.ca
> http://bioinfo.pbi.nrc.ca/dblock/wiki
> NRC Plant Biotechnology Institute
> Saskatoon, SK, Canada
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>