public class SimpleTranslationTable extends Object implements Serializable
ALT_YEAST_NUC, ASCID_MITO, BACTERIAL, BLEPH_MNUC, CHLORO_MITO, CILIATE_NUC, ECHIN_MITO, EUPL_NUC, FWORM_MITO, INVERT_MITO, MOLD_MITO, SCENE_MITO, TREMA_MITO, UNIVERSAL, VERT_MITO, YEAST_MITO
Constructor and Description |
---|
SimpleTranslationTable(FiniteAlphabet source,
Alphabet target)
Create a new translation table that will translate symbols from source to
target.
|
SimpleTranslationTable(FiniteAlphabet source,
Alphabet target,
Map transMap)
Create a new translation table that will translate symbols from source to
target.
|
Modifier and Type | Method and Description |
---|---|
Symbol |
doTranslate(Symbol sym)
this method is expected to translate any symbol
in the source alphabet.
|
Alphabet |
getSourceAlphabet()
The alphabet of Symbols that can be translated.
|
Alphabet |
getTargetAlphabet()
The alphabet of Symbols that will be produced.
|
void |
setTranslation(AtomicSymbol from,
AtomicSymbol to)
Alter the translation mapping.
|
Symbol |
translate(Symbol sym)
Translate a single symbol from source alphabet to the target alphabet.
|
public SimpleTranslationTable(FiniteAlphabet source, Alphabet target)
The source alphabet must be finite, as a Map object is used to associate a source Symbol with a target Symbol. The target alphabet need not be finite.
source
- the FiniteAlphabet to translate fromtarget
- the Alphabet to translate intopublic SimpleTranslationTable(FiniteAlphabet source, Alphabet target, Map transMap)
The Map transMap should contain keys in the source alphabet with values in the target alphabet. However, this is not currently checked.
The source alphabet must be finite, as a Map object is used to associate a source Symbol with a target Symbol. The target alphabet need not be finite.
source
- the FiniteAlphabet to translate fromtarget
- the Alphabet to translate intopublic Alphabet getSourceAlphabet()
TranslationTable
getSourceAlphabet
in interface TranslationTable
public Alphabet getTargetAlphabet()
TranslationTable
getTargetAlphabet
in interface TranslationTable
public Symbol doTranslate(Symbol sym)
As an optimisation, if your method is capable of immediately translating an ambiguity Symbol, just return it and the alternate route of establishing the translation through doing an ambiguity lookup will be avoided.
public void setTranslation(AtomicSymbol from, AtomicSymbol to) throws IllegalSymbolException
from
- source AtomicSymbolto
- target AtomicSymbol to be returned by translate(from)IllegalSymbolException
- if either from is not in the source
alphabet or to is not in the target alphabetpublic Symbol translate(Symbol sym) throws IllegalSymbolException
TranslationTable
translate
in interface TranslationTable
sym
- the Symbol to translate (member of source alphabet)IllegalSymbolException
- if sym is not a member of the source
alphabetCopyright © 2014 BioJava. All rights reserved.