|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.biojava.bio.symbol.AbstractReversibleTranslationTable
org.biojava.bio.symbol.SimpleReversibleTranslationTable
public class SimpleReversibleTranslationTable
A no-frills implementation of TranslationTable that uses a Map to map from symbols in a finite source alphabet into a target alphabet.
Field Summary |
---|
Fields inherited from interface org.biojava.bio.symbol.TranslationTable |
---|
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 Summary | |
---|---|
SimpleReversibleTranslationTable(FiniteAlphabet source,
FiniteAlphabet target)
Construct a new translation table. |
Method Summary | |
---|---|
protected Symbol |
doTranslate(Symbol sym)
this method is expected to translate any symbol in the source alphabet. |
protected Symbol |
doUntranslate(Symbol sym)
this method is expected to reverse-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. |
Methods inherited from class org.biojava.bio.symbol.AbstractReversibleTranslationTable |
---|
untranslate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.biojava.bio.symbol.TranslationTable |
---|
translate |
Constructor Detail |
---|
public SimpleReversibleTranslationTable(FiniteAlphabet source, FiniteAlphabet target) throws IllegalAlphabetException
source
- the source FiniteAlphabettarget
- the target FiniteAlphabet
IllegalAlphabetException
- if the alphabets are of different sizesMethod Detail |
---|
public Alphabet getSourceAlphabet()
TranslationTable
getSourceAlphabet
in interface TranslationTable
getSourceAlphabet
in class AbstractReversibleTranslationTable
public Alphabet getTargetAlphabet()
TranslationTable
getTargetAlphabet
in interface TranslationTable
getTargetAlphabet
in class AbstractReversibleTranslationTable
protected 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.
protected Symbol doUntranslate(Symbol sym)
AbstractReversibleTranslationTable
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.
doUntranslate
in class AbstractReversibleTranslationTable
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
alphabet
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |