## org.biojava.bio.dist
Class ComplementaryDistribution

    java.lang.Object
      |
      +--org.biojava.bio.dist.ComplementaryDistribution

public class ComplementaryDistribution
extends java.lang.Object
implements Distribution, java.io.Serializable

Creates a complementary distribution from a given distribution.

See Also:
  Serialized Form

Constructor Summary
`ComplementaryDistribution(Distribution other)`

Method Summary
`Alphabet` `getAlphabet()` The alphabet from which this spectrum emits symbols.
`double` `getWeight(Symbol s)` Return the probability that Symbol s is emited 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` `setWeight(Symbol s, double score)` Set the probability or odds that Symbol s is emited by this state.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ComplementaryDistribution

    public ComplementaryDistribution(Distribution other)
                              throws IllegalAlphabetException

Method Detail

### getWeight

    public double getWeight(Symbol s)
                     throws IllegalSymbolException

  Description copied from interface: Distribution
  Return the probability that Symbol s is emited by this spectrum.

  If the symbol is an AmbiguitySymbol, then it is the probability that exactly one of the symbols matching it was emitted.

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

### setWeight

    public void setWeight(Symbol s,
                          double score)
                   throws IllegalSymbolException,
                          java.lang.UnsupportedOperationException

  Description copied from interface: Distribution
  Set the probability or odds that Symbol s is emited by this state.
  Specified by:
    setWeight in interface Distribution
  Tags copied from interface: Distribution
  Parameters:
    `s` - the Symbol emitted
    `w` - the probability of emitting that symbol
  Throws:
    IllegalSymbolException - if s is not from this state's alphabet, or if it is an ambiguity symbol and the implementation can't handle this case
    java.lang.UnsupportedOperationException - if this state does not allow weights to be tampered with

### getAlphabet

    public Alphabet getAlphabet()

  Description copied from interface: Distribution
  The alphabet from which this spectrum emits symbols.
  Specified by:
    getAlphabet in interface Distribution
  Tags copied from interface: Distribution
  Returns:
    the Alphabet associated with this spectrum

### sampleSymbol

    public Symbol sampleSymbol()

  Description copied from interface: Distribution
  Sample a symbol from this state's probability distribution.
  Specified by:
    sampleSymbol in interface Distribution
  Tags copied from interface: Distribution
  Returns:
    the symbol sampled

### 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
  Tags copied from interface: Distribution
  Parameters:
    `dtc` - the DistributionTrainerContext with witch to register a trainer