[Bioperl-l] Annotated.pm

Allen Day allenday at ucla.edu
Sat Nov 27 02:06:41 EST 2004


On Fri, 26 Nov 2004, Hilmar Lapp wrote:

> 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.

stringified reference ( e.g. REF(0x804d584) ) is a string in my book.  
this is a backward compatible change.  if you're worried that the user 
will see the stringified reference if treating the returned value as a 
string and not a data structure, that's what the overloading is for.

i don't see a problem here.

> 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 

this is intentional and documented.

> 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).

what class are you referring to here?

> 
> 	-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
> >
> >
> 


More information about the Bioperl-l mailing list