[Biococoa-dev] rangeOfSubsequence problem

Koen van der Drift kvddrift at earthlink.net
Sat Oct 30 09:13:02 EDT 2004


Hi,

While working on the wrapper class for rangeOfSubsequence, I think I 
found some errors in the current code that's in the various BCSequence 
files. I had to change the following :

     if ( theLimit.location + theLimit.length >= [sequenceArray count] )

should be:

     if ( theLimit.location + theLimit.length > [sequenceArray count] )


and the two lines:

         entryBase = (BCNucleotideDNA *)CFArrayGetValueAtIndex( 
(CFArrayRef) entry, 0);

should be:

         entryBase = (BCNucleotideDNA *)CFArrayGetValueAtIndex( 
(CFArrayRef) [entry sequenceArray], 0);



It works now, except when the search string is at the end of the 
sequence, then I get an out of bounds error. Haven't tracked that one 
yet, though. To test the code, just add this to the translation demo:

	NSRange foundIt = [theSequence rangeOfSubsequence:
						[BCSequenceDNA DNASequenceWithString: @"AAT" skippingNonBases: 
YES]];
							
	 NSLog ( @"%i %i", foundIt.location, foundIt.length );


cheers,

- Koen.




More information about the Biococoa-dev mailing list