Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.jstacs.scoringFunctions.directedGraphicalModels
Class MutableMarkovModelScoringFunction

    java.lang.Object
      de.jstacs.scoringFunctions.AbstractNormalizableScoringFunction
          de.jstacs.scoringFunctions.directedGraphicalModels.BayesianNetworkScoringFunction
              de.jstacs.scoringFunctions.directedGraphicalModels.MutableMarkovModelScoringFunction

All Implemented Interfaces:
  InstantiableFromParameterSet, Mutable, NormalizableScoringFunction, ScoringFunction, Storable, Cloneable

    public class MutableMarkovModelScoringFunction

extends BayesianNetworkScoringFunction
implements Mutable

This class implements a `NormalizableScoringFunction` for an inhomogeneous Markov model. The modeled length can be modified which might be very important for de-novo motif discovery.

Author:
  Jan Grau, Jens Keilwagen

Field Summary

Fields inherited from class de.jstacs.scoringFunctions.directedGraphicalModels.BayesianNetworkScoringFunction
`ess, isTrained, normalizationConstant, numFreePars, nums, order, parameters, plugInParameters, structureMeasure, trees`

Fields inherited from class de.jstacs.scoringFunctions.AbstractNormalizableScoringFunction
`alphabets, length, r`

Fields inherited from interface de.jstacs.scoringFunctions.ScoringFunction
`UNKNOWN`

Constructor Summary
`MutableMarkovModelScoringFunction(AlphabetContainer alphabet, int length, double ess, boolean plugInParameters, InhomogeneousMarkov structureMeasure)` This constructor creates an instance without any prior for the modeled length.
`MutableMarkovModelScoringFunction(AlphabetContainer alphabet, int length, double ess, boolean plugInParameters, InhomogeneousMarkov structureMeasure, DurationScoringFunction lengthPenalty)` This constructor creates an instance with an prior for the modeled length.
`MutableMarkovModelScoringFunction(StringBuffer xml)` The standard constructor for the interface `Storable`.

Method Summary
`int[]` | `determineNotSignificantPositions(double samples, double[] weightsLeft, double[] weightsRight, double[][][][] contrastLeft, double[][][][] contrastRight, double sign)` This method determines the number of not significant positions from each side of the motif using the the significance level `sign` and the contrast distributions of the left or right side, `contrastLeft` and `contrastRight`, respectively.
`protected void` | `fromXML(StringBuffer source)` This method is called in the constructor for the `Storable` interface to create a scoring function from a `StringBuffer`.
`double` | `getLogPriorTerm()` This method computes a value that is proportional to `NormalizableScoringFunction.getEss()` `* Math.log( `NormalizableScoringFunction.getNormalizationConstant()` ) + Math.log( prior ).`
`boolean` | `modify(double[] weightsLeft, double[] weightsRight, double[][][][] fillEmptyWithLeft, double[][][][] fillEmptyWithRight, int offsetLeft, int offsetRight)` Manually modifies the model.
`StringBuffer` | `toXML()` This method returns an XML representation as `StringBuffer` of an instance of the implementing class.

Methods inherited from class de.jstacs.scoringFunctions.directedGraphicalModels.BayesianNetworkScoringFunction
`addGradientOfLogPriorTerm, clone, createTrees, getCurrentParameterSet, getCurrentParameterValues, getEss, getInstanceName, getLogScore, getLogScoreAndPartialDerivation, getNormalizationConstant, getNumberOfParameters, getPartialNormalizationConstant, getPositionForParameter, getPWM, getSizeOfEventSpaceForRandomVariablesOfParameter, initializeFunction, initializeFunctionRandomly, isInitialized, precomputeNormalization, setParameters, setPlugInParameters, toString`

Methods inherited from class de.jstacs.scoringFunctions.AbstractNormalizableScoringFunction
`getAlphabetContainer, getInitialClassParam, getLength, getLogScore, getLogScoreAndPartialDerivation, getNumberOfRecommendedStarts, isNormalized, isNormalized`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### MutableMarkovModelScoringFunction

    public MutableMarkovModelScoringFunction(AlphabetContainer alphabet,
                                             int length,
                                             double ess,
                                             boolean plugInParameters,
                                             InhomogeneousMarkov structureMeasure)
                                      throws Exception

  This constructor creates an instance without any prior for the modeled length.

  Parameters:
    `alphabet` - the `AlphabetContainer` of the `MutableMarkovModelScoringFunction`
    `length` - the initial length of the modeled sequences
    `ess` - the equivalent sample size
    `plugInParameters` - a switch whether to use plug-in parameters of not
    `structureMeasure` - a `Measure` for the structure
  Throws:
    `Exception` - if super class constructor throws an `Exception`

### MutableMarkovModelScoringFunction

    public MutableMarkovModelScoringFunction(AlphabetContainer alphabet,
                                             int length,
                                             double ess,
                                             boolean plugInParameters,
                                             InhomogeneousMarkov structureMeasure,
                                             DurationScoringFunction lengthPenalty)
                                      throws Exception

  This constructor creates an instance with an prior for the modeled length.

  Parameters:
    `alphabet` - the `AlphabetContainer` of the `MutableMarkovModelScoringFunction`
    `length` - the initial length of the modeled sequences
    `ess` - the equivalent sample size
    `plugInParameters` - a switch whether to use plug-in parameters of not
    `structureMeasure` - a `Measure` for the structure
    `lengthPenalty` - the prior on the modeled sequence length
  Throws:
    `Exception` - if super class constructor throws an `Exception` or if the `lengthPenalty` does not allow the initial length

