de.jstacs.sequenceScores.statisticalModels.trainable.hmm.states
Class SimpleState

java.lang.Object
  extended by de.jstacs.sequenceScores.statisticalModels.trainable.hmm.states.SimpleState
All Implemented Interfaces:
State, TrainableState
Direct Known Subclasses:
SimpleDifferentiableState, SimpleSamplingState

public class SimpleState
extends Object
implements TrainableState

This class implements a State based on Emission that allows to reuse Emissions for different States.

Author:
Jens Keilwagen

Field Summary
protected  Emission e
          The emission that is internally used for scoring subsequences.
protected  boolean forward
          A switch that decides whether to use the forward or the reverse complementary strand of a sequence.
protected  String name
          The name of the state.
 
Constructor Summary
SimpleState(Emission e, String name, boolean forward)
          This is the constructor of a SimpleState.
 
Method Summary
 void addToStatistic(int startPos, int endPos, double weight, Sequence seq)
          This method allows to add a certain weight to the sufficient statistic of the parameters that are used for scoring the specific subsequence(s).
 String getGraphvizNodeOptions(double weight, double maxWeight, NumberFormat nf)
          This method returns a String representation of the node options that can be used in Graphviz to create the node for this state.
 double getLogScoreFor(int startPos, int endPos, Sequence seq)
          This method returns the logarithm of the score for a given sequence with given start and end position.
 boolean isSilent()
          This method returns whether a state is silent or not.
 String toString(NumberFormat nf)
          This method returns a String representation of the instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

e

protected Emission e
The emission that is internally used for scoring subsequences.


name

protected String name
The name of the state.


forward

protected boolean forward
A switch that decides whether to use the forward or the reverse complementary strand of a sequence.

Constructor Detail

SimpleState

public SimpleState(Emission e,
                   String name,
                   boolean forward)
This is the constructor of a SimpleState.

Parameters:
e - the emission that is internally used for scoring subsequences
name - the name of the state
forward - a switch that decides whether to use the forward or the reverse complementary strand of a sequence
Method Detail

getGraphvizNodeOptions

public String getGraphvizNodeOptions(double weight,
                                     double maxWeight,
                                     NumberFormat nf)
Description copied from interface: State
This method returns a String representation of the node options that can be used in Graphviz to create the node for this state.

Specified by:
getGraphvizNodeOptions in interface State
Parameters:
weight - for state
maxWeight - the maximal weight for the state
nf - the NumberFormat for the output, can be null
Returns:
String representation of the state

getLogScoreFor

public double getLogScoreFor(int startPos,
                             int endPos,
                             Sequence seq)
                      throws WrongLengthException,
                             OperationNotSupportedException
Description copied from interface: State
This method returns the logarithm of the score for a given sequence with given start and end position. The method provides the basics for quantifying emission probability/density.

Specified by:
getLogScoreFor in interface State
Parameters:
startPos - the start position within the sequence(s)
endPos - the end position within the sequence(s)
seq - the sequence(s)
Returns:
the logarithm of score for the given sequence(s)
Throws:
WrongLengthException - if the length can not be modeled
OperationNotSupportedException - if the reverse complement of the sequence can not be computed

addToStatistic

public void addToStatistic(int startPos,
                           int endPos,
                           double weight,
                           Sequence seq)
                    throws OperationNotSupportedException
Description copied from interface: TrainableState
This method allows to add a certain weight to the sufficient statistic of the parameters that are used for scoring the specific subsequence(s).

Specified by:
addToStatistic in interface TrainableState
Parameters:
startPos - the start position
endPos - the end position
weight - the weight which will be added to the sufficient statistic
seq - the Sequence(s)
Throws:
OperationNotSupportedException - if the reverse complement of the sequence can not be computed

isSilent

public boolean isSilent()
Description copied from interface: State
This method returns whether a state is silent or not.

Specified by:
isSilent in interface State
Returns:
true if the state is silent, otherwise false
See Also:
SilentEmission

toString

public String toString(NumberFormat nf)
Description copied from interface: State
This method returns a String representation of the instance.

Specified by:
toString in interface State
Parameters:
nf - the NumberFormat for the String representation of parameters or probabilities
Returns:
a String representation of the instance