[Bioperl-l] Bio::AnnotatableI function annotation()

Mark A. Jensen maj at fortinbras.us
Fri Mar 27 20:33:19 UTC 2009


Ahh....thanks. Hmm.

----- Original Message ----- 
From: "Chris Fields" <cjfields at illinois.edu>
To: "Mark A. Jensen" <maj at fortinbras.us>
Cc: "Hilmar Lapp" <hlapp at gmx.net>; "Govind Chandra" 
<govind.chandra at bbsrc.ac.uk>; <bioperl-l at lists.open-bio.org>
Sent: Friday, March 27, 2009 4:25 PM
Subject: Re: [Bioperl-l] Bio::AnnotatableI function annotation()


> On Mar 27, 2009, at 3:09 PM, Mark A. Jensen wrote:
>
>> Probably folks just starting to use 1.6 will be shunted in the
>> right direction by the docs, but those making the switch
>> might reasonably get confused (resulting in this thread, e.g.).
>> If someone tries to do $feature->annotation-
>> >getAnnotations('locus_tag')
>> when $feature->annotation is undef, then probably that user is
>> not hip to $feature->get_tag_values('locus_tag'), and would appreciate
>> something like
>> "Annotation property undefined. Did you mean $feature-
>> >get_tag_values?"
>> (not nec. that specific, but you get my drift?)
>> MAJ
>
> Yes, but the result of $feature->annotation is never undef (the  collection is 
> created on the fly):
>
> perl -MBio::SeqFeature::Generic -e 'my $sf = Bio::SeqFeature::Generic-
> >new(-start => 1, -end => 100); print ref($sf->annotation)."\n"'
> Bio::Annotation::Collection
>
> We can't add a warning for lazy instantiation of the Collection w/o  running 
> into significant issues, as it'll pop up with code like this:
>
> # don't create the annotation or the collection unless needed
> if (defined $val) {
>     $seq->annotation->add_Annotation(
>     Bio::Annotation::SimpleValue->new(-tagname => 'foo', -value =>  $val)
>     );
> }
>
> -c
>
> 




More information about the Bioperl-l mailing list