[Biococoa-dev] BCSequence
Koen van der Drift
kvddrift at earthlink.net
Wed Aug 25 20:55:28 EDT 2004
On Aug 25, 2004, at 6:06 PM, Alexander Griekspoor wrote:
>>
>> I think we should treat the modifications as an array of BCSymbols.
> Hmm, yes and no. Indeed modifications are kind of symbols, thus they
> could have BCSymbol as their superclass. But where symbols have no
> clue of there location (that's determined by the array in which they
> are), modifications should be kept in a kind of dictionary with the
> location as key for instance.
Yes, you are absolutely right. One issue with a dictionary is that the
indices change when a client requests a subsequence, how do we handle
that? So maybe the modifications should be a member variable of each
BCSymbol. The whenever inof about a BCSymbol is requested, either to
calculate mass, draw it, or show an inspector panel, the info about the
modification is available.
> I see your point, indeed when the NCBI file lists phosphorylation it
> means that a particular sequence is annotated as a (potential)
> phosphorylation SITE and not as being actually phosphorylated. This is
> where I made the mistake. In that respect your right, the site is an
> annotation, an actual phosho-group on an amino-acid is a modification.
Well, I didn't even mean it that way :) But a -Me or -PO4 group should
be treated as a modification, that's the general accepted term anyway
(post-translational modifications). So I still would favour to keep
the modifications separate from feautures/annotations. Also because
they are probably not always requested at the same time. And it's also
more OOP-like to have smaller objects instead of putting everything
together.
>> For example we have the class MassCalculator with the following
>> methods
>>
>> -(id) MassCalculator initWithSequence:(BCSequence *)seq
>> -(id) MassCalculator initWithSubSequence:(BCSequence *)seq
>> inRange:(NSRange)aRange
>> -(id) MassCalculator initWithString:(NSString *)seq
>> -(id) MassCalculator initWithSubString:(NSString *)seq
>> inRange:(NSRange)aRange
>>
>> -(float)getMass useMassType:(BCMassType)type
>> addModifications:(BOOL)mods
>>
>> The getMass method iterates over all symbols and adds the mass, just
>> as we do now in the molecularWeight method.
>>
>>
>> Then we use it as follows:
>>
>> MassCalculator calculator = [[MassCalculator alloc]
>> initwithSequence:mySequence];
>>
>> float totalMass = [calculator getMass useMassType:BCAverage
>> addModifications:YES];
>>
>> [calculator release];
>
> I like the idea, looks very nice! The only thing I doubt about is if
> we should implement a string version of all methods as well.
Yes, you are right - I won't add those methods :)
- Koen.
More information about the Biococoa-dev
mailing list