Class GapDistribution

  • All Implemented Interfaces:
    java.io.Serializable, Distribution, Changeable

    public class GapDistribution
    extends Unchangeable
    implements Distribution, java.io.Serializable
    This distribution emits gap symbols.

    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?

    Since:
    1.0
    Author:
    Matthew Pocock
    See Also:
    Serialized Form
    • Constructor Detail

      • GapDistribution

        public GapDistribution​(Alphabet alpha)
        Get a GapDistribution for an alphabet.
        Parameters:
        alpha - the Alphabet that this distribution is over
    • Method Detail

      • 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 s,
                              double w)
                       throws IllegalSymbolException,
                              java.lang.UnsupportedOperationException
        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:
        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
      • 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