[Biococoa-dev] translation demo

Alexander Griekspoor mek at mekentosj.com
Sun Sep 26 05:12:33 EDT 2004


Ok guys, I think I fixed most stuff, a few remarks about the changes I 
made:

Please always use #import instead of #include, the first checks whether 
a header has already been included. I found one in BCNucleotideRNA, I 
guess John did a bit to much C programming in the meantime ;-)

I experienced all the problems Koen described, and managed to pinpoint 
them back to the new BCCodonRNA and -DNA headers.
First, most headers John added were still marked as project instead of 
public in the target, thus not ending up in the headers directory of 
the framework. The translation app couldn't see them this way. Still, 
changing this didn't completely fix stuff.
The trick is that we now satisfy the compiler with the @class directive 
instead of using header imports in the .h file. In BCCodon we had 
already put a few, and apparently if you then put the same there again 
in a direct subclass this results in errors. To prevent this, just 
leave all @class calls away first, and only add those that the compiler 
starts to complain about.
Anyway, the frameworks build fine again.

I noticed still a few problem in BCToolTranslatorDNA. First a few 
compiler complaints because of the use of BCCodon while methods in 
BCCodonDNA were called (- matchesTriplet; + unmatched;). I fixed that 
one by typing to BCCodonDNA (as it is a DNA translator anyway we are 
specialized already anyway).

Then the errors Koen described:

> But still get 2 warnings:
>
> theController.m:54: cannot find method 
> `+translateDNASequence:usingGeneticCode:'; return type `id' assumed
> theController.m:54: `BCToolTranslatorDNA' may not respond to 
> `+translateDNASequence:usingGeneticCode:'
>
> I don;t understand that because BCToolTranslatorDNA.h is in the lines 
> above.

I think this one is now fixed with the @class problems


> If I start the app anyway, enter a sequence and click the button, I 
> get this error:
>
> 2004-09-25 20:40:07.478 Translation[1316] Attempt to mutate immutable 
> NSString with replaceOccurrencesOfString:withString:options:range:
>
> Which happens in BCGeneticCode.m, line 181
>
> Although the NSString in question (aKey) is an NSMutableString, I 
> think it points to an NSString, so maybe that's why the error occurs.

That one is still there and happens here:

+ (NSMutableDictionary *) priv_createCodonArraysFromDictionary: 
(NSDictionary *)entry {
     NSMutableArray *DNAArray = [NSMutableArray array];
     NSMutableArray *RNAArray = [NSMutableArray array];
     NSEnumerator *keyEnumerator = [entry keyEnumerator];
     NSMutableString *aKey;
     BCCodon *aCodon, *RNACodon;
     while ( aKey = [keyEnumerator nextObject] ) {
         aCodon = [[[BCCodonDNA alloc] initWithDNASequenceString: aKey 
andAminoAcidString: [entry objectForKey: aKey]] autorelease];
         if ( aCodon != nil )
             [DNAArray addObject: aCodon];
  =====>>>       [aKey replaceOccurrencesOfString: @"T" withString: @"U" 
options: NSCaseInsensitiveSearch range: NSMakeRange(0, 3)];

Although aKey is typed as a mutable string you probably get normal 
strings from the enumerator and thus you can't replace the occurences 
of T for U.


One other little thing. John you created two "private methods" in 
BCGeneticCode. They are not private however as they are in the public 
header file. The way to do this is to create kind of a private category 
inside the .m file. I changed it, so take a look at BCGeneticCode.m to 
see what I mean. This way they are completely invisible to the 
developer. Of course he has the source, so if he wants to per se, he 
can still call it, but at least he will get some warnings ;-)

Finally, the header doc shell scripts gives me troubles, and the 
project seemed not to have remembered the "only on installing" 
checkbox, anyone a clue on this one?

I'll continue with the other discussion we had....

Cheers,
Alex




Op 26-sep-04 om 2:46 heeft Koen van der Drift het volgende geschreven:

>
> On Sep 25, 2004, at 8:22 PM, Koen van der Drift wrote:
>
>> Hi,
>>
>> Is anyone able to build the translation demo? I think it has to do 
>> with the line:
>>
>> #import <BioCocoa/BCFoundation.h>
>>
>
>
> To reply to myself, I replaced that line with:
>
> #import "../../BCFoundation/BCGeneticCode/BCCodon.h"
> #import "../../BCFoundation/BCSequence/BCSequenceDNA.h"
> #import "../../BCFoundation/BCSequence/BCSequenceProtein.h"
> #import 
> "../../BCFoundation/BCTools/BCTranslation/BCToolTranslatorDNA.h"
> #import "../../BCFoundation/BCUtils/BCUtilStrings.h"
>
> But still get 2 warnings:
>
> theController.m:54: cannot find method 
> `+translateDNASequence:usingGeneticCode:'; return type `id' assumed
> theController.m:54: `BCToolTranslatorDNA' may not respond to 
> `+translateDNASequence:usingGeneticCode:'
>
> I don;t understand that because BCToolTranslatorDNA.h is in the lines 
> above.
>
>
> If I start the app anyway, enter a sequence and click the button, I 
> get this error:
>
> 2004-09-25 20:40:07.478 Translation[1316] Attempt to mutate immutable 
> NSString with replaceOccurrencesOfString:withString:options:range:
>
> Which happens in BCGeneticCode.m, line 181
>
> Although the NSString in question (aKey) is an NSMutableString, I 
> think it points to an NSString, so maybe that's why the error occurs.
>
>
> Any ideas?
>
> thanks,
>
> - Koen.
>
> _______________________________________________
> Biococoa-dev mailing list
> Biococoa-dev at bioinformatics.org
> https://bioinformatics.org/mailman/listinfo/biococoa-dev
>
>
*********************************************************
                     ** Alexander Griekspoor **
*********************************************************
               The Netherlands Cancer Institute
               Department of Tumorbiology (H4)
          Plesmanlaan 121, 1066 CX, Amsterdam
                   Tel:  + 31 20 - 512 2023
                   Fax:  + 31 20 - 512 2029
                   AIM: mekentosj at mac.com
                   E-mail: a.griekspoor at nki.nl
               Web: http://www.mekentosj.com

                           Mac vs Windows
	65 million years ago, there were more
                      dinosaurs than humans.
	     Where are the dinosaurs now?

*********************************************************


**************************************************************
                         ** Alexander Griekspoor **
**************************************************************
                  The Netherlands Cancer Institute
                  Department of Tumorbiology (H4)
             Plesmanlaan 121, 1066 CX, Amsterdam
                        Tel:  + 31 20 - 512 2023
                        Fax:  + 31 20 - 512 2029
                       AIM: mekentosj at mac.com
                       E-mail: a.griekspoor at nki.nl
                    Web: http://www.mekentosj.com

MacOS X: The power of UNIX with the simplicity of the Mac

***************************************************************




More information about the Biococoa-dev mailing list