Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Adam =?iso-8859-1?Q?Sj=F8gren?= <adsj <at> novozymes.com>
Subject: Re: Subclassing Bio::Seq ? Extending Bio::Perl
Newsgroups: gmane.comp.lang.perl.bio.general
Date: Monday 6th November 2006 13:03:21 UTC (over 11 years ago)
On Tue, 24 Oct 2006 14:57:02 -0400, Hilmar wrote:

> On Oct 24, 2006, at 1:59 PM, JK ((Jesper Agerbo Krogh)) wrote:

>>> The reason that this is a Bio::PrimarySeq and not a Bio::Seq or your
>>> extension of the latter is that the Perl garbage collector can't deal
>>> with circular references.

>> Doesn't Scalar::Util::weaken solve that?

> You're welcome to test and try. It should be a simple change in  
> Bio::Seq::add_SeqFeature(). You will see that it is this method and  
> not the feature object that makes sure the wrapped primarySeq gets  
> passed as sequence reference. Just change that to creating a new  
> reference to the sequence object and make it a weak reference before  
> passing it to the feature object.

> (The feature object has no requirement (or knowledge) that the  
> referenced sequence object is a PrimarySeq.)

I've tried implementing this approach - the only test that failed was
FootPrinter.t, which I "solved" by not weakening if the object is a
Bio::PrimarySeq.

I am not sure how fragile this approach is; any comments (patch
attached)?

[...]

> I'm not following you why this would make any difference (it would be  
> $seq->message_digest() compared to $seqCompute->message_digest 
> ($seq)), unless what you are saying is that you would like to cache  
> the result of the computation.

You would have to create, or pass around, a $seqCompute object
everywhere your $seq-object's digest was needed, which would be a bit
of a pain?


  Best regards,

    Adam

-- 
                                                          Adam Sj√łgren
                                                    [email protected]
 
CD: 3ms