[Biococoa-dev] sequence wrappers

Koen van der Drift kvddrift at earthlink.net
Thu Dec 16 13:29:06 EST 2004

On Dec 16, 2004, at 10:53 AM, Alexander Griekspoor wrote:

>>>> I strongly argue to only implement the first and dump the second...
>>> I disagree :). I favor to have just one BCFeatures object (which 
>>> maintains a dictionary) instead of many BCFeature objects, each with 
>>> one key-value pair. this makes it easy to acces the data:
>> That exactly goes straight into your "I want lots of small objects 
>> instead of one big" ;-)

Yes, I just realized that. I think we both agree however, to use a 
separate object to store features and annotations. I looked at the 
bioperl doc again, and I like their approach actually.

I guess it also what you have in mind (perlcode):

foreach my $feat_object ($seq_object->get_SeqFeatures) {
	print "primary tag: ", $feat_object->primary_tag, "\n";
	foreach my $tag ($feat_object->get_all_tags) {
		print " tag: ", $tag, "\n";
		foreach my $value ($feat_object->get_tag_values($tag)) {
			print " value: ", $value, "\n";

The nice thing about this, what I didn't realize before, is that a 
feature itself can have a sub-feature. What they also do is store a 
sequence in the features object. I guess that's to store the 
subsequence of the feature. Not sure yet if I like that.

Anyway, contrary to what I argued before, I think indeed that single 
BCFeature and BCAnnotation objects stored in an array (or dictionary) 
within a BCSequence object is the way to go.

>>> [[mySequence features] featureForKey];
>> I would propose: [mySequence featureForKey:  ]
>> Even simpler ;-)

Yes, but in that case the BCFeature objects are stored in a dictonary, 
not an array. That's also a good idea.

So, let's see:

BCSymbolList -> has-a symbolArray	// this is the previous BCSequence 
-----BCSequence -> has-a featuresDictionary and annotationsDictionary
	------BCSequenceDNA, etc		// unchanged	

The featuresDictionary and annotationsDictionary have BCFeature and 
BCAnnotation objects as values, respectively, which can be accessed 
using the proper keys, using code such as: [mySequence featureForKey:  

We're getting there!

- Koen.

More information about the Biococoa-dev mailing list