[Biococoa-dev] singletons

Alexander Griekspoor mek at mekentosj.com
Sun Aug 22 16:40:31 EDT 2004

> Well, it's very easy to avoid the proliferation of methods.  Simply 
> have a
> static NSDictionary with all the bases/aa's, and have a single accessor
> method that pulls the base/aa out of the dictionary based on a 
> name/symbol.
> What I was trying to avoid by not doing that was the cost in terms of
> processing time of doing the lookup in the dictionary, which will get
> substantial once you start iterating over thousands of Symbols.  I'd 
> like
> this to scale well to BAC sized items (800,000 Symbols or so).  
> Proteins
> don't often go above about 2000 aa's, so this may not be much of a 
> worry for
> you.

I agree, 800,000 symbols might give rise to problems when accessing 
things using object messaging...

> One thing that does bug me is the need for an "if" statement in each 
> method
Well I guess a switch statement is pretty lightweight and not really a 
problem, even with 800,000 symbols (not tested, no experience 
disclaimer here).

> - longer term, I was thinking that it might be nice to have a single
> initialization method required before using Symbols.  That way, any 
> delay
> during initialization could be accompanied by a notification to the 
> user -
> "Loading Bases and Amino Acids..."

Again, here Alphabets might come in very handy. If you use a DNA 
sequence for the first time, you init the DNA alphabet containing the 
DNA symbols all at once for the first time. Although I don't see why 
initializing these few objects (at most 20 or so for amino acids) would 
take longer then the blink of an eye. Certainly not long enough for the 
message to be necessary. What I was thinking about was perhaps to have 
two methods for instantiating sequences from files/strings. One that 
does it directly ("while you wait") and one that does it non-blocking 
and works through delegates notifications ala didCreateSequence if time 
really gets long for huge sized sequences.


                     ** 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

       Microsoft is not the answer,
       Microsoft is the question,
       NO is the answer


More information about the Biococoa-dev mailing list