calhoun.analysis.crf.io
Class OutputHandlerGeneCallStats

java.lang.Object
  extended by calhoun.analysis.crf.io.OutputHandlerGeneCallStats
All Implemented Interfaces:
OutputHandler, java.io.Serializable
Direct Known Subclasses:
OutputHandlerGeneCallStatsInterval29

public class OutputHandlerGeneCallStats
extends java.lang.Object
implements OutputHandler

A legacy output handler that computes basic stats, gene calling statsm and then writes out a GTF file.

See Also:
Serialized Form

Nested Class Summary
static class OutputHandlerGeneCallStats.Results
           
 
Constructor Summary
OutputHandlerGeneCallStats()
          default constructor.
OutputHandlerGeneCallStats(ModelManager manager, InputHandler inputHandler)
          creates an output handler using this model and input handler
 
Method Summary
 void calcResultIncrement(TrainingSequence training, int[] predictedHiddenSequence)
          calculates statstics and output for results on a given test sequence
 float getAccuracy()
          returns the exact nucleotide accuracy of the result
 InputHandler getInputHandler()
          retursn the input handler used to write out the input sequences
 TrainingSequence getLabeled(int i)
           
 ModelManager getManager()
          gets the model used to generate results
 double[] getViterbiScores()
           
 boolean isWriteTrainingData()
           
 void loglikelihoodIncrement(double logLikelihoodActual, double logLikelihoodViterbi)
           
 void outputComplete()
          indicates the writing of output is complete.
 void setInputHandler(InputHandler inputHandler)
          sets the inputHandler used to write out the input sequences
 void setManager(ModelManager manager)
          sets the model used to generate results
 void setOutputLocation(java.lang.String location)
          sets the output location to write to.
 void setWriteTrainingData(boolean writeTrainingData)
           
 java.lang.String toString()
           
 void writeGTF(java.util.List<? extends TrainingSequence<?>> refStates, java.lang.String filename)
           
 void writeOutput(InputSequence<?> sequence, int[] hiddenStates)
          Writes out a set of predicted hidden states.
 void writeTestOutput(InputSequence<?> sequence, int[] truePath, int[] hiddenStates)
          Writes out a set of hidden states compared with a known true path.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OutputHandlerGeneCallStats

public OutputHandlerGeneCallStats()
default constructor. ModelManager and InputHandler must be configured separately.


OutputHandlerGeneCallStats

public OutputHandlerGeneCallStats(ModelManager manager,
                                  InputHandler inputHandler)
creates an output handler using this model and input handler

Parameters:
manager - the model used for gene calling. Used for calculating stats.
inputHandler - input handler which will be used for writing out the input sequence with the results.
Method Detail

setOutputLocation

public void setOutputLocation(java.lang.String location)
Description copied from interface: OutputHandler
sets the output location to write to. This is called before any of the write functions are called.

Specified by:
setOutputLocation in interface OutputHandler
Parameters:
location - the location to write the data to. The meaning is implementation dependent.

writeOutput

public void writeOutput(InputSequence<?> sequence,
                        int[] hiddenStates)
                 throws java.io.IOException
Description copied from interface: OutputHandler
Writes out a set of predicted hidden states. The location will have been specified previously with OutputHandler.setOutputLocation(java.lang.String)

Specified by:
writeOutput in interface OutputHandler
Parameters:
sequence - the input sequence on which predictions were made
hiddenStates - an array of state indices for the predicted hidden states.
Throws:
java.io.IOException

writeTestOutput

public void writeTestOutput(InputSequence<?> sequence,
                            int[] truePath,
                            int[] hiddenStates)
                     throws java.io.IOException
Description copied from interface: OutputHandler
Writes out a set of hidden states compared with a known true path. The location will have been specified previously with OutputHandler.setOutputLocation(java.lang.String)

Specified by:
writeTestOutput in interface OutputHandler
Parameters:
sequence - the input sequence on which predictions were made
truePath - an array of hidden states representing the true path.
hiddenStates - an array of state indices for the predicted hidden states.
Throws:
java.io.IOException

outputComplete

public void outputComplete()
                    throws java.io.IOException
Description copied from interface: OutputHandler
indicates the writing of output is complete. The handler can do any final processing and release resources.

Specified by:
outputComplete in interface OutputHandler
Throws:
java.io.IOException

getInputHandler

public InputHandler getInputHandler()
retursn the input handler used to write out the input sequences

Returns:
the inputHandler which will be used to write out the input sequences

setInputHandler

public void setInputHandler(InputHandler inputHandler)
sets the inputHandler used to write out the input sequences

Parameters:
inputHandler - the inputHandler used to write out the input sequences

getManager

public ModelManager getManager()
gets the model used to generate results

Returns:
the model used to generate results

setManager

public void setManager(ModelManager manager)
sets the model used to generate results

Parameters:
manager - the model used to generate results

getAccuracy

public float getAccuracy()
returns the exact nucleotide accuracy of the result


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

calcResultIncrement

public void calcResultIncrement(TrainingSequence training,
                                int[] predictedHiddenSequence)
calculates statstics and output for results on a given test sequence


loglikelihoodIncrement

public void loglikelihoodIncrement(double logLikelihoodActual,
                                   double logLikelihoodViterbi)

getLabeled

public TrainingSequence getLabeled(int i)

writeGTF

public void writeGTF(java.util.List<? extends TrainingSequence<?>> refStates,
                     java.lang.String filename)
              throws java.io.IOException
Throws:
java.io.IOException

getViterbiScores

public double[] getViterbiScores()

isWriteTrainingData

public boolean isWriteTrainingData()
Returns:
Returns the writeTrainingData.

setWriteTrainingData

public void setWriteTrainingData(boolean writeTrainingData)
Parameters:
writeTrainingData - The writeTrainingData to set.