|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| 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, isNormalized, 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 | |
|---|---|
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 |
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. |
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. |
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. |
protected double |
getNormalizationConstantForComponent(int i)
Computes the normalization constant for the component i. |
double |
getPartialNormalizationConstant(int parameterIndex)
Returns the partial normalization constant for the parameter with index parameterIndex. |
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. |
boolean |
modify(double[] weightsLeft,
double[] weightsRight,
double[][][][] replacementLeft,
double[][][][] replacementRight,
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, 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 hyerparameter 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==trueCloneNotSupportedException
WrongAlphabetExceptionStrandScoringFunction.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==trueforward - the probability of a motif to be on the forward strand
CloneNotSupportedException
WrongAlphabetExceptionStrandScoringFunction.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 getNormalizationConstantForComponent(int i)
AbstractMixtureScoringFunctioni.
getNormalizationConstantForComponent in class AbstractMixtureScoringFunctioni - the index of the component
public double getPartialNormalizationConstant(int parameterIndex)
throws Exception
NormalizableScoringFunctionparameterIndex. This is the partial derivation of the
normalization constant for the parameter with index
parameterIndex, in LaTex notation:
\frac{\partial Z(\lambda)}{\partial \lambda_{index}}.
getPartialNormalizationConstant in interface NormalizableScoringFunctionparameterIndex - the index of the parameter
Exception - if something went wrong with the normalizationNormalizableScoringFunction.getNormalizationConstant()public double getHyperparameterForHiddenParameter(int index)
AbstractMixtureScoringFunctionindex.
getHyperparameterForHiddenParameter in class AbstractMixtureScoringFunctionindex - the index of the hidden parameter
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 AbstractMixtureScoringFunctionindex - the class indexfreeParams - if true, the (reduced) parameterization is useddata - the dataweights - the weights for the data
- Throws:
Exception - if the initialization could not be done- See Also:
ScoringFunction.initializeFunction(int,
boolean, Sample[], double[][])public String getInstanceName()
ScoringFunction
getInstanceName in interface ScoringFunction
protected void fillComponentScores(Sequence seq,
int start)
AbstractMixtureScoringFunctionAbstractMixtureScoringFunction.componentScore with the logarithmic
scores of the components given a Sequence.
fillComponentScores in class AbstractMixtureScoringFunctionseq - the sequencestart - the start position in seq
public double getLogScoreAndPartialDerivation(Sequence seq,
int start,
IntList indices,
DoubleList partialDer)
ScoringFunctionSequence beginning at
position start in the Sequence and fills lists with
the indices and the partial derivations.
getLogScoreAndPartialDerivation in interface ScoringFunctionseq - the Sequencestart - the start position in the Sequenceindices - an IntList of indices, after method invocation the
list should contain the indices i where
\frac{\partial \log
score(seq)}{\partial \lambda_i} is not zeropartialDer - a DoubleList of partial derivations, after method
invocation the list should contain the corresponding
\frac{\partial \log
score(seq)}{\partial \lambda_i}
Sequenceprotected StringBuffer getFurtherInformation()
AbstractMixtureScoringFunction
getFurtherInformation in class AbstractMixtureScoringFunctionStringBufferAbstractMixtureScoringFunction.extractFurtherInformation(StringBuffer)
protected void extractFurtherInformation(StringBuffer xml)
throws NonParsableException
AbstractMixtureScoringFunctionAbstractMixtureScoringFunction.getFurtherInformation(). It
extracts further information of the instance from a XML representation.
extractFurtherInformation in class AbstractMixtureScoringFunctionxml - the StringBuffer containing the information to be
extracted as XML code
NonParsableException - if the StringBuffer could not be parsedAbstractMixtureScoringFunction.getFurtherInformation()protected void init(boolean freeParams)
AbstractMixtureScoringFunction
init in class AbstractMixtureScoringFunctionfreeParams - indicates whether to use only free parameters or all
parameterspublic String toString()
toString in class Object
public boolean modify(double[] weightsLeft,
double[] weightsRight,
double[][][][] replacementLeft,
double[][][][] replacementRight,
int offsetLeft,
int offsetRight)
MutableoffsetLeft
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.
modify in interface MutableweightsLeft - the weights for the left replacement distributionsweightsRight - the weights for the left replacement distributionsreplacementLeft - the replacement distribution for the left sidereplacementRight - the replacement distribution for the right sideoffsetLeft - the offset on the left sideoffsetRight - the offset on the right side
true if the motif model was modified otherwise
false
public int[] determineNotSignificantPositions(double samples,
double[] weightsLeft,
double[] weightsRight,
double[][][][] contrastLeft,
double[][][][] contrastRight,
double sign)
Mutablesign
and the contrast distributions of the left or right side,
contrastLeft and contrastRight,
respectively. The contrast array have four dimensions.
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.
determineNotSignificantPositions in interface Mutablesamples - the summed weights of Sequence containing this motifweightsLeft - the weights for the left contrast distributionsweightsRight - the weights for the right contrast distributionscontrastLeft - the left contrast distributionscontrastRight - the right contrast distributionssign - the significance level
contrastLeft and at position 1 the number of not
significant positions from the right side using
contrastRightMutable.modify(double[], double[], double[][][][], double[][][][], int, int)
public static double[][][] getReverseComplementDistributions(ComplementableDiscreteAlphabet abc,
double[][][] condDistr)
abc - the alphabetcondDistr - the conditional distribution
public StrandedLocatedSequenceAnnotationWithLength.Strand getStrand(Sequence seq,
int startPos)
StrandedLocatedSequenceAnnotationWithLength.Strand for a given subsequence.
seq - the sequencestartPos - the start position
StrandedLocatedSequenceAnnotationWithLength.Strand of this subsequenceAbstractMixtureScoringFunction.getIndexOfMaximalComponentFor(Sequence, int)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||