[Biococoa-dev] new svn repository

Koen van der Drift kvddrift at earthlink.net
Thu Mar 23 21:03:33 EST 2006

On Mar 23, 2006, at 5:18 AM, Alexander Griekspoor wrote:

> checkout went fine, I'll have a look at the demo later...


I just started converting the BCAppDemo, and have some questions for  
you. In the complement, etc methods, you use the following code:

- (IBAction)complement:(id)sender{
	NSString *replacement;
	NSTextStorage *ts = [sequenceTextView textStorage];
	if([ts length] == 0){
	NSRange sel = [sequenceTextView selectedRange];
	if(sel.length > 0) {
		replacement = [[[ts attributedSubstringFromRange: sel] string] 
		[ts replaceCharactersInRange: sel withString: replacement];
		[sequenceTextView setSelectedRange: sel];
	else {
		replacement = [[ts string]convertToComplement];
		[sequenceTextView setString: replacement];

1. Why are you using textStorage and attributedstring, instead of  
just the string from the NSTextView?
2. If there is a selection, you seem to be just calculating the  
complement of that part, and leave the rest intact, is that correct?

When using the BCSequence, I will probably use code similar to:

BCSequence *original = [BCSequence initWithString: [sequenceTextView  
BCSequence *complement = [original complement];
[sequenceTextView setString: [complement sequenceString]];

However, I will wait for your comments about the selection range  
before I implement it.


- Koen.

More information about the Biococoa-dev mailing list