[Bioperl-l] Cloning seqfeatures

David Block dblock@gene.pbi.nrc.ca
Fri, 24 Aug 2001 10:09:04 -0600 (CST)


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