Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.biojava.bio.dp
Interface MarkovModel

All Superinterfaces:
  Changeable

All Known Implementing Classes:
  FullHmmerProfileHMM, HmmerProfileHMM, ProfileHMM, SimpleMarkovModel, WMAsMM

    public interface MarkovModel

extends Changeable

A markov model.

All probablities are in log space.

This interface models a subset of hidden markov models with an explicit start and end state. In principle, these can be combined together, so that a state within one model may be an entire model in its own right, wired via container->start and end->container. For the sample methods to work, the log scores must be probabilities (sum to 1).

Field Summary
`static ChangeType` | `ARCHITECTURE` Signals that the architecture of the model is changing.
`static ChangeType` | `PARAMETER` Signals that one or more parameters have altered.

Method Summary
`void` | `addState(State newState)` Adds a state to the model.
`int[]` | `advance()` The maximum advance for this model.
`boolean` | `containsTransition(State from, State to)` Returns wether a transition exists or not.
`void` | `createTransition(State from, State to)` Makes a transition between two states legal.
`void` | `destroyTransition(State from, State to)` Breaks a transition between two states legal.
`Alphabet` | `emissionAlphabet()` Alphabet that is emitted by the emission states.
`Distribution` | `getWeights(State source)` Get a probability Distribution over the transition from 'source'.
`int` | `heads()` Deprecated. use `advance().length`
`MagicalState` | `magicalState()` The MagicalState for this model.
`void` | `removeState(State toGo)` Remove a state from the model.
`void` | `setWeights(State source, Distribution dist)` Set the probability distribution over the transitions from 'source'.
`FiniteAlphabet` | `stateAlphabet()` FiniteAlphabet of the states.
`FiniteAlphabet` | `transitionsFrom(State source)` Returns the FiniteAlphabet of all states that have a transition from 'source'.
`FiniteAlphabet` | `transitionsTo(State dest)` Returns the FiniteAlphabet of all states that have a transition to 'dest'.

Methods inherited from interface org.biojava.utils.Changeable
`addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener`

Field Detail

### ARCHITECTURE

    static final ChangeType ARCHITECTURE

  Signals that the architecture of the model is changing.

  For a transition creation, the changed field should be a two element array containing the source and destination states of the new transition, and the previous field should be null. Likewise for the removal of a transition, the previos should hold the array, and changed should be null.

### PARAMETER

    static final ChangeType PARAMETER

  Signals that one or more parameters have altered.

  If it is clear which parameter has changed, then this should be in the current and/or previous field. Otherwise, these should be null.

Method Detail

### emissionAlphabet

    Alphabet emissionAlphabet()

  Alphabet that is emitted by the emission states.

### stateAlphabet

    FiniteAlphabet stateAlphabet()

  FiniteAlphabet of the states.

  We are modeling a finite-state-machine, so there will be a finite set of states.

  The MagicalState returned by getMagicalState is always contained within this as the start/end state.

  Returns:
    the alphabet over states

### magicalState

    MagicalState magicalState()

  The MagicalState for this model.

### heads

    int heads()

  Deprecated. use `advance().length`

  The number of heads on this model.

  Each head consumes a single SymbolList. A single-head model just consumes/ emits a single sequence. A two-head model performs alignment between two sequences (e.g. smith-waterman). Models with more heads do more interesting things.

  `heads()` should equal `advance().length`.

  Returns:
    the number of heads in this model.

### advance

    int[] advance()

  The maximum advance for this model.

  Each head consumes a single SymbolList. However, the states that advance through that SymbolList may emit more than one symbol at a time. This array give the maximum advance in each direction.

  Be sure to return a new array each time this is called. This protects the internal state of the object from someone modifying the advance array. Be sure to update this as/when states modify their advance arrays and as/when states are added or removed

  Returns:
    the maximum advance of all states for all heads

### getWeights

    Distribution getWeights(State source)
                            throws IllegalSymbolException

  Get a probability Distribution over the transition from 'source'.

  Parameters:
    `source` - the State currently occupied
  Returns:
    the probability Distribution over the reachable states
  Throws:
    `IllegalSymbolException` - if from is not a legal state

### setWeights

    void setWeights(State source,
                    Distribution dist)
                    throws IllegalSymbolException,
                           IllegalAlphabetException,
                           ChangeVetoException

  Set the probability distribution over the transitions from 'source'.

  This should throw an IllegalAlphabetException if the source alphabet in 'dist' is not the same alphabet as returned by transitionsFrom(source).

  Parameters:
    `source` - the source State
    `dist` - the new distribution over transitions from 'source'
  Throws:
    `IllegalSymbolException` - if source is not a state in this model
    `IllegalAlphabetException` - if the distribution has the wrong source alphabet
    `ChangeVetoException` - if for any reason the distribution can't be replaced at this time

### transitionsFrom

    FiniteAlphabet transitionsFrom(State source)
                                   throws IllegalSymbolException

  Returns the FiniteAlphabet of all states that have a transition from 'source'.

  Parameters:
    `source` - the source State
  Returns:
    a FiniteAlphabet of State objects that can reach from 'source'
  Throws:
    `IllegalSymbolException`

### transitionsTo

    FiniteAlphabet transitionsTo(State dest)
                                 throws IllegalSymbolException

  Returns the FiniteAlphabet of all states that have a transition to 'dest'.

  Parameters:
    `dest` - the destination state
  Returns:
    a FiniteAlphabet of State objects that can reach 'dest'
  Throws:
    `IllegalSymbolException`

### containsTransition

    boolean containsTransition(State from,
                               State to)
                               throws IllegalSymbolException

  Returns wether a transition exists or not.

  Parameters:
    `from` - the transitin source
    `to` - the transition destination
  Returns:
    true/false depending on wether this model has the transition
  Throws:
    `IllegalSymbolException` - if either from or to are not states in this model

### createTransition

    void createTransition(State from,
                          State to)
                          throws IllegalSymbolException,
                                 ChangeVetoException

  Makes a transition between two states legal.

  This should inform each TransitionListener that a transition is to be created using preCreateTransition, and if none of the listeners fire a ChangeVetoException, it should create the transition, and then inform each TransitionListener with postCreateTransition.

  Parameters:
    `from` - the State currently occupied
    `to` - the State to move to
  Throws:
    `IllegalSymbolException` - if either from or to are not legal states
    `ChangeVetoException` - if creating the transition is vetoed

### destroyTransition

    void destroyTransition(State from,
                           State to)
                           throws IllegalSymbolException,
                                  ChangeVetoException

  Breaks a transition between two states legal.

  This should inform each TransitionListener that a transition is to be broken using preDestroyTransition, and if none of the listeners fire a ChangeVetoException, it should break the transition, and then inform each TransitionListener with postDestroyTransition.

  Parameters:
    `from` - the State currently occupied
    `to` - the State to move to
  Throws:
    `IllegalSymbolException` - if either from or to are not legal states
    `ChangeVetoException` - if breaking the transition is vetoed

### addState

    void addState(State newState)
                  throws IllegalSymbolException,
                         ChangeVetoException

  Adds a state to the model.

  Parameters:
    `newState` - the state to add
  Throws:
    `IllegalSymbolException` - if the state is not valid or is a MagicalState
    `ChangeVetoException` - if either the model does not allow states to be added, or the change was vetoed

### removeState

    void removeState(State toGo)
                     throws IllegalTransitionException,
                            IllegalSymbolException,
                            ChangeVetoException

  Remove a state from the model.

  States should not be removed untill they are involved in no transitions. This is to avoid producing corrupted models by accident.

  Parameters:
    `toGo` - the state to remove
  Throws:
    `IllegalSymbolException` - if the symbol is not part of this model or a MagicalState
    `IllegalTransitionException` - if the state is currently involved in any transitions
    `ChangeVetoException` - if either the model does not allow states to be removed, or the change was vetoed

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD