[Biococoa-dev] BCSequenceFactory

John Timmer jtimmer at bellatlantic.net
Thu Dec 2 10:46:10 EST 2004

> Works fine for a protein file, although I had to change the lines
>              if ( aSymbol = nullSymbol )
>                  altCount++;
> to:
>              if ( aSymbol == nullSymbol )
>                  altCount++;
> to get it to work ;-)
Sorry about that ­ it¹s probably my most common stupid mistake.
> BTW,  would it be an idea to use BCSymbolCounter for this?
Yeah, but I had forgotten you moved it out of the BCSequence class.  I
couldn¹t find it right away (even though it¹s in the same directory ­ duh!),
so I just copied and pasted some code from elsewhere.  This code would be
faster anyway, so I don¹t see the need to change it to the SymbolCounter ­
opening files should be as quick as possible.

And from Alex:
> Very nice John, also very compact! Although a possibility to use the
> loopcounter object, I wouldn't do it here as it spreads the code and makes t
> more complicated to understand. But perhaps if the loopcounter is a shared
> object and it would thus involve only one line of code (and no alloc inits),
> it could still me a nice idea. I leave that up to you... John, just from
> curiosity, how much faster is doing this the core foundation way instead of
> cocoa. 
Okay, loopCounter isn¹t an object.  It¹s basically an integer type that will
change according to however Apple defines an integer ­ your code will
compile appropriately even if Apple decides to define integers as 128-bit
vectors at some point in the future.  The speedups I was seeing in this code
compared to object enumerators was somewhere around 2-3X, depending on the
context.  Given that we have to loop through 3 sequences, this will probably
be significant.
> One other remark, I understand the optimization to only create the sequence
> once, but I think we should in this case not replace the method, but add one.
> Thus,  
> - (BCSequenceType *) guessSequenceTypeFromString: (NSString *) string;
> - (BCSequence *) guessSequenceFromString: (NSString *) string;
> Sometimes, you just want to know the type instead of getting the sequence
> back. In the documentation we can point the reader to the fact that if he want
> to have the sequence, there's the other method (and thus prevent him to do
> double work). 
Fair enough ­ the type method can just call the sequence method, and return
whatever type of sequence it is.  It¹s a nice one-liner.
> Now I'm in the nitpicking mode anyway, the method name guidelines suggest to
> do something like:
> sequenceTypeForUntypedString: or sequenceTypeForUnknownString:
> and 
> sequenceFromUntypedString: or sequenceFromUnknownString:
> The originals don't suggest that something is returned...
If neither of you does this before tonight, I¹ll check that in.


This mind intentionally left blank

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.bioinformatics.org/pipermail/biococoa-dev/attachments/20041202/84578da4/attachment.html>

More information about the Biococoa-dev mailing list