[Bioperl-l] AnnotationCollectionI and SeqFeatureI changes
hlapp at gmx.net
Sun Nov 28 22:08:40 EST 2004
On Sunday, November 28, 2004, at 08:28 AM, Aaron J. Mackey wrote:
>> E.g., get_all_tags() will now return all annotation keys ever added,
>> regardless of whether through $feat->primary_tag, $feat->source_tag,
>> $feat->annotation->add_Annotation, or $feat->add_tag_value, unless
>> any of these methods is overridden.
> Thanks for taking a deeper look into things, Hilmar. Is this true for
> all SeqFeatureI-implementing classes, or just
Including primary_tag and source_tag in the annotation collection is
what SeqFeature::Annotated does. Lumping together tags and annotation
is the default decorating implementation on the AnnotatableI interface
for the *_tag_* methods, and hence will be used for all SeqFeatureI
implementing classes that don't override it. SeqFeature::Generic, for
instance, doesn't override it (anymore), but it does keep primary_tag
and source_tag separate from the annotation bundle.
So, evidently there are subtle aspects about the various tags and the
annotation that have not been spelled out when documenting the contract.
Specifically, this is whether an implementation may or must keep the
different tags and annotations in sets that at least behave as
semantically distinct sets. E.g., if you set a primary_tag, may an
implementation treat it as annotation and still be SeqFeatureI
compliant (meaning, as a SeqFeatureI consumer, you'd have to be
prepared for that). Or, if you add a tag 'blah' via
add_tag_value('blah',$whatever), may an implementation or may it not
enforce the same class on $whatever that it enforces for annotations
added to the collection under the same key 'blah'.
In the absence of this having been spelled out beforehand, I would
argue that the most frequently used implementations' behavior will
probably constitute what other programmers took as an answer. In this
case, that'd be SeqFeature::Generic ...
>> This is very different from what it used to be, namely only return
>> those keys added through $feat->add_tag_value. Anybody who made any
>> assumption that what you didn't add through add_tag_value you'll not
>> get back through get_all_tags will be hosed.
> I could see an argument that "all_tag_values" should really retrieve
> just that: all tags, not just any extra tags from add_tag_value. But
> I agree that it's potentially a significant change.
Yes, and yes. It's a drastic change in behavior, but would be sensible
if the target is to eventually obsolete the concepts of tags and
annotations being different animals.
>> I.e., anybody who assumed that $feat->get_all_tags and
>> $feat->annotation->get_all_annotation_keys hold distinct sets of
>> values will be hosed. This includes bioperl-db, for those who care.
> But surely bioperl-db could be fixed to no longer make this assumption?
It certainly could, and I certainly will once this is the direction
that bioperl 'officially' adopts. Right now, the change is two weeks
old and I'm not sure anyone, including Allen, is ready to vouch that
this is a real good way of doing things. [And as aside, fixing
bioperl-db to work with the new API may make bioperl-db backwardly
incompatible as well.]
I'm not saying this change of direction may be a show-stopper for any
dependent package like bioperl-db. All I'm suggesting is let's be clear
that this *is* a change of direction for a core interface, and let's
give it some time to phase it in and to iron out wrinkles, both on the
end of bioperl itself as well as the end of people who write software
against bioperl. Let's give it some time to see how it works, and how
it works under stress, before letting it lose on the general public who
just wanted to get some bugfixes on the 1.4.0 release or some
>> It is also not what SeqFeature::Generic will do now, namely not
>> return the primary_tag and source_tag keys.
> Ahh, so we are talking only about Bio::SeqFeature::Annotated?
Well, no, see above. SeqFeature::Generic does override primary_tag and
source_tag, which is why here those tags won't make it into the
annotation bundle. It doesn't override the *_tag_* methods, so for
those you get the behavior from AnnotatableI.
Hilmar Lapp email: lapp at gnf.org
GNF, San Diego, Ca. 92121 phone: +1-858-812-1757
More information about the Bioperl-l