de.jstacs.sequenceScores.statisticalModels.trainable.mixture.motif.positionprior
Class PositionPrior

java.lang.Object
  extended by de.jstacs.sequenceScores.statisticalModels.trainable.mixture.motif.positionprior.PositionPrior
All Implemented Interfaces:
Storable, Cloneable
Direct Known Subclasses:
GaussianLikePositionPrior, UniformPositionPrior

public abstract class PositionPrior
extends Object
implements Storable, Cloneable

This is the main class for any position prior that can be used in a motif discovery.

Author:
Jens Keilwagen

Field Summary
protected  int motifLength
          The length of the motif.
 
Constructor Summary
protected PositionPrior()
          This empty constructor creates an instance with motif length -1.
protected PositionPrior(StringBuffer rep)
          The standard constructor for the interface Storable.
 
Method Summary
 PositionPrior clone()
           
protected abstract  void extractAdditionalInformation(StringBuffer xml)
          This method extracts additional information from a StringBuffer.
protected abstract  StringBuffer getAdditionalInformation()
          This method returns a StringBuffer containing additional information for the XML representation.
abstract  String getInstanceName()
          Returns the instance name.
abstract  int getLength()
          Returns the length that is supported by this prior.
abstract  double getLogPriorForPositions(int seqLength, int... starts)
          The logarithmic value of the prior for specified start positions of the part motifs.
 void setMotifLength(int motifLength)
          Sets the length of the current motif.
 StringBuffer toXML()
          This method returns an XML representation as StringBuffer of an instance of the implementing class.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

motifLength

protected int motifLength
The length of the motif.

Constructor Detail

PositionPrior

protected PositionPrior()
This empty constructor creates an instance with motif length -1.


PositionPrior

protected PositionPrior(StringBuffer rep)
                 throws NonParsableException
The standard constructor for the interface Storable. Creates a new PositionPrior out of a StringBuffer.

Parameters:
rep - the StringBuffer containing the model
Throws:
NonParsableException - if the StringBuffer can not be parsed
Method Detail

clone

public PositionPrior clone()
                    throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException

getLogPriorForPositions

public abstract double getLogPriorForPositions(int seqLength,
                                               int... starts)
                                        throws IllegalArgumentException
The logarithmic value of the prior for specified start positions of the part motifs.

Parameters:
seqLength - the length of the sequence
starts - the start positions of the part motifs
Returns:
the value of the prior for given start positions
Throws:
IllegalArgumentException - if something went wrong, e.g. the motif length is not set.

getLength

public abstract int getLength()
Returns the length that is supported by this prior. If all lengths greater than the minimal length are supported, this method returns 0.

Returns:
the length that is supported or 0 for all lengths

getInstanceName

public abstract String getInstanceName()
Returns the instance name.

Returns:
the instance name

setMotifLength

public void setMotifLength(int motifLength)
                    throws IllegalArgumentException
Sets the length of the current motif.

Parameters:
motifLength - the motif length
Throws:
IllegalArgumentException - if the length is not positive or to big

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
Returns:
the XML representation

getAdditionalInformation

protected abstract StringBuffer getAdditionalInformation()
This method returns a StringBuffer containing additional information for the XML representation.

Returns:
a StringBuffer containing additional information for the XML representation

extractAdditionalInformation

protected abstract void extractAdditionalInformation(StringBuffer xml)
                                              throws NonParsableException
This method extracts additional information from a StringBuffer.

Parameters:
xml - the StringBuffer containing the additional information of the XML representation
Throws:
NonParsableException - if the StringBuffer is not parsable