[Biococoa-dev] Using an untyped class sequence
    Charles Parnot 
    charles.parnot at gmail.com
       
    Mon Jul  4 17:55:50 EDT 2005
    
    
  
Here is one situation where an untyped sequence class can be simpler  
to use. You have a BCSequence displayed in a nice BCSequenceView. The  
user chooses 'Reverse Complement' in the toolbar of the sequence  
window (the delegate is thus first responder and is self below). You  
want to create a new sequence from it.
- (IBAction)reverseComplement:(id)sender
{
     BCSequence *initialSequence = [self sequence];
     [MyDocument newSequenceWindowWithSequence:[initialSequence  
reverseComplement]];
}
Now, I tried to think of how to implement that with typed sequences,  
though the overall architecture of the app might end up being quite  
different.
- (IBAction)reverseComplement:(id)sender
{
     BCSequence *initialSequence = [self selectedSequence];
     BCSequence *newSequence;
     if ( [originalSequence type] == BCSequenceDNA )
         newSequence = [(BCDNASequence *)initialSequence  
reverseComplement]; //cast to avoid compiler warnings
     else if ( [originalSequence type] == BCSequenceDNA )
         newSequence = [(BCDNASequence *)initialSequence  
reverseComplement]; //cast to avoid compiler warnings
     else
         return;
     [MyDocument newSequenceWindowWithSequence:newSequence];
}
I know it is a contrived example, but I am just thinking a general  
sequence view program à-la DNAStrider.
charles
--
Xgrid-at-Stanford
Help science move fast forward:
http://cmgm.stanford.edu/~cparnot/xgrid-stanford
Charles Parnot
charles.parnot at gmail.com
    
    
More information about the Biococoa-dev
mailing list