public final class MutableMotifDiscovererToolbox extends MotifDiscovererToolBox
MutableMotifDiscoverer
.Modifier and Type | Class and Description |
---|---|
static class |
MutableMotifDiscovererToolbox.InitMethodForDiffSM
This enum defines some constants for the method
getSortedInitialParameters(DifferentiableSequenceScore[], InitMethodForDiffSM[], DiffSSBasedOptimizableFunction, int, OutputStream, int) . |
Constructor and Description |
---|
MutableMotifDiscovererToolbox() |
Modifier and Type | Method and Description |
---|---|
static void |
clearHistoryArray(History[][] history)
This method clears all elements of an History-array, so that it can be used again.
|
static History[][] |
createHistoryArray(DifferentiableSequenceScore[] funs,
History template)
This method creates a History-array that can be used in an optimization.
|
static int[][] |
createMinimalNewLengthArray(DifferentiableSequenceScore[] funs)
This method creates a minimalNewLength-array that can be used in an optimization.
|
static boolean |
doHeuristicSteps(DifferentiableSequenceScore[] funs,
DataSet[] data,
double[][] weights,
DiffSSBasedOptimizableFunction opt,
DifferentiableFunction neg,
byte algorithm,
double linEps,
StartDistanceForecaster startDistance,
SafeOutputStream out,
boolean breakOnChanged,
History[][] hist,
int[][] minimalNewLength,
boolean maxPos)
This method tries to make some heuristic step if at least one
DifferentiableSequenceScore is a MutableMotifDiscoverer . |
static Sequence[] |
enumerate(DifferentiableSequenceScore[] funs,
int[] classIndex,
int[] motifIndex,
RecyclableSequenceEnumerator[] rse,
double weight,
DiffSSBasedOptimizableFunction opt,
OutputStream out)
This method allows to enumerate all possible seeds for a number of motifs in the
MutableMotifDiscoverer s of a specific classes. |
static Sequence |
enumerate(DifferentiableSequenceScore[] funs,
int classIndex,
int motifIndex,
RecyclableSequenceEnumerator rse,
double weight,
DiffSSBasedOptimizableFunction opt,
OutputStream out)
This method allows to enumerate all possible seeds for a motif in the
MutableMotifDiscoverer of a specific class. |
static boolean |
findModification(int clazz,
int motif,
MutableMotifDiscoverer mmd,
DifferentiableSequenceScore[] score,
DataSet[] data,
double[][] weights,
DiffSSBasedOptimizableFunction opt,
DifferentiableFunction neg,
byte algo,
double linEps,
StartDistanceForecaster startDistance,
SafeOutputStream out,
History hist,
int minimalNewLength,
boolean maxPos)
This method tries to find a modification, i.e.
|
static ComparableElement<double[],Double>[] |
getSortedInitialParameters(DifferentiableSequenceScore[] funs,
MutableMotifDiscovererToolbox.InitMethodForDiffSM[] init,
DiffSSBasedOptimizableFunction opt,
int n,
OutputStream stream,
int optimizationSteps)
This method allows to initialize the
DifferentiableSequenceScore using different MutableMotifDiscovererToolbox.InitMethodForDiffSM . |
static void |
initMotif(int idx,
int[] classIndex,
int[] motifIndex,
DataSet[] s,
double[][] seqWeights,
boolean[] adjust,
MutableMotifDiscoverer[] mmd,
int[] len,
DataSet[] data,
double[][] dataWeights)
This method allows to initialize a number of motifs.
|
static double[][] |
optimize(DifferentiableSequenceScore[] funs,
DiffSSBasedOptimizableFunction opt,
byte algorithm,
AbstractTerminationCondition condition,
double linEps,
StartDistanceForecaster startDistance,
SafeOutputStream out,
boolean breakOnChanged,
History[][] hist,
int[][] minimalNewLength,
OptimizableFunction.KindOfParameter plugIn,
boolean maxPos)
This method tries to optimize the problem at hand as good as possible.
|
static double[][] |
optimize(DifferentiableSequenceScore[] funs,
DiffSSBasedOptimizableFunction opt,
byte algorithm,
AbstractTerminationCondition condition,
double linEps,
StartDistanceForecaster startDistance,
SafeOutputStream out,
boolean breakOnChanged,
History template,
OptimizableFunction.KindOfParameter plugIn,
boolean maxPos)
This method tries to optimize the problem at hand as good as possible.
|
plot, plotAndAnnotate
public static Sequence enumerate(DifferentiableSequenceScore[] funs, int classIndex, int motifIndex, RecyclableSequenceEnumerator rse, double weight, DiffSSBasedOptimizableFunction opt, OutputStream out) throws Exception
MutableMotifDiscoverer
of a specific class.funs
- the DifferentiableSequenceScore
sclassIndex
- the index of the classmotifIndex
- the index of the motif in the MutableMotifDiscoverer
rse
- an RecyclableSequenceEnumerator
that contains Sequence
objects tested for initialization of the motif motifIndex
weight
- the weight of the seed Sequence
opt
- the objective functionout
- a stream that allows to write some output if necessarySequence
with respect to the DiffSSBasedOptimizableFunction
Exception
- if something went wrongenumerate(DifferentiableSequenceScore[], int[], int[], RecyclableSequenceEnumerator[], double, DiffSSBasedOptimizableFunction, OutputStream)
public static Sequence[] enumerate(DifferentiableSequenceScore[] funs, int[] classIndex, int[] motifIndex, RecyclableSequenceEnumerator[] rse, double weight, DiffSSBasedOptimizableFunction opt, OutputStream out) throws Exception
MutableMotifDiscoverer
s of a specific classes.funs
- the DifferentiableSequenceScore
sclassIndex
- the indices of the classesmotifIndex
- the indices of the motif in the MutableMotifDiscoverer
srse
- an array of RecyclableSequenceEnumerator
that contains Sequence
objects tested for initialization of the corresponding motifweight
- the weight of the seed Sequence
opt
- the objective functionout
- a stream that allows to write some output if necessarySequence
s with respect to the DiffSSBasedOptimizableFunction
Exception
- if something went wrongpublic static void initMotif(int idx, int[] classIndex, int[] motifIndex, DataSet[] s, double[][] seqWeights, boolean[] adjust, MutableMotifDiscoverer[] mmd, int[] len, DataSet[] data, double[][] dataWeights) throws Exception
idx
- the index indicates how many motifs are initializedclassIndex
- the indices of the classes of each motifmotifIndex
- the indices of each motif within the MutableMotifDiscoverer
s
- the DataSet
s to be used for the initializationseqWeights
- the weights corresponding to the DataSet
sadjust
- an array of switches indicating whether to adjust hidden parameters of notmmd
- the array of MutableMotifDiscoverer
s to be initializedlen
- the length of each motifdata
- the complete data setsdataWeights
- the weights corresponding to the complete data setsException
- if something went wrongpublic static ComparableElement<double[],Double>[] getSortedInitialParameters(DifferentiableSequenceScore[] funs, MutableMotifDiscovererToolbox.InitMethodForDiffSM[] init, DiffSSBasedOptimizableFunction opt, int n, OutputStream stream, int optimizationSteps) throws Exception
DifferentiableSequenceScore
using different MutableMotifDiscovererToolbox.InitMethodForDiffSM
. It returns an array of ComparableElement
s that contain the parameters and thefuns
- the DifferentiableSequenceScore
sinit
- the specific MutableMotifDiscovererToolbox.InitMethodForDiffSM
, the entries correspond one to one to those of fun
opt
- the objective functionn
- the number of initializationsstream
- a stream that allows to write some output if necessaryoptimizationSteps
- the number of initial steps that should be performed before evaluating the functionComparableElement
s of parameter arrays and corresponding values of the DiffSSBasedOptimizableFunction
Exception
- if something went wrongpublic static int[][] createMinimalNewLengthArray(DifferentiableSequenceScore[] funs)
funs
- the DiffSMs used in an optimizationpublic static History[][] createHistoryArray(DifferentiableSequenceScore[] funs, History template) throws CloneNotSupportedException
funs
- the DiffSMs used in an optimizationtemplate
- the template history instanceCloneNotSupportedException
- if the ttemplate
could not be clonedpublic static void clearHistoryArray(History[][] history)
history
- the arraypublic static double[][] optimize(DifferentiableSequenceScore[] funs, DiffSSBasedOptimizableFunction opt, byte algorithm, AbstractTerminationCondition condition, double linEps, StartDistanceForecaster startDistance, SafeOutputStream out, boolean breakOnChanged, History template, OptimizableFunction.KindOfParameter plugIn, boolean maxPos) throws Exception
MutableMotifDiscoverer
s it tries to perform modify operations as long as they seem to be promising.funs
- the DifferentiableSequenceScore
s for scoring sequencesopt
- the DiffSSBasedOptimizableFunction
algorithm
- used for the optimizationcondition
- used for the optimizationlinEps
- used for the optimizationstartDistance
- used for the optimizationout
- an stream that allows to obtain some information while optimizationbreakOnChanged
- a switch that decides whether a new optimization should be started after one successful modify or after all motifs have been tried to modify.template
- a history instance used to build an array with this instanceplugIn
- a switch whether to take the internal parameters or notmaxPos
- a switch whether to take the maximal shift position or not in the heuristicException
- if something went wrong while optimizationclearHistoryArray(de.jstacs.motifDiscovery.history.History[][])
,
optimize(DifferentiableSequenceScore[], DiffSSBasedOptimizableFunction, byte, AbstractTerminationCondition, double, StartDistanceForecaster, SafeOutputStream, boolean, History[][], int[][], de.jstacs.classifiers.differentiableSequenceScoreBased.OptimizableFunction.KindOfParameter, boolean)
public static double[][] optimize(DifferentiableSequenceScore[] funs, DiffSSBasedOptimizableFunction opt, byte algorithm, AbstractTerminationCondition condition, double linEps, StartDistanceForecaster startDistance, SafeOutputStream out, boolean breakOnChanged, History[][] hist, int[][] minimalNewLength, OptimizableFunction.KindOfParameter plugIn, boolean maxPos) throws Exception
MutableMotifDiscoverer
s it tries to perform modify operations as long as they seem to be promising.funs
- the DifferentiableSequenceScore
s for scoring sequencesopt
- the DiffSSBasedOptimizableFunction
algorithm
- used for the optimizationcondition
- used for the optimizationlinEps
- used for the optimizationstartDistance
- used for the optimizationout
- an stream that allows to obtain some information while optimizationbreakOnChanged
- a switch that decides whether a new optimization should be started after one successful modify or after all motifs have been tried to modify.hist
- an array that is used to check whether a modify-operation can be performedminimalNewLength
- the minimal new length for each motif in each class, that will be used in an expand if the motif was shortened beforeplugIn
- a switch whether to take the internal parameters or notmaxPos
- a switch whether to take the maximal shift position or not in the heuristicException
- if something went wrong while optimizationpublic static boolean doHeuristicSteps(DifferentiableSequenceScore[] funs, DataSet[] data, double[][] weights, DiffSSBasedOptimizableFunction opt, DifferentiableFunction neg, byte algorithm, double linEps, StartDistanceForecaster startDistance, SafeOutputStream out, boolean breakOnChanged, History[][] hist, int[][] minimalNewLength, boolean maxPos) throws Exception
DifferentiableSequenceScore
is a MutableMotifDiscoverer
.
These heuristic steps include shift, shrink, and expand as far as the user allows those operations by the History
array.funs
- the DifferentiableSequenceScore
s for scoring sequencesdata
- array of DataSet
containing the data for each classweights
- the weights corresponding to the Sequence
s in data
opt
- the DiffSSBasedOptimizableFunction
neg
- the NegativeDifferentiableFunction
used in the optimizationalgorithm
- used for the optimizationlinEps
- used for the optimizationstartDistance
- used for the optimizationout
- an stream that allows to obtain some information while optimizationbreakOnChanged
- a switch that decides whether a new optimization should be started after one successful modify or after all motifs have been tried to modify.hist
- an array that is used to check whether a modify-operation can be performedminimalNewLength
- the minimal new length for each motif in each class, that will be used in an expand if the motif was shortened beforemaxPos
- a switch whether to take the maximal shift position or not in the heuristictrue
if some heuristic steps has been performed otherwise false
Exception
- if something went wrongpublic static boolean findModification(int clazz, int motif, MutableMotifDiscoverer mmd, DifferentiableSequenceScore[] score, DataSet[] data, double[][] weights, DiffSSBasedOptimizableFunction opt, DifferentiableFunction neg, byte algo, double linEps, StartDistanceForecaster startDistance, SafeOutputStream out, History hist, int minimalNewLength, boolean maxPos) throws Exception
true
a modification was found and could be performed.
clazz
- the class index for which the Scoring function will be tested for modificationmotif
- the motif index for which the Scoring function will be tested for modificationmmd
- the MutableMotifDiscoverer
that will be testedscore
- the DifferentiableSequenceScore
s for scoring sequencesdata
- array of DataSet
containing the data for each classweights
- array of double[]
containing the weights for the data of each classopt
- the DiffSSBasedOptimizableFunction
neg
- the NegativeDifferentiableFunction
used in the optimizationalgo
- used for the optimizationlinEps
- used for the optimizationstartDistance
- used for the optimizationout
- an stream that allows to obtain some informationhist
- an instance to check whether a modify-operation can be performedminimalNewLength
- the minimal new length for each motif in each class, that will be used in an expand if the motif was shortened beforemaxPos
- a switch whether to take the maximal shift position or not in the heuristictrue
if a modification has been performedException
- if something went wrongSignificantMotifOccurrencesFinder.getNumberOfBoundSequences(DataSet, double[], int)