public class GapDistribution extends Unchangeable implements Distribution, Serializable
It is a useful thing to have around for pair-wise alignment, as you can build a PairDistribution that emits gaps in one sequence and Symbols in the other. The GapDistriution will always emit with a probability of 1, as every symbol has a matches alphabet that contains the empty set. Or is this so?
Distribution.NullModelForwarder
NULL_MODEL, WEIGHTS
Constructor and Description |
---|
GapDistribution(Alphabet alpha)
Get a GapDistribution for an alphabet.
|
Modifier and Type | Method and Description |
---|---|
Alphabet |
getAlphabet()
The alphabet from which this spectrum emits symbols.
|
Distribution |
getNullModel()
Retrieve the null model Distribution that this Distribution recognizes.
|
double |
getWeight(Symbol sym)
Return the probability that Symbol s is emitted by this spectrum.
|
void |
registerWithTrainer(DistributionTrainerContext dtc)
Register this distribution with a training context.
|
Symbol |
sampleSymbol()
Sample a symbol from this state's probability distribution.
|
void |
setNullModel(Distribution nullModel)
Set the null model Distribution that this Distribution recognizes.
|
void |
setWeight(Symbol s,
double w)
Set the probability or odds that Symbol s is emitted by this state.
|
addChangeListener, addChangeListener, addForwarder, getForwarders, getListeners, isUnchanging, removeChangeListener, removeChangeListener, removeForwarder
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
public GapDistribution(Alphabet alpha)
alpha
- the Alphabet that this distribution is overpublic double getWeight(Symbol sym) throws IllegalSymbolException
Distribution
Return the probability that Symbol s is emitted by this spectrum.
If the symbol is ambiguou, then it is the sum of the probability that each one of the matching symbols was emitted.
getWeight
in interface Distribution
sym
- the Symbol emittedIllegalSymbolException
- if s is not from this state's alphabetpublic void setWeight(Symbol s, double w) throws IllegalSymbolException, UnsupportedOperationException
Distribution
setWeight
in interface Distribution
s
- the Symbol emittedw
- the probability of emitting that symbolIllegalSymbolException
- if s is not from this state's alphabet, or
if it is an ambiguity symbol and the implementation can't handle
this caseUnsupportedOperationException
public Alphabet getAlphabet()
Distribution
getAlphabet
in interface Distribution
public Symbol sampleSymbol()
Distribution
sampleSymbol
in interface Distribution
public Distribution getNullModel()
Distribution
getNullModel
in interface Distribution
public void setNullModel(Distribution nullModel) throws IllegalAlphabetException, ChangeVetoException
Distribution
setNullModel
in interface Distribution
nullModel
- the new null model DistributionIllegalAlphabetException
- if the null model has the wrong alphabetChangeVetoException
- if this Distirbution doesn't support setting
the null model, or if one of its listeners objectspublic void registerWithTrainer(DistributionTrainerContext dtc)
Distribution
Register this distribution with a training context.
This should be invoked from within dtc.addDistribution(). This method is responsible for constructing a suitable DistributionTrainer instance and registering it by calling dtc.registerDistributionTrainer(this, trainer). If the distribution is a view onto another distribution, it can force the other to be registered by calling dtc.addDistribution(other), and can then get on with registering it's own trainer.
registerWithTrainer
in interface Distribution
dtc
- the DistributionTrainerContext with witch to register a trainerCopyright © 2014 BioJava. All rights reserved.