org.biojava.bio.symbol
Class TranslatedSymbolList

java.lang.Object
  |
  +--org.biojava.bio.symbol.AbstractSymbolList
        |
        +--org.biojava.bio.symbol.TranslatedSymbolList

public class TranslatedSymbolList
extends AbstractSymbolList
implements SymbolList

Provides a 'translated' view of an underlying SymbolList.

This class allows you to translate from one alphabet into another, so for example, you could translate from DNA-triplets into amino-acids. You could also translate from DNA-dinucleotide into the 'twist' structural metric, or any other translation that takes your fancy.

The actual mapping from source to view Symbol is encapsulated in a TranslationTable object.

The TranslatedSymbolList will be the same length as the source, and each Symbol in the view will correspond to a single Symbol in the source.

Author:
Matthew Pocock

Inner classes inherited from class org.biojava.bio.symbol.SymbolList
SymbolList.EmptySymbolList
 
Fields inherited from interface org.biojava.bio.symbol.SymbolList
EMPTY_LIST
 
Constructor Summary
TranslatedSymbolList(SymbolList source, TranslationTable transTable)
           
 
Method Summary
 Alphabet getAlphabet()
          The alphabet that this SymbolList is over.
 SymbolList getSource()
          Returns the symbol list associated with this translated symbol list.
 TranslationTable getTranslationTable()
          Obtain the translation table associated with this symbol list
 int length()
          The number of symbols in this SymbolList.
 Symbol symbolAt(int indx)
          Return the symbol at index, counting from 1.
 
Methods inherited from class org.biojava.bio.symbol.AbstractSymbolList
iterator, seqString, subList, subStr, toList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TranslatedSymbolList

public TranslatedSymbolList(SymbolList source,
                            TranslationTable transTable)
                     throws IllegalAlphabetException
Method Detail

getTranslationTable

public TranslationTable getTranslationTable()
Obtain the translation table associated with this symbol list

getSource

public SymbolList getSource()
Returns the symbol list associated with this translated symbol list.

length

public int length()
Description copied from interface: SymbolList
The number of symbols in this SymbolList.
Specified by:
length in interface SymbolList
Overrides:
length in class AbstractSymbolList
Tags copied from interface: SymbolList
Returns:
the length

symbolAt

public Symbol symbolAt(int indx)
Description copied from interface: SymbolList
Return the symbol at index, counting from 1.
Specified by:
symbolAt in interface SymbolList
Overrides:
symbolAt in class AbstractSymbolList
Tags copied from interface: SymbolList
Parameters:
index - the ofset into this SymbolList
Returns:
the Symbol at that index
Throws:
java.lang.IndexOutOfBoundsException - if index is less than 1, or greater than the length of the symbol list

getAlphabet

public Alphabet getAlphabet()
Description copied from interface: SymbolList
The alphabet that this SymbolList is over.

Every symbol within this SymbolList is a member of this alphabet. alphabet.contains(symbol) == true for each symbol that is within this sequence.

Specified by:
getAlphabet in interface SymbolList
Overrides:
getAlphabet in class AbstractSymbolList
Tags copied from interface: SymbolList
Returns:
the alphabet