Class SimpleEmissionState

java.lang.Object
org.biojava.utils.AbstractChangeable
org.biojava.bio.dp.SimpleEmissionState
All Implemented Interfaces:
Serializable, Annotatable, EmissionState, State, Trainable, AtomicSymbol, BasisSymbol, Symbol, Changeable
Direct Known Subclasses:
MagicalState, ProfileEmissionState

Author:
Matthew Pocock, Thomas Down, Mark Schreiber
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • getAnnotation

      public final Annotation getAnnotation()
      Description copied from interface: Annotatable
      Should return the associated annotation object.
      Specified by:
      getAnnotation in interface Annotatable
      Returns:
      an Annotation object, never null
    • setAnnotation

      public final void setAnnotation(Annotation ann) throws ChangeVetoException
      Throws:
      ChangeVetoException
    • getDistribution

      public final Distribution getDistribution()
      Description copied from interface: EmissionState

      Get the Distribution associated with this state.

      If the state is to be added to an HMM, then the state's emission spectrum must be compatible with the HMM - that is, their emission alphabets must match.

      Specified by:
      getDistribution in interface EmissionState
      Returns:
      the current Distribution object used by this state
    • setDistribution

      public final void setDistribution(Distribution dis) throws ChangeVetoException
      Description copied from interface: EmissionState
      Set the Distribution associated with this state.
      Specified by:
      setDistribution in interface EmissionState
      Parameters:
      dis - the new Distribution to use
      Throws:
      ChangeVetoException - if the implementation doesn't support setting the distribution, or if the change is vetoed
    • getAdvance

      public int[] getAdvance()
      Description copied from interface: EmissionState
      Determine the number of symbols this state advances along one or more symbol lists. In the simple case, this method should almost always return {1} if it is a true `emmision' state, or {0} if it is a dot state which only emits a gap character. For pairwise HMMs, it will normally return {1, 1} for match state, and {0, 1} or {1, 0} for a gap state. Under some circumstances it may be valid to return values other than 1 or 0, but you should consider the consequences for HMM architecture very carefully, and contact the authors. Developers may wish to return a copy of some underlying array from this method as code outside could modify the array you give
      Specified by:
      getAdvance in interface EmissionState
    • setAdvance

      public void setAdvance(int[] advance) throws ChangeVetoException
      Description copied from interface: EmissionState
      Set the advance array.
      Specified by:
      setAdvance in interface EmissionState
      Parameters:
      advance - an array of ints, specifying how many symbols are consumed from each sequence
      Throws:
      ChangeVetoException - if the implementation doesn't support setting advance, or if the change is vetoed
    • getToken

      public char getToken()
    • getName

      public final String getName()
      Description copied from interface: Symbol
      The long name for the symbol.
      Specified by:
      getName in interface Symbol
      Returns:
      the long name
    • setName

      public final void setName(String name)
    • getMatches

      public Alphabet getMatches()
      Description copied from interface: Symbol
      The alphabet containing the symbols matched by this ambiguity symbol.

      This alphabet contains all of, and only, the symbols matched by this symbol. For example, the symbol representing the DNA ambiguity code for W would contain the symbol for A and T from the DNA alphabet.

      Specified by:
      getMatches in interface Symbol
      Returns:
      the Alphabet of symbols matched by this symbol
    • getBases

      public Set getBases()
    • getSymbols

      public List getSymbols()
      Description copied from interface: BasisSymbol

      The list of symbols that this symbol is composed from.

      In the usual case, this list will contain just this single symbol. In the case where a symbol represents an ordered combination of other symbols, the list will contain each of these BasisSymbols.

      Specified by:
      getSymbols in interface BasisSymbol
      Returns:
      the List of Symbols that this Symbol is built from
    • registerWithTrainer

      public void registerWithTrainer(ModelTrainer trainer)
      Description copied from interface: Trainable
      Perform any registration that is necessary with mt.

      This may include registering handlers for transition or emission counts, or registering other Trainable objects with the ModelTrainer.

      Specified by:
      registerWithTrainer in interface Trainable
      Parameters:
      trainer - the ModelTrainer that encapsulates the training environment
    • getChangeSupport

      Description copied from class: AbstractChangeable
      Called to retrieve the ChangeSupport for this object.

      Your implementation of this method should have the following structure:

       ChangeSupport cs = super.getChangeSupport(ct);
      
       if(someForwarder == null invalid input: '&'invalid input: '&' ct.isMatching(SomeInterface.SomeChangeType)) {
         someForwarder = new ChangeForwarder(...
      
         this.stateVariable.addChangeListener(someForwarder, VariableInterface.AChange);
       }
      
       return cs;
       
      It is usual for the forwarding listeners (someForwarder in this example) to be transient and lazily instantiated. Be sure to register invalid input: '&' unregister the forwarder in the code that does the ChangeEvent handling in setter methods.
      Overrides:
      getChangeSupport in class AbstractChangeable