[Bioperl-l] Annotated.pm

Hilmar Lapp hlapp at gmx.net
Sat Nov 27 01:54:50 EST 2004


Well, if you return an object from source_tag() instead of a string 
your SeqFeatureI compliance goes out the window right there. Friendly 
stringification  through overloading double quotes does not mitigate 
this.

Same goes BTW for primary_tag(), seq_id() etc. Looking at the code, 
you're returning an object for these. Not SeqFeatureI 
contract-compliant.

As an aside, your get_Annotations() short-cut is brittle. If someone 
happens to add a second 'source' annotation (or any other tag for that 
matter), it will break and return the length of the array instead of 
the first element. Furthermore, I wouldn't test for IS-A 
Bio::Annotation::OntologyTerm - this is only an implementation class 
and one day there may be better ones. What you really care about is 
that the object IS-A Bio::AnnotationI (so that you can add it to the 
collection) and IS-A Bio::Ontology::TermI (so that you have your 
ontology-enforced typing).

	-hilmar

On Thursday, November 25, 2004, at 02:45  AM, Allen Day wrote:

> i don't think it should do this, the whole point of using an AC is to
> retain typing.  if you want to have a friendly stringification of the
> source attribute, use overloading in SimpleValue.  there is an 
> as_text()
> method already in there that is currently commented out.
>
> -allen
>
>
> On Thu, 25 Nov 2004, Steffen Grossman wrote:
>
>> Update of /home/repository/bioperl/bioperl-live/Bio/SeqFeature
>> In directory pub.open-bio.org:/tmp/cvs-serv22868
>>
>> Modified Files:
>> 	Annotated.pm
>> Log Message:
>> 'source' now gives back its value instead of a
>> Bio::Annotation::SimpleValue object. (This is consisitent with
>> 'type').
>>
>>
>> Index: Annotated.pm
>> ===================================================================
>> RCS file: 
>> /home/repository/bioperl/bioperl-live/Bio/SeqFeature/Annotated.pm,v
>> retrieving revision 1.17
>> retrieving revision 1.18
>> diff -C2 -d -r1.17 -r1.18
>> *** Annotated.pm	24 Nov 2004 16:31:59 -0000	1.17
>> --- Annotated.pm	25 Nov 2004 10:02:50 -0000	1.18
>> ***************
>> *** 181,185 ****
>>     }
>>
>> !   return $self->get_Annotations('source');
>>   }
>>
>> --- 181,188 ----
>>     }
>>
>> !   my $source_anno = $self->get_Annotations('source');
>> !
>> !   return $source_anno->value if ($source_anno);
>> !   return undef;
>>   }
>>
>>
>> _______________________________________________
>> Bioperl-guts-l mailing list
>> Bioperl-guts-l at portal.open-bio.org
>> http://portal.open-bio.org/mailman/listinfo/bioperl-guts-l
>>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>
>
-- 
-------------------------------------------------------------
Hilmar Lapp                            email: lapp at gnf.org
GNF, San Diego, Ca. 92121              phone: +1-858-812-1757
-------------------------------------------------------------




More information about the Bioperl-l mailing list