|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.scoringFunctions.AbstractNormalizableScoringFunction
de.jstacs.scoringFunctions.mix.AbstractMixtureScoringFunction
de.jstacs.scoringFunctions.mix.StrandScoringFunction
public class StrandScoringFunction
This class enables the user to search on both strand. So the motif can be found on the forward or on the reverse complementary strand.
ComplementableDiscreteAlphabet
,
AlphabetContainer.isReverseComplementable()
Nested Class Summary | |
---|---|
static class |
StrandScoringFunction.InitMethod
This enum defines the different types of plug-in initialization of a StrandScoringFunction . |
Field Summary |
---|
Fields inherited from class de.jstacs.scoringFunctions.mix.AbstractMixtureScoringFunction |
---|
componentScore, dList, freeParams, function, hiddenParameter, hiddenPotential, iList, logGammaSum, logHiddenNorm, logHiddenPotential, norm, optimizeHidden, paramRef, partNorm |
Fields inherited from class de.jstacs.scoringFunctions.AbstractNormalizableScoringFunction |
---|
alphabets, length, r |
Fields inherited from interface de.jstacs.scoringFunctions.ScoringFunction |
---|
UNKNOWN |
Constructor Summary | |
---|---|
StrandScoringFunction(NormalizableScoringFunction function,
double forwardPartOfESS,
int starts,
boolean plugIn,
StrandScoringFunction.InitMethod initMethod)
This constructor creates a StrandScoringFunction that optimizes the usage of each strand. |
|
StrandScoringFunction(NormalizableScoringFunction function,
int starts,
boolean plugIn,
StrandScoringFunction.InitMethod initMethod,
double forward)
This constructor creates a StrandScoringFunction that has a fixed frequency for the strand usage. |
|
StrandScoringFunction(StringBuffer xml)
This is the constructor for Storable . |
Method Summary | |
---|---|
protected void |
extractFurtherInformation(StringBuffer xml)
This method is the opposite of AbstractMixtureScoringFunction.getFurtherInformation() . |
protected void |
fillComponentScores(Sequence seq,
int start)
Fills the internal array AbstractMixtureScoringFunction.componentScore with the logarithmic
scores of the components given a Sequence . |
double |
getEss()
Returns the equivalent sample size (ess) of this model, i.e. the equivalent sample size for the class or component that is represented by this model. |
double |
getForwardProbability()
This methoth returns the a-priori probability for the forward strand. |
protected StringBuffer |
getFurtherInformation()
This method is used to append further information of the instance to the XML representation. |
double |
getHyperparameterForHiddenParameter(int index)
This method returns the hyperparameter for the hidden parameter with index index . |
String |
getInstanceName()
Returns a short instance name. |
protected double |
getLogNormalizationConstantForComponent(int i)
Computes the logarithm of the normalization constant for the component i . |
double |
getLogPartialNormalizationConstant(int parameterIndex)
Returns the logarithm of the partial normalization constant for the parameter with index parameterIndex . |
double |
getLogScoreAndPartialDerivation(Sequence seq,
int start,
IntList indices,
DoubleList partialDer)
Returns the logarithmic score for a Sequence beginning at
position start in the Sequence and fills lists with
the indices and the partial derivations. |
static double[][][] |
getReverseComplementDistributions(ComplementableDiscreteAlphabet abc,
double[][][] condDistr)
This method computes the reverse complement distributions for given conditional distributions. |
StrandedLocatedSequenceAnnotationWithLength.Strand |
getStrand(Sequence seq,
int startPos)
This method returns the preferred StrandedLocatedSequenceAnnotationWithLength.Strand for a given subsequence. |
protected void |
init(boolean freeParams)
This method creates the underlying structure for the parameters. |
protected void |
initializeUsingPlugIn(int index,
boolean freeParams,
Sample[] data,
double[][] weights)
This method initializes the functions using the data in some way. |
static boolean |
isStrandScoringFunction(NormalizableScoringFunction nsf)
Check whether a NormalizableScoringFunction is a StrandScoringFunction . |
boolean |
modify(int offsetLeft,
int offsetRight)
Manually modifies the model. |
protected void |
setForwardProb(double forward)
This method can be used to set the forward strand probability. |
String |
toString()
|
Methods inherited from class de.jstacs.scoringFunctions.AbstractNormalizableScoringFunction |
---|
getAlphabetContainer, getInitialClassParam, getLength, getLogScore, getLogScoreAndPartialDerivation, getNumberOfStarts, isNormalized |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public StrandScoringFunction(NormalizableScoringFunction function, double forwardPartOfESS, int starts, boolean plugIn, StrandScoringFunction.InitMethod initMethod) throws CloneNotSupportedException, WrongAlphabetException
function
- the ScoringFunctionforwardPartOfESS
- the part of the full ESS that should be used as hyperparameter for the forward strandstarts
- the number of starts the should be done in an optimizationplugIn
- whether the initial parameters for an optimization should be related to the data or randomly drawninitMethod
- only used if plugIn==true
CloneNotSupportedException
- if function
could not be cloned
WrongAlphabetException
- if the alphabet of function
is not AlphabetContainer.isReverseComplementable()
and, hence, cannot be used for a strand mixtureStrandScoringFunction.InitMethod
public StrandScoringFunction(NormalizableScoringFunction function, int starts, boolean plugIn, StrandScoringFunction.InitMethod initMethod, double forward) throws CloneNotSupportedException, WrongAlphabetException
function
- the ScoringFunctionstarts
- the number of starts the should be done in an optimizationplugIn
- whether the initial parameters for an optimization should be related to the data or randomly drawninitMethod
- only used if plugIn==true
forward
- the probability of a motif to be on the forward strand
CloneNotSupportedException
- if function
could not be cloned
WrongAlphabetException
- if the alphabet of function
is not AlphabetContainer.isReverseComplementable()
and, hence, cannot be used for a strand mixtureStrandScoringFunction.InitMethod
public StrandScoringFunction(StringBuffer xml) throws NonParsableException
Storable
.
xml
- the xml representation
NonParsableException
- if the representation could not be parsed.Method Detail |
---|
protected void setForwardProb(double forward)
forward
- the forward strand probability in (0,1)protected double getLogNormalizationConstantForComponent(int i)
AbstractMixtureScoringFunction
i
.
getLogNormalizationConstantForComponent
in class AbstractMixtureScoringFunction
i
- the index of the component
public double getLogPartialNormalizationConstant(int parameterIndex) throws Exception
NormalizableScoringFunction
parameterIndex
. This is the logarithm of the partial derivation of the
normalization constant for the parameter with index
parameterIndex
,
getLogPartialNormalizationConstant
in interface NormalizableScoringFunction
parameterIndex
- the index of the parameter
Exception
- if something went wrong with the normalizationNormalizableScoringFunction.getLogNormalizationConstant()
public double getHyperparameterForHiddenParameter(int index)
AbstractMixtureScoringFunction
index
.
getHyperparameterForHiddenParameter
in class AbstractMixtureScoringFunction
index
- the index of the hidden parameter
public double getForwardProbability()
public double getEss()
NormalizableScoringFunction
getEss
in interface NormalizableScoringFunction
protected void initializeUsingPlugIn(int index, boolean freeParams, Sample[] data, double[][] weights) throws Exception
AbstractMixtureScoringFunction
initializeUsingPlugIn
in class AbstractMixtureScoringFunction
index
- the class indexfreeParams
- if true, the (reduced) parameterization is used
data
- the data
weights
- the weights for the data
Throws:
Exception
- if the initialization could not be done
See Also:
ScoringFunction.initializeFunction(int,
boolean, Sample[], double[][])
getInstanceName
public String getInstanceName()
- Description copied from interface:
ScoringFunction
- Returns a short instance name.
- Specified by:
getInstanceName
in interface ScoringFunction
- Returns:
- a short instance name
fillComponentScores
protected void fillComponentScores(Sequence seq,
int start)
- Description copied from class:
AbstractMixtureScoringFunction
- Fills the internal array
AbstractMixtureScoringFunction.componentScore
with the logarithmic
scores of the components given a Sequence
.
- Specified by:
fillComponentScores
in class AbstractMixtureScoringFunction
- Parameters:
seq
- the sequencestart
- the start position in seq
getLogScoreAndPartialDerivation
public double getLogScoreAndPartialDerivation(Sequence seq,
int start,
IntList indices,
DoubleList partialDer)
- Description copied from interface:
ScoringFunction
- Returns the logarithmic score for a
Sequence
beginning at
position start
in the Sequence
and fills lists with
the indices and the partial derivations.
- Specified by:
getLogScoreAndPartialDerivation
in interface ScoringFunction
- Parameters:
seq
- the Sequence
start
- the start position in the Sequence
indices
- an IntList
of indices, after method invocation the
list should contain the indices i where
is not zeropartialDer
- a DoubleList
of partial derivations, after method
invocation the list should contain the corresponding
that are not zero
- Returns:
- the logarithmic score for the
Sequence
getFurtherInformation
protected StringBuffer getFurtherInformation()
- Description copied from class:
AbstractMixtureScoringFunction
- This method is used to append further information of the instance to the
XML representation. This method is designed to allow subclasses to add
information to the XML representation.
- Overrides:
getFurtherInformation
in class AbstractMixtureScoringFunction
- Returns:
- the further information as XML code in a
StringBuffer
- See Also:
AbstractMixtureScoringFunction.extractFurtherInformation(StringBuffer)
extractFurtherInformation
protected void extractFurtherInformation(StringBuffer xml)
throws NonParsableException
- Description copied from class:
AbstractMixtureScoringFunction
- This method is the opposite of
AbstractMixtureScoringFunction.getFurtherInformation()
. It
extracts further information of the instance from a XML representation.
- Overrides:
extractFurtherInformation
in class AbstractMixtureScoringFunction
- Parameters:
xml
- the StringBuffer
containing the information to be
extracted as XML code
- Throws:
NonParsableException
- if the StringBuffer
could not be parsed- See Also:
AbstractMixtureScoringFunction.getFurtherInformation()
init
protected void init(boolean freeParams)
- Description copied from class:
AbstractMixtureScoringFunction
- This method creates the underlying structure for the parameters.
- Overrides:
init
in class AbstractMixtureScoringFunction
- Parameters:
freeParams
- indicates whether to use only free parameters or all
parameters
toString
public String toString()
- Overrides:
toString
in class Object
modify
public boolean modify(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:
offsetLeft
- the offset on the left sideoffsetRight
- the offset on the right side
- Returns:
true
if the motif model was modified otherwise
false
getReverseComplementDistributions
public static double[][][] getReverseComplementDistributions(ComplementableDiscreteAlphabet abc,
double[][][] condDistr)
- This method computes the reverse complement distributions for given conditional distributions.
This method is used to determine the context of a motif.
- Parameters:
abc
- the alphabetcondDistr
- the conditional distribution
- Returns:
- the complement of the conditional distribution that can be used for computing a combing conditional distribution
getStrand
public StrandedLocatedSequenceAnnotationWithLength.Strand getStrand(Sequence seq,
int startPos)
- This method returns the preferred
StrandedLocatedSequenceAnnotationWithLength.Strand
for a given subsequence.
- Parameters:
seq
- the sequencestartPos
- the start position
- Returns:
- the
StrandedLocatedSequenceAnnotationWithLength.Strand
of this subsequence - See Also:
AbstractMixtureScoringFunction.getIndexOfMaximalComponentFor(Sequence, int)
isStrandScoringFunction
public static boolean isStrandScoringFunction(NormalizableScoringFunction nsf)
- Check whether a
NormalizableScoringFunction
is a StrandScoringFunction
.
- Parameters:
nsf
- the original NormalizableScoringFunction
- Returns:
true
if the NormalizableScoringFunction
is a StrandScoringFunction
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD