[Biococoa-dev] converting from 3-letter code to 1-letter code

Koen van der Drift kvddrift at earthlink.net
Wed Aug 31 17:53:04 EDT 2005


[repost - I never received the first one back]

On Aug 28, 2005, at 9:00 PM, Koen van der Drift wrote:


> Hi,
>
> To enable the reading of PDB file, I added some code that converts  
> the three letter code for the amino acid to a string of 1-letter  
> code. Right now it is in readPDBFile in BCSequenceIO. After  
> fiddling with subdictionaries and arrays, I suddenly realized it  
> would be easier with using a symbolset.
>
> I will commit the code if  cvs lets me, so it might take a while  
> for the code is available. In the meantime, I have these questions:
>
> 1. Maybe we should move this to a separate method, in case there  
> are more file formats that use the three letter code? (I guess the  
> answer is yes)
>


I an attempt to make it more usuable, I moved the code to a separate  
method in BCSequence, instead of BCSequenceIO. Here's some code:

// new method:

+ (BCSequence *)sequenceWithThreeLetterString:(NSString *)aString  
symbolSet:(BCSymbolSet *)aSet
{
     NSString *oneLetterString = [self  
convertThreeLetterStringToOneLetterString: aString symbolSet: aSet];

     return [[[BCSequence alloc] initWithString:oneLetterString  
symbolSet:aSet] autorelease];
}


// another new method:

- (NSString *)convertThreeLetterStringToOneLetterString:(NSString *) 
aString symbolSet: (BCSymbolSet *)aSet
{
....do the conversion, and return a new string
}

I have been staring at this for a while now, but the compiler says that:

'BCSequence' may not respond to  
'+convertThreeLetterStringToOneLetterString:symbolSet:'


As far as I can tell (also in the .h file)  
convertThreeLetterStringToOneLetterString is a regular method, not a  
class method.  I must be overlooking something, but I cannot see it.

Any ideas?


thanks,

- Koen.






More information about the Biococoa-dev mailing list