org.biojava.bio.dp.twohead
Class EmissionCache

java.lang.Object
  extended by org.biojava.bio.dp.twohead.EmissionCache
All Implemented Interfaces:
Serializable

public class EmissionCache
extends Object
implements Serializable

Cache for columns of emission probabilities in pair-wise alignment algorithms.

Author:
Matthew Pocock, David Huen (fixes for magical state)
See Also:
Serialized Form

Constructor Summary
EmissionCache(Alphabet alpha, State[] states, int dsi, ScoreType scoreType)
           
 
Method Summary
 void clear()
           
 double[] getEmissions(List symList)
           
 double[] getEmissions(List symList, boolean exorcise)
          Retrieve the emission scores from the cache for every EmissionState for the specified symbols.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmissionCache

public EmissionCache(Alphabet alpha,
                     State[] states,
                     int dsi,
                     ScoreType scoreType)
Method Detail

getEmissions

public final double[] getEmissions(List symList)
                            throws IllegalSymbolException
Throws:
IllegalSymbolException

getEmissions

public final double[] getEmissions(List symList,
                                   boolean exorcise)
                            throws IllegalSymbolException
Retrieve the emission scores from the cache for every EmissionState for the specified symbols. The scores will be computed and cached if not already available.

The correct behaviour should be to exclude emission from the MagicalState except at the origin and bottom-right of the DP matrix. As such, the emission vector is only cached when it it is computed for exorcise set to true. The vector is computed afresh every time when exorcise is false. it should be noted that if exorcise is NOT set to false with the emission vector at the ends of the matrix, the model will fail as the start and and end transitions become impossible.

Parameters:
symList - a list of the symbols in each head that require a lookup for emission probabilities.
exorcise - Prevents emission from the MagicalState.
Throws:
IllegalSymbolException

clear

public void clear()