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
public class SimpleEmissionState extends AbstractChangeable implements EmissionState, Serializable
- Author:
- Matthew Pocock, Thomas Down, Mark Schreiber
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.biojava.bio.Annotatable
Annotatable.AnnotationForwarder
-
-
Field Summary
Fields Modifier and Type Field Description protected ChangeForwarderannotationForwarderprotected ChangeForwarderdistForwarder-
Fields inherited from interface org.biojava.bio.Annotatable
ANNOTATION
-
Fields inherited from interface org.biojava.bio.dp.EmissionState
ADVANCE, DISTRIBUTION
-
-
Constructor Summary
Constructors Constructor Description SimpleEmissionState(String name, Annotation ann, int[] advance, Distribution dis)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int[]getAdvance()Determine the number of symbols this state advances along one or more symbol lists.AnnotationgetAnnotation()Should return the associated annotation object.SetgetBases()protected ChangeSupportgetChangeSupport(ChangeType ct)Called to retrieve the ChangeSupport for this object.DistributiongetDistribution()Get the Distribution associated with this state.AlphabetgetMatches()The alphabet containing the symbols matched by this ambiguity symbol.StringgetName()The long name for the symbol.ListgetSymbols()The list of symbols that this symbol is composed from.chargetToken()voidregisterWithTrainer(ModelTrainer trainer)Perform any registration that is necessary with mt.voidsetAdvance(int[] advance)Set the advance array.voidsetAnnotation(Annotation ann)voidsetDistribution(Distribution dis)Set the Distribution associated with this state.voidsetName(String name)-
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
-
-
-
-
Field Detail
-
annotationForwarder
protected transient ChangeForwarder annotationForwarder
-
distForwarder
protected transient ChangeForwarder distForwarder
-
-
Constructor Detail
-
SimpleEmissionState
public SimpleEmissionState(String name, Annotation ann, int[] advance, Distribution dis)
-
-
Method Detail
-
getAnnotation
public final Annotation getAnnotation()
Description copied from interface:AnnotatableShould return the associated annotation object.- Specified by:
getAnnotationin interfaceAnnotatable- 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:EmissionStateGet 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:
getDistributionin interfaceEmissionState- Returns:
- the current Distribution object used by this state
-
setDistribution
public final void setDistribution(Distribution dis) throws ChangeVetoException
Description copied from interface:EmissionStateSet the Distribution associated with this state.- Specified by:
setDistributionin interfaceEmissionState- 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:EmissionStateDetermine 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:
getAdvancein interfaceEmissionState
-
setAdvance
public void setAdvance(int[] advance) throws ChangeVetoException
Description copied from interface:EmissionStateSet the advance array.- Specified by:
setAdvancein interfaceEmissionState- 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:SymbolThe long name for the symbol.
-
getMatches
public Alphabet getMatches()
Description copied from interface:SymbolThe 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:
getMatchesin interfaceSymbol- Returns:
- the Alphabet of symbols matched by this symbol
-
getSymbols
public List getSymbols()
Description copied from interface:BasisSymbolThe 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:
getSymbolsin interfaceBasisSymbol- Returns:
- the List of Symbols that this Symbol is built from
-
registerWithTrainer
public void registerWithTrainer(ModelTrainer trainer)
Description copied from interface:TrainablePerform 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:
registerWithTrainerin interfaceTrainable- Parameters:
trainer- the ModelTrainer that encapsulates the training environment
-
getChangeSupport
protected ChangeSupport getChangeSupport(ChangeType ct)
Description copied from class:AbstractChangeableCalled to retrieve the ChangeSupport for this object.Your implementation of this method should have the following structure:
It is usual for the forwarding listeners (someForwarder in this example) to be transient and lazily instantiated. Be sure to register & unregister the forwarder in the code that does the ChangeEvent handling in setter methods.ChangeSupport cs = super.getChangeSupport(ct); if(someForwarder == null && ct.isMatching(SomeInterface.SomeChangeType)) { someForwarder = new ChangeForwarder(... this.stateVariable.addChangeListener(someForwarder, VariableInterface.AChange); } return cs;- Overrides:
getChangeSupportin classAbstractChangeable
-
-