[Biococoa-dev] BCSequence init methods

Koen van der Drift kvddrift at earthlink.net
Thu Feb 3 20:53:06 EST 2005


Hi Charles,

Just noticed the new additions. However, BCAbstractSequence does not 
show up in my project. Make sure you also commit the project.pbxproj 
file in Xcode. To do this, click on the triangle next to 'SCM' in the 
left panel of the main window of Xcode. Then right click on 
project.pbxproj and select cmmit changes. Hopefully that will take care 
of it.

> * I believe some of the factory methods in the subclasses are 
> redundant; I am talking about the '+dnaSequenceWithString:' and 
> equivalents; normally, defining a '+sequenceWithString' in the 
> superclass is enough, because the type of the returned object is 
> defined by the class used for the call, e.g.
>
> 	BCSequenceDNA *dna=[BCSequenceDna sequenceWithString:@"ATCGGGT"];
> 	BCSequenceProtein *prot=[BCSequenceProtein 
> sequenceWithString:@"AOCOCOIB"];
>
> 	It would make the interface cleaner and more consistent, and reduce 
> the amount of code by factoring it out to the superclass.

Sounds good to me. So as far as I am concerned, please go ahead and 
make the changes.

>
> * There is this concept of 'skippingNonBases' in the BCSequenceDNA, 
> which could indeed be useful; but this could actually be useful for 
> all the subclasses, proteins as well as DNA (the rationale is to 
> handle pasting from output where there are numbers, spaces and other 
> non-relevant characters); so I thought we could maybe put the code in 
> the superclass and use something more generic like 
> 'skippingUndefinedSymbols' (if you have a better shorter name, I'll 
> take it); again, more consistent interface and more shared code in the 
> superclass

Again, I like the idea of shared code where possible, so this seems to 
me also a good idea. I don;t have an alternative for 
skippingUndefinedSymbols rijt now, but it says what it does, so why not 
leave it. This is also very related to my idea of finally implementing 
the BCSymbolSet, similar to alphabets in BioPerl and BioJava. I might 
have some time this weekend to finally implement this :-)

>
> * I still don't know what to do with '-initWithSequence:' if the 
> target and the argument are different sequence types; should we return 
> an empty sequence unless they are the same type?; should we 
> translate?; the latter might seem logical, but this innocent method 
> name would then be hiding quite an important feature... I propose we 
> drop that method (and +sequenceWithSequence), and let the user with 
> 'copy', and then come up with a better name for a method that would do 
> the tranformation of one sequence type into another.

Not sure yet what to do in this situation. I would not do a translation 
or something else, because that would make the method unpredictable. I 
suggest to comment out both methods for the meantime. For 
transformation and translation we should use a class in the BCTools 
hierarchy.
>

> I put at the end of the email what I would propose as init and factory 
> methods for the different subclasses. There are not many changes from 
> the current status, in fact. I put some comments to indicate which 
> methods will really need to be implemented in the subclass (well, the 
> code is already done, anyway). This little 'cleaning' would be nice 
> before we add the annotations stuff, what do you think?

I am not sure what you want to propose.

>
> One more random thought: We probably don't need annotations in the 
> init methods (or at least we can live without for a while). We would 
> just need to set the ivar to nil at init and then alloc it at the 
> first '-addAnnotation:'.

Yep :)

- Koen.




More information about the Biococoa-dev mailing list