org.biojava.bio.dp
Class SimpleStatePath

java.lang.Object
  |
  +--org.biojava.bio.dp.SimpleStatePath

public class SimpleStatePath
extends java.lang.Object
implements StatePath, java.io.Serializable

A no-frills implementation of StatePath.

See Also:
Serialized Form

Inner classes inherited from class org.biojava.bio.symbol.SymbolList
SymbolList.EmptySymbolList
 
Fields inherited from interface org.biojava.bio.dp.StatePath
SCORES, SEQUENCE, STATES
 
Fields inherited from interface org.biojava.bio.symbol.SymbolList
EMPTY_LIST
 
Constructor Summary
SimpleStatePath(double score, SymbolList sequence, SymbolList states, SymbolList scores)
           
 
Method Summary
 Alphabet getAlphabet()
          The alphabet that this SymbolList is over.
 java.util.List getLabels()
          The list of SymbolLists in the alignment.
 double getScore()
          Return the overall score for this state-path and it's emissions.
 java.util.Iterator iterator()
          An Iterator over all Symbols in this SymbolList.
 int length()
          The number of symbols in this SymbolList.
 java.lang.String seqString()
          Stringify this symbol list.
 Alignment subAlignment(java.util.Set labels, Location loc)
          Make a view onto this alignment.
 SymbolList subList(int start, int end)
          Return a new SymbolList for the symbols start to end inclusive.
 java.lang.String subStr(int start, int end)
          Return a region of this symbol list as a String.
 Symbol symbolAt(int col)
          Return the symbol at index, counting from 1.
 Symbol symbolAt(java.lang.Object label, int col)
          Retrieve a symbol by label and column.
 SymbolList symbolListForLabel(java.lang.Object label)
          Retrieve a single row of the alignment by label.
 java.util.List toList()
          Returns a List of symbols.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleStatePath

public SimpleStatePath(double score,
                       SymbolList sequence,
                       SymbolList states,
                       SymbolList scores)
                throws java.lang.IllegalArgumentException
Method Detail

getScore

public double getScore()
Description copied from interface: StatePath
Return the overall score for this state-path and it's emissions.
Specified by:
getScore in interface StatePath
Tags copied from interface: StatePath
Returns:
the score

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.

Tags copied from interface: SymbolList
Returns:
the alphabet

getLabels

public java.util.List getLabels()
Description copied from interface: Alignment
The list of SymbolLists in the alignment.

The index in the list is the same as the index in the alignment. Each SymbolList object will only be in the alignment once. However, a single underlying SymbolList may have more than one view within an alignment, each represented by a different GappedSymbolList.

Tags copied from interface: Alignment
Returns:
the List of all SymbolLists in the alignment

length

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

subAlignment

public Alignment subAlignment(java.util.Set labels,
                              Location loc)
                       throws java.util.NoSuchElementException
Description copied from interface: Alignment
Make a view onto this alignment.

If labels is null, then each label will be kept. Otherwise, only those in labels will be kept. If loc is null, then the entire length of the alignment will be kept. If loc is not null, then only the columns within the location will be kept.

Tags copied from interface: Alignment
Parameters:
labels - the Set of sequences to include by label
loc - the Location to include
Returns:
a sub Alignment
Throws:
java.util.NoSuchElementException - if labels contains any item that is not a label

symbolAt

public Symbol symbolAt(int col)
                throws java.lang.IndexOutOfBoundsException
Description copied from interface: SymbolList
Return the symbol at index, counting from 1.
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

symbolAt

public Symbol symbolAt(java.lang.Object label,
                       int col)
                throws java.lang.IndexOutOfBoundsException,
                       java.util.NoSuchElementException
Description copied from interface: Alignment
Retrieve a symbol by label and column.
Tags copied from interface: Alignment
Parameters:
label - the SymbolList to retrieve from
column - the index of the column to retrieve
Returns:
the symbol in the symbol list associated with the label at the given column
Throws:
java.util.NoSuchElementException - if there is no row for 'label'

symbolListForLabel

public SymbolList symbolListForLabel(java.lang.Object label)
                              throws java.util.NoSuchElementException
Description copied from interface: Alignment
Retrieve a single row of the alignment by label.
Tags copied from interface: Alignment
Parameters:
label - the object from which to retrieve the symbol list
Returns:
a SymbolList that contains each token in a row of the alignment
Throws:
java.util.NoSuchElementException - if there is no row for 'label'

iterator

public java.util.Iterator iterator()
Description copied from interface: SymbolList
An Iterator over all Symbols in this SymbolList.

This is an ordered iterator over the Symbols. It cannot be used to edit the underlying symbols.

Tags copied from interface: SymbolList
Returns:
an iterator

subList

public SymbolList subList(int start,
                          int end)
Description copied from interface: SymbolList
Return a new SymbolList for the symbols start to end inclusive.

The resulting SymbolList will count from 1 to (end-start + 1) inclusive, and refer to the symbols start to end of the original sequence.

Tags copied from interface: SymbolList
Parameters:
start - the first symbol of the new SymbolList
end - the last symbol (inclusive) of the new SymbolList

toList

public java.util.List toList()
Description copied from interface: SymbolList
Returns a List of symbols.

This is an immutable list of symbols. Do not edit it.

Tags copied from interface: SymbolList
Returns:
a List of Symbols

seqString

public java.lang.String seqString()
Description copied from interface: SymbolList
Stringify this symbol list.

It is expected that this will use the symbol's token to render each symbol. It should be parsable back into a SymbolList using the default token parser for this alphabet.

Tags copied from interface: SymbolList
Returns:
a string representation of the symbol list

subStr

public java.lang.String subStr(int start,
                               int end)
                        throws java.lang.IndexOutOfBoundsException
Description copied from interface: SymbolList
Return a region of this symbol list as a String.

This should use the same rules as seqString.

Tags copied from interface: SymbolList
Parameters:
start - the first symbol to include
end - the last symbol to include
Returns:
the string representation
Throws:
java.lang.IndexOutOfBoundsException - if either start or end are not within the sequence