[Biojava-dev] Contributing chromatogram support to BioJava

Matthew Pocock matthew_pocock at yahoo.co.uk
Mon Mar 10 11:22:53 EST 2003


Hi Rhett,

back in the good old days, we made prety much everything public. Then we 
realised that was bad. unfortunately, the realy old packages have not 
been totaly spring-cleaned for cruftily exposed API. Implementing 
symbols propperly is hard, which is why we attempt to provide all the 
tools for creating your own without writing new classes. Hey ho.

Ok - so you want an alphabet that contains symbols that are a DNA 
nucleotide and an integer. You can do that with some variant of the 
following:

Alphabet dna_int = AlphabetManager.getCrossPRoductAlphabet(
   Arrays.asList(new Alphabet[] {
     DNATools.getDNA(),
     IntegerAlphabet.getInstance()
   } );

ALphabet dna_int100 = AlphabetManager.getCrossPRoductAlphabet(
   Arrays.asList(new Alphabet[] {
     DNATools.getDNA(),
     IntegerAlphabet.getSubAlphabet(0, 99)
   } );

And now, we can get the symbol in these alphabets using 
Alphabet.getSymbol() ...

Symbol a4 = dna_int.getSymbol(
   Arrays.asList(new Symbol[] {
     DNATools.a(),
     IntegerAlphabet.getSymbol(4)
   } );

This should do what you want.

Matthew

Rhett Sutphin wrote:
> Hi,
> 
> Rhett Sutphin wrote:
> 
>  > On Wednesday, March 5, 2003, at 03:29  AM, Matthew Pocock wrote:
>  >
>  >> Sounds great! I for one could realy use this stuff.
>  >> Could you dump the javadoc somewhere so that we can
>  >> just double-check the API, and then we can sort you
>  >> out. Are you intending to dump the code into biojava
>  >
>  >
>  > I'll do this sometime this weekend.
> 
> The API is up at 
> http://www.detailedbalance.net/~rhett/dev/biojava/chromat-contrib/doc/ .
> The package structure is still the original structure that I described 
> in my last message, except with org.biojava.bio prepended.  I'm ready to 
> change it if you folks recommend.
> 
> I've ported almost all the code over to using biojava Symbols (etc.) -- 
> only ChromatogramGraphic is left to go.  I ran into one snag during this 
> conversion:  SimpleBasisSymbol is a package-level class.  You'll see in 
> the API that I would like to represent base calls as a type of 
> BasisSymbol (since they're a concatenation of a DNA symbol [the call] 
> and an integer [the sample offset of the peak]).  Subclassing 
> SimpleBasisSymbol seems like the best way to do this -- in fact, I 
> already did it by modifying a local copy of BioJava 1.3pre1.
> 
> Is there a strong reason for this access restriction?  Looking through 
> the mailing list archives, I see that this has been mentioned, but not 
> explained.  The API is inconsistent -- AbstractSymbol and 
> SimpleAtomicSymbol are public while SimpleSymbol and SimpleBasisSymbol 
> are not.
> 
> If there is a strong reason for this, is there a recommended path to 
> implementing BasisSymbol without a lot of redundant code?
> 
> Rhett
> 


-- 
BioJava Consulting LTD - Support and training for BioJava
http://www.biojava.co.uk



More information about the biojava-dev mailing list