### MutableMarkovModelScoringFunction

    public MutableMarkovModelScoringFunction(StringBuffer xml)
                                      throws NonParsableException

  The standard constructor for the interface `Storable`. Recreates a `MutableMarkovModelScoringFunction` from its XML representation as saved by the method `toXML()`.

  Parameters:
    `xml` - the XML representation as `StringBuffer`
  Throws:
    `NonParsableException` - if the XML code could not be parsed

Method Detail

### fromXML

    protected void fromXML(StringBuffer source)
                    throws NonParsableException

  Description copied from class: `AbstractNormalizableScoringFunction`
  This method is called in the constructor for the `Storable` interface to create a scoring function from a `StringBuffer`.

  Overrides:
    `fromXML` in class `BayesianNetworkScoringFunction`
  Parameters:
    `source` - the XML representation as `StringBuffer`
  Throws:
    `NonParsableException` - if the `StringBuffer` could not be parsed
  See Also:
    `AbstractNormalizableScoringFunction.AbstractNormalizableScoringFunction(StringBuffer)`

### toXML

    public StringBuffer toXML()

  Description copied from interface: `Storable`
  This method returns an XML representation as `StringBuffer` of an instance of the implementing class.

  Specified by:
    `toXML` in interface `Storable`
  Overrides:
    `toXML` in class `BayesianNetworkScoringFunction`
  Returns:
    the XML representation

### getLogPriorTerm

    public double getLogPriorTerm()

  Description copied from interface: `NormalizableScoringFunction`
  This method computes a value that is proportional to

  `NormalizableScoringFunction.getEss()` `* Math.log( `NormalizableScoringFunction.getNormalizationConstant()` ) + Math.log( prior ).`

  where `prior` is the prior for the parameters of this model.

  Specified by:
    `getLogPriorTerm` in interface `NormalizableScoringFunction`
  Overrides:
    `getLogPriorTerm` in class `BayesianNetworkScoringFunction`
  Returns:
    a value that is proportional to `NormalizableScoringFunction.getEss()` `* Math.log( `NormalizableScoringFunction.getNormalizationConstant()` ) + Math.log( prior ).`
  See Also:
    `NormalizableScoringFunction.getEss()`, `NormalizableScoringFunction.getNormalizationConstant()`

### modify

    public boolean modify(double[] weightsLeft,
                          double[] weightsRight,
                          double[][][][] fillEmptyWithLeft,
                          double[][][][] fillEmptyWithRight,
                          int offsetLeft,
                          int offsetRight)

  Description copied from interface: `Mutable`
  Manually modifies the model. The two offsets `offsetLeft` and `offsetRight` define how many positions the left or right border positions shall be moved. Negative numbers indicate moves to the left while positive numbers correspond to moves to the right.

  Specified by:
    `modify` in interface `Mutable`
  Parameters:
    `weightsLeft` - the weights for the left replacement distributions
    `weightsRight` - the weights for the left replacement distributions
    `fillEmptyWithLeft` - the replacement distribution for the left side
    `fillEmptyWithRight` - the replacement distribution for the right side
    `offsetLeft` - the offset on the left side
    `offsetRight` - the offset on the right side
  Returns:
    `true` if the motif model was modified otherwise `false`

### determineNotSignificantPositions

    public int[] determineNotSignificantPositions(double samples,
                                                  double[] weightsLeft,
                                                  double[] weightsRight,
                                                  double[][][][] contrastLeft,
                                                  double[][][][] contrastRight,
                                                  double sign)

  Description copied from interface: `Mutable`
  This method determines the number of not significant positions from each side of the motif using the the significance level `sign` and the contrast distributions of the left or right side, `contrastLeft` and `contrastRight`, respectively. The contrast array have four dimensions.
  1. The first is used for the possibility of having different contrast (caused by different flanking models).
  2. The second is used for the order of the contrast.
  3. The third is used for the (encoded) context.
  4. The fourth is used for the the realization of the random variable
  For example, if we have only one flanking model which is a homogeneous Markov model of order 0 for a `DNAAlphabet`, the contrast array has the dimension `new double[1][1][1][4]`. For the same example but with order 1, the contrast array has the dimension `new double[1][1][4][4]`. Left and right contrast can have different dimensions.

  Specified by:
    `determineNotSignificantPositions` in interface `Mutable`
  Parameters:
    `samples` - the summed weights of `Sequence` containing this motif
    `weightsLeft` - the weights for the left contrast distributions
    `weightsRight` - the weights for the right contrast distributions
    `contrastLeft` - the left contrast distributions
    `contrastRight` - the right contrast distributions
    `sign` - the significance level
  Returns:
    a two dimensional array containing at position 0 the number of not significant positions from the left side using `contrastLeft` and at position 1 the number of not significant positions from the right side using `contrastRight`
  See Also:
    `Mutable.modify(double[], double[], double[][][][], double[][][][], int, int)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD