org.biojava.bio.symbol
Interface TranslationTable

All Known Implementing Classes:
SimpleTranslationTable

public interface TranslationTable

Encapsulates the mapping from a source to a destination alphabet.

A TranslationTable is in effect a map or function with the source domain being getSourceAlphabet() and the target domain being getTargetAlphabet(). The method translate() maps a single symbol from source to target. If you wish to translate every symbol in a symbol list then use TranslatedSymbolList to automate the job. If you want to translate windowed regions then first construct a WindowedSymbolList from the original sequence and then build a TranslatedSymbolList from this windowed view.

Author:
Matthew Pocock

Method Summary
 Alphabet getSourceAlphabet()
          The alphabet of Symbols that can be translated.
 Alphabet getTargetAlphabet()
          The alphabet of Symbols that will be produced.
 Symbol translate(Symbol sym)
          Translate a single symbol from source alphabet to the target alphabet.
 

Method Detail

getSourceAlphabet

public Alphabet getSourceAlphabet()
The alphabet of Symbols that can be translated.
Returns:
the source Alphabet

getTargetAlphabet

public Alphabet getTargetAlphabet()
The alphabet of Symbols that will be produced.
Returns:
the target Alphabet

translate

public Symbol translate(Symbol sym)
                 throws IllegalSymbolException
Translate a single symbol from source alphabet to the target alphabet.
Parameters:
sym - the Symbol to translate (member of source alphabet)
Returns:
the translated version of sym (member of target alphabet)
Throws:
IllegalSymbolException - if sym is not a member of the source alphabet