allenday at ucla.edu
Sat Nov 27 02:45:44 EST 2004
On Fri, 26 Nov 2004, Hilmar Lapp wrote:
> On Friday, November 26, 2004, at 11:06 PM, Allen Day wrote:
> >> 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.
> Maybe I'm missing something but I'm not sure why you would want code
> that is brittle on purpose. Why would that help the end user?
if you're not sure how many annotations there are, you'd better call it in
list context unless you want the count:
my @value = $feature->get_Annotations('key1');
my $count = $feature->get_Annotations('key1');
but if you're sure there is only one, you can call it either way:
my @value = $feature->get_Annotations('key2');
my $value = $feature->get_Annotations('key2');
> >> 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?
> The one in the subject line.
I don't see any lines with 'isa' that also contain
Bio::Annotation::OntologyTerm. Please be more specific.
More information about the Bioperl-l