jbil.sequence
Class AbstractFixedLengthSequenceModel

java.lang.Object
  extended by jbil.sequence.AbstractFixedLengthSequenceModel
All Implemented Interfaces:
FixedLengthSequenceModel, SequenceModel
Direct Known Subclasses:
MarkovFixedLengthSequenceModel, UniformFixedLengthSequenceModel

public abstract class AbstractFixedLengthSequenceModel
extends java.lang.Object
implements FixedLengthSequenceModel

Abstract stub implementation of the FixedLengthSequenceModel interface.

Author:
Paulo G. S. da Fonseca

Constructor Summary
AbstractFixedLengthSequenceModel()
           
 
Method Summary
 double likelihood(Sequence word)
          Returns the likelihod of the given word under this model.
 double likelihood(Sequence word, int beginIndex, int endIndex)
          Returns the likelihod of the subword of the given word starting at beginIndex and ending at endIndex-1.
 double likelihoodThreshold(double significance)
          Computes the likelihood threshold for the given significance with a default null model.
 double prefixLikelihood(Sequence sequence)
          returns the likelihod of the given prefix under this model, that is, the sum of the probabilities of all words starting with the given prefix.
 double pvalue(Sequence word)
          Returns the p-value of the given word with a default null model (usually the uniform null model).
 double pvalue(Sequence word, int beginIndex)
          Returns the p-value of the subword of the given word starting at beginIndex and of the appropriate length with a default null model (typically the uniform model).
 double pvalue(Sequence word, int beginIndex, int endIndex)
          Returns the p-value of the subword of the given word starting at beginIndex and ending at endIndex-1 with a default null model (typically the uniform model).
 double pvalue(Sequence word, int beginIndex, int endIndex, SequenceModel nullModel)
          Returns the p-value of the subword of the given word starting at beginIndex and ending at endIndex-1.
 double pvalue(Sequence word, SequenceModel nullModel)
          The p-value of a given sequence is defined as the probability under a null model for a sequence to have a likelihood greater or equal to the likelihood of the given sequence under this model.
 Sequence sample(int length)
          Samples a sequence from this model.
 Sequence[] sampleN(int sampleSize)
          Samples a set of i.i.d.
 Sequence[] sampleN(int sampleSize, int length)
          Samples a set of i.i.d.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jbil.sequence.FixedLengthSequenceModel
length, likelihood, pvalue, sample
 
Methods inherited from interface jbil.sequence.SequenceModel
getAlphabet, likelihoodThreshold, positionProbability, prefixLikelihood
 

Constructor Detail

AbstractFixedLengthSequenceModel

public AbstractFixedLengthSequenceModel()
Method Detail

likelihood

public double likelihood(Sequence word)
Description copied from interface: SequenceModel
Returns the likelihod of the given word under this model.

Specified by:
likelihood in interface SequenceModel

likelihood

public double likelihood(Sequence word,
                         int beginIndex,
                         int endIndex)
Description copied from interface: SequenceModel
Returns the likelihod of the subword of the given word starting at beginIndex and ending at endIndex-1.

Specified by:
likelihood in interface SequenceModel

prefixLikelihood

public double prefixLikelihood(Sequence sequence)
Description copied from interface: SequenceModel
returns the likelihod of the given prefix under this model, that is, the sum of the probabilities of all words starting with the given prefix.

Specified by:
prefixLikelihood in interface SequenceModel

pvalue

public double pvalue(Sequence word)
Description copied from interface: SequenceModel
Returns the p-value of the given word with a default null model (usually the uniform null model).

Specified by:
pvalue in interface SequenceModel

pvalue

public double pvalue(Sequence word,
                     int beginIndex)
Description copied from interface: FixedLengthSequenceModel
Returns the p-value of the subword of the given word starting at beginIndex and of the appropriate length with a default null model (typically the uniform model).

Specified by:
pvalue in interface FixedLengthSequenceModel
See Also:
SequenceModel.pvalue(Sequence, SequenceModel)

pvalue

public double pvalue(Sequence word,
                     int beginIndex,
                     int endIndex)
Description copied from interface: SequenceModel
Returns the p-value of the subword of the given word starting at beginIndex and ending at endIndex-1 with a default null model (typically the uniform model).

Specified by:
pvalue in interface SequenceModel
See Also:
SequenceModel.pvalue(Sequence, SequenceModel)

pvalue

public double pvalue(Sequence word,
                     SequenceModel nullModel)
Description copied from interface: SequenceModel
The p-value of a given sequence is defined as the probability under a null model for a sequence to have a likelihood greater or equal to the likelihood of the given sequence under this model.

Suppose we have an observed sequence X and we want to perform the statistical test of whether 'X was sampled from the null model' (null hypothesis) against the alternative hypothesis 'X was sampled from this model'. Then the p-value of X is used reject the null hypothesis if it falls below a significance threshold established of the test.

Specified by:
pvalue in interface SequenceModel
Parameters:
word - The word whose p-value is to be calculated.
nullModel - The null model.
Returns:
The p-value of the given word defined as above with the given null model.

pvalue

public double pvalue(Sequence word,
                     int beginIndex,
                     int endIndex,
                     SequenceModel nullModel)
Description copied from interface: SequenceModel
Returns the p-value of the subword of the given word starting at beginIndex and ending at endIndex-1.

Specified by:
pvalue in interface SequenceModel
See Also:
SequenceModel.pvalue(Sequence, SequenceModel)

likelihoodThreshold

public double likelihoodThreshold(double significance)
Description copied from interface: SequenceModel
Computes the likelihood threshold for the given significance with a default null model.

Specified by:
likelihoodThreshold in interface SequenceModel
See Also:
SequenceModel.likelihoodThreshold(double, SequenceModel)

sample

public Sequence sample(int length)
Description copied from interface: SequenceModel
Samples a sequence from this model.

Specified by:
sample in interface SequenceModel
Parameters:
length - The length of the sequence to be sampled.

sampleN

public Sequence[] sampleN(int sampleSize,
                          int length)
Description copied from interface: SequenceModel
Samples a set of i.i.d. sequences from this model.

Specified by:
sampleN in interface SequenceModel
Parameters:
sampleSize - The number of sampled sequences.
length - The length of the sampled sequences.

sampleN

public Sequence[] sampleN(int sampleSize)
Description copied from interface: FixedLengthSequenceModel
Samples a set of i.i.d. sequences with the apropriate length from this model.

Specified by:
sampleN in interface FixedLengthSequenceModel
Parameters:
sampleSize - The number of sampled sequences.