<HTML>
<HEAD>
<TITLE>Re: [Biococoa-dev] BCSequenceFactory</TITLE>
</HEAD>
<BODY>
<BLOCKQUOTE><BLOCKQUOTE><FONT FACE="Georgia, Times New Roman"><SPAN STYLE='font-size:12.0px'><BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Georgia, Times New Roman"><SPAN STYLE='font-size:12.0px'>Works fine for a protein file, although I had to change the lines<BR>
<BR>
             if ( aSymbol = nullSymbol )<BR>
                 altCount++;<BR>
<BR>
to:<BR>
<BR>
             if ( aSymbol == nullSymbol )<BR>
                 altCount++;<BR>
<BR>
<BR>
to get it to work ;-)<BR>
<BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Georgia, Times New Roman"><SPAN STYLE='font-size:12.0px'>Sorry about that – it’s probably my most common stupid mistake.<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Georgia, Times New Roman"><SPAN STYLE='font-size:12.0px'><BR>
<BR>
BTW,  would it be an idea to use BCSymbolCounter for this?<BR>
</SPAN></FONT><SPAN STYLE='font-size:12.0px'><FONT FACE="Verdana, Helvetica, Arial"><BR>
</FONT></SPAN></BLOCKQUOTE><SPAN STYLE='font-size:12.0px'><FONT FACE="Verdana, Helvetica, Arial">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.<BR>
<BR>
<BR>
And from Alex:<BR>
</FONT></SPAN><BLOCKQUOTE><SPAN STYLE='font-size:12.0px'><FONT FACE="Verdana, Helvetica, Arial"><BR>
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. <BR>
</FONT></SPAN></BLOCKQUOTE><SPAN STYLE='font-size:12.0px'><FONT FACE="Verdana, Helvetica, Arial">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.<BR>
</FONT></SPAN><BLOCKQUOTE><SPAN STYLE='font-size:12.0px'><FONT FACE="Verdana, Helvetica, Arial"><BR>
<BR>
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,  <BR>
</FONT><FONT FACE="Georgia, Times New Roman">- (BCSequenceType *) guessSequenceTypeFromString: (NSString *) string; <BR>
- (BCSequence *) guessSequenceFromString: (NSString *) string; <BR>
</FONT><FONT FACE="Verdana, Helvetica, Arial">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). <BR>
</FONT></SPAN></BLOCKQUOTE><SPAN STYLE='font-size:12.0px'><FONT FACE="Verdana, Helvetica, Arial">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.<BR>
</FONT></SPAN><BLOCKQUOTE><SPAN STYLE='font-size:12.0px'><FONT FACE="Verdana, Helvetica, Arial"><BR>
<BR>
Now I'm in the nitpicking mode anyway, the method name guidelines suggest to do something like: <BR>
<BR>
sequenceTypeForUntypedString: or sequenceTypeForUnknownString: <BR>
and <BR>
sequenceFromUntypedString: or sequenceFromUnknownString: <BR>
<BR>
The originals don't suggest that something is returned...  <BR>
<BR>
</FONT></SPAN></BLOCKQUOTE><SPAN STYLE='font-size:12.0px'><FONT FACE="Verdana, Helvetica, Arial">If neither of you does this before tonight, I’ll check that in.<BR>
</FONT></SPAN><BLOCKQUOTE><SPAN STYLE='font-size:12.0px'><FONT FACE="Verdana, Helvetica, Arial"><BR>
</FONT></SPAN></BLOCKQUOTE><SPAN STYLE='font-size:12.0px'><FONT FACE="Verdana, Helvetica, Arial">Cheers,<BR>
<BR>
JT<BR>
</FONT></SPAN><BLOCKQUOTE><SPAN STYLE='font-size:12.0px'><FONT FACE="Georgia, Times New Roman"><BR>
</FONT></SPAN></BLOCKQUOTE><SPAN STYLE='font-size:12.0px'><FONT FACE="Georgia, Times New Roman"><BR>
<BR>
</FONT><FONT FACE="Verdana, Helvetica, Arial">_______________________________________________<BR>
This mind intentionally left blank<BR>
</FONT></SPAN>
</BODY>
</HTML>