[Biococoa-dev] BCSequence

Alexander Griekspoor mek at mekentosj.com
Sun Aug 22 16:59:41 EDT 2004


>> Is that correct?  My big worry about this approach is what might 
>> happen with
>> a threaded app, where the first method might be called from a 
>> different
>> thread before the information could be retrieved.
>
> But isn't that true for every variable, such as the NSArray of Symbols 
> itself?

[NSLock lock] Ooh, thread safety... Help! Let's make that a secondary 
goal or not? [NSLock unlock]  ;-)

> It's a NSSting representation of the array of Symbols, using their 
> 'symbolString' variable.
John, I send you a copy of the emails where we discussed this to make 
sure...

>> If we're going to have a generic "initWithString" method, we're going 
>> to
>> have to define some order of preference for what type of sequence to
>> generate.  Maybe try DNA, if that doesn't work for all letters, try 
>> RNA, if
>> that doesn't work, try protein?
First RNA (you can check for the presence of uracil), then DNA, else 
protein, else error.

>> If we keep a BCSequenceType variable, then
>> something like:
>> - (void)insertSymbolsFromString:(NSString *)s atIndex:(int)index;
>> Can use that in order to decide what type of sequence to add.
Alphabet?

> Or, have a validation method in each initWithString method that checks 
> if it is really a DNA, protein, etc. So the user does something like:
>
> mysequence = [[BCSequenceProtein] alloc] initWithString: 
> @"ELVISLIVES"];
>
> It will return nil, or an NSError if it is not a protein, eg when the 
> string @"KOENVANDERDRIFT" is passed.

I like both ideas. We could have:
- a utility method that is passed a string and check what the most 
likely type it is
- a general init method which uses the above method
- specific init methods for each type that include validation of the 
type above
- specific init methods that are passed alphabets to use (if we go that 
way, the previous method could be replaced)
- a utility method to validate strings for type and/or alphabets

>> For a consistent naming convention:
>> When setting/getting an array of symbols, use SymbolArray in the 
>> method
>> name.
>> When setting/getting a sequence object, use Sequence in the method 
>> name.
>
> sounds good!
Copy that!

>> It's probably worth creating both types of methods for all the 
>> methods like
>> "partialSequence", since we don't know what's going to be most useufl 
>> for
>> the users.

Not duplicate, make one detailed method which accepts a range (the 
method should therefore also to range validation, and if not properly, 
return range exceptions), and one convenience method (without the range 
parameter) that assumes the range to be the complete sequence:

- doOperationOnSequence{
	[self doOperationOnSequenceForRange: <here range of complete 
sequence>];
}

- doOperationOnSequenceForRange: (NSRange) aRange{
	blabla;
}

> I'm not sure what you mean here.
But perhaps I misunderstood the remark as well...

Alex
*********************************************************
                     ** Alexander Griekspoor **
*********************************************************
               The Netherlands Cancer Institute
               Department of Tumorbiology (H4)
          Plesmanlaan 121, 1066 CX, Amsterdam
                   Tel:  + 31 20 - 512 2023
                   Fax:  + 31 20 - 512 2029
                   AIM: mekentosj at mac.com
                   E-mail: a.griekspoor at nki.nl
               Web: http://www.mekentosj.com

                           Mac vs Windows
	65 million years ago, there were more
                      dinosaurs than humans.
	     Where are the dinosaurs now?

*********************************************************




More information about the Biococoa-dev mailing list