[Biojava-l] Gap: Basis Symbol vs Symbol

Matthew Pocock mrp@sanger.ac.uk
Mon, 12 Feb 2001 14:59:40 +0000


Emig, Robin wrote:

??? Clearly we are lacking in documentation ???

Try:

<java>
// make a list of the symbols - in this case 3 gaps,
// could be any three symbols e.g. c, c, t or a, -, t
List gapList = Collections.nCopies(3, AlphabetManager.getGapSymbol());

// now get back a symbol that represents this list
Symbol gap3 = dna3.getSymbol(gapList);
</java>

Only the AttomicSymbol objects realy live in an alphabet - the legality 
or otherwise of all other symbols can be determined by decomposing them 
into a set of AttomicSymbol instances and checking if all of these are 
legal. There is no need to add gap, n or any other 'fancy' Symbol 
instances to an alphabet, they just exist.

You should be able to iterate over a sparse alphabet instance - if you 
can't, I will fix this (it would be a bug).

I will go through the docs in AlphabetManager before release and point 
out which of the factory methods there are primarily for developers to 
implement alphabets, and which ones normal people will want to use 
(perhaps this is screaming out for 2 classes - but all that code scares me).

Matthew

> 	Well one thing that is annoying is that when I do a
> AlphabetManger.getCrossProductAlphabet(list Degenerate DNA alphabet) I get
> back an immutable Alphabet, so I cant add gap^3, unless I want to add
> gapXDNAXDNA, gapXgapXDNA etc. To make matters worse it is a sparse alphabet
> (~4000 symbols), which is an alphabet, not a finite alphabet, so I can't get
> all the symbols to create a new alphabet that includes the gap^3. 
> 	ok, so I probably just have to create a new alphabet on my own, I
> just didn't want to.
> -Robin
> _______________________________________________
> Biojava-l mailing list  -  Biojava-l@biojava.org
> http://biojava.org/mailman/listinfo/biojava-l