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 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

      • 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
      • 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
      • 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