PairDistribution (BioJava-1.5-beta API)
Keywords: org.biojava.bio.dist.PairDistribution class

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.dist
Class PairDistribution

    java.lang.Object
      org.biojava.utils.AbstractChangeable
          org.biojava.bio.dist.PairDistribution

All Implemented Interfaces:
  Serializable, Distribution, Changeable

    public class PairDistribution

extends AbstractChangeable
implements Serializable, Distribution

Class for pairing up two independant distributions.

Since:
  1.1
Author:
  Matthew Pocock, Thomas Down, Samiul Hasan
See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from interface org.biojava.bio.dist.Distribution
`Distribution.NullModelForwarder`

Field Summary

Fields inherited from interface org.biojava.bio.dist.Distribution
`NULL_MODEL, WEIGHTS`

Constructor Summary
`PairDistribution(Distribution first, Distribution second)` Create a new PairDistribution that represents the product of two other distributions.

Method Summary
`Alphabet` | `getAlphabet()` The alphabet from which this spectrum emits symbols.
`Distribution` | `getNullModel()` Retrieve the null model Distribution that this Distribution recognizes.
`protected static Distribution` | `getNullModel(Distribution first, Distribution second)` Get a uniform null model over a PairDistribution over [first,second].
`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.
`void` | `registerWithTrainer(ModelTrainer trainer)` Register this paired distribution with a model trainer.
`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 sym, double weight)` Set the probability or odds that Symbol s is emitted by this state.

Methods inherited from class org.biojava.utils.AbstractChangeable
`addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, 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`

Constructor Detail

### PairDistribution

    public PairDistribution(Distribution first,
                            Distribution second)

  Create a new PairDistribution that represents the product of two other distributions. The alphabet will be the product of the first and seccond distribution's alphabets, and the weights will be the products of the weights for the first and seccond distributions given the first and second component of the symbol respectively.

  Parameters:
    `first` - the first distribution
    `second` - the second distribution

Method Detail

### getNullModel

    protected static Distribution getNullModel(Distribution first,
                                               Distribution second)

  Get a uniform null model over a PairDistribution over [first,second].

  Parameters:
    `first` - the first Alphabet
    `second` - the second Alphabet
  Returns:
    a Distribution that is a uniform distribution over the product of first and second

### getAlphabet

    public Alphabet getAlphabet()

  Description copied from interface: `Distribution`
  The alphabet from which this spectrum emits symbols.

  Specified by:
    `getAlphabet` in interface `Distribution`
  Returns:
    the Alphabet associated with this spectrum

### getNullModel

    public Distribution getNullModel()

  Description copied from interface: `Distribution`
  Retrieve the null model Distribution that this Distribution recognizes.

  Specified by:
    `getNullModel` in interface `Distribution`
  Returns:
    the apropriate null model

### setNullModel

    public void setNullModel(Distribution nullModel)
                      throws IllegalAlphabetException,
                             ChangeVetoException

  Description copied from interface: `Distribution`
  Set the null model Distribution that this Distribution recognizes.

  Specified by:
    `setNullModel` in interface `Distribution`
  Parameters:
    `nullModel` - the new null model Distribution
  Throws:
    `IllegalAlphabetException` - if the null model has the wrong alphabet
    `ChangeVetoException` - if this Distirbution doesn't support setting the null model, or if one of its listeners objects

### registerWithTrainer

    public void registerWithTrainer(ModelTrainer trainer)

  Register this paired distribution with a model trainer.

  Parameters:
    `trainer` - the trainer to register this distribution with.

### getWeight

    public double getWeight(Symbol sym)
                     throws IllegalSymbolException

  Description copied from interface: `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.

  Specified by:
    `getWeight` in interface `Distribution`
  Parameters:
    `sym` - the Symbol emitted
  Returns:
    the probability of emitting that symbol
  Throws:
    `IllegalSymbolException` - if s is not from this state's alphabet

### setWeight

    public void setWeight(Symbol sym,
                          double weight)
                   throws ChangeVetoException

  Description copied from interface: `Distribution`
  Set the probability or odds that Symbol s is emitted by this state.

  Specified by:
    `setWeight` in interface `Distribution`
  Parameters:
    `sym` - the Symbol emitted
    `weight` - the probability of emitting that symbol
  Throws:
    `ChangeVetoException` - if this state does not allow weights to be tampered with, or if one of the listeners vetoed this change

### registerWithTrainer

    public void registerWithTrainer(DistributionTrainerContext dtc)

  Description copied from interface: `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.

  Specified by:
    `registerWithTrainer` in interface `Distribution`
  Parameters:
    `dtc` - the DistributionTrainerContext with witch to register a trainer

### sampleSymbol

    public Symbol sampleSymbol()

  Description copied from interface: `Distribution`
  Sample a symbol from this state's probability distribution.

  Specified by:
    `sampleSymbol` in interface `Distribution`
  Returns:
    the symbol sampled

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