[Biojava-l] orderNSymbols and Alphabets

Thomas Down td2@sanger.ac.uk
Tue, 27 Feb 2001 10:37:06 +0000


On Tue, Feb 27, 2001 at 05:04:59PM +1300, Schreiber, Mark wrote:
> Hi
> 
> What is the simplest way to create an orderN alphabet or symbol that can be
> used in a dsitribution?

Cross product alphabets are created via the AlphabetManager:

  Alphabet codons = AlphabetManager.getCrossProductAlphabet(
                            Collections.nCopies(3, DNATools.getDNA());

This method will work on any arbitrary List of Alphabets.

You can then retrieve symbols from that alphabet:

  List symbols = DNATools.createDNA("atg").toList();
  Symbol startCodon = codons.getSymbol(symbols);

This method works on an arbitrary list of Symbols (but obviously
these must match the alphabet -- you'll get an IllegalSymbolException
otherwise.

Hope this helps,

   Thomas.