[Biococoa-dev] BCNucleotideRNA

Koen van der Drift kvddrift at earthlink.net
Sat Sep 25 06:45:28 EDT 2004

On Sep 22, 2004, at 8:38 PM, John Timmer wrote:

>> - Is it necessary to duplicate all the code from BCNucleotideDNA,
>> except for the uridine instead of thymidine? Why not have a class
>> BCNucleotide that takes care of everything, and just have two
>> subclasses with the small differences?
> That was my long-term intention.  I just wanted to get things working
> quickly so that I could get translation and codons handled.  Once I was
> happy with how they worked, I figured I could go back and sort out a 
> better
> class structure.  Even so, all the base methods have to be separate 
> for DNA
> and RNA, as they need to return something different so that == works as
> expected, so the classes won't shrink as much as I'd have hoped.

I still think we can add a BCNucleotide class, because there are a 
couple of methods that are exactly the same in both classes.

I had another look at BioJava to see how they solve this. Actually, 
they only have a Symbol class, no SymbolDNA, SymbolRNA, 
SymbolAminoAcid, etc. The same for Sequence, no subclassing. What they 
do is pass the right Alphabet (I think this is what Alex is working on 
in BCSymbolSet) to create a sequence, and you know you're dealing with 
DNA, RNA, Protein, etc.  It uses a couple of more classes (Alphabet, 
AlphabetManager, SequenceFactory, etc), but is a very elegant solution, 

- Koen.

More information about the Biococoa-dev mailing list