jbil.sequence
Class AlphabetRegistry

java.lang.Object
  extended by jbil.sequence.AlphabetRegistry

public class AlphabetRegistry
extends java.lang.Object

Central (singleton) registry of alphabets. Alphabets should be created once and reused "system-wide" to save resources and also to allow for consistent sequence comparisons. This class centralises references to available alphabets.

Author:
Paulo G. S. da Fonseca

Method Summary
 Alphabet getAlphabet(java.lang.String alphabetName)
          Gets the alphabet associated to a given name.
 DNAAlphabet getDNAAlphabet()
           
 ExtendedDNAAlphabet getExtendedDNAAlphabet()
           
static AlphabetRegistry getInstance()
           
 Alphabet registerAlphabet(java.lang.String name, Alphabet alphabet)
          Registers an alphabet, associating it to unique name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static AlphabetRegistry getInstance()
Returns:
The singleton instance of the alphabet registry.

getAlphabet

public Alphabet getAlphabet(java.lang.String alphabetName)
Gets the alphabet associated to a given name.

Parameters:
alphabetName - The name of the alphabet.

registerAlphabet

public Alphabet registerAlphabet(java.lang.String name,
                                 Alphabet alphabet)
Registers an alphabet, associating it to unique name.

Parameters:
name - The name of the alphabet.
alphabet - The alphabet to be registered.
Returns:
The newly registered alphabet.

getDNAAlphabet

public DNAAlphabet getDNAAlphabet()
Returns:
The DNA {a,c,g,t} alphabet.

getExtendedDNAAlphabet

public ExtendedDNAAlphabet getExtendedDNAAlphabet()
Returns:
The extended DNA alphabet {a,g,c,t,r,y,k,m,s,w,b,d,h,v,n}