Package phase

Class HmmUpdater


  • public class HmmUpdater
    extends java.lang.Object

    Instances of class HmmUpdater have methods for one-step updates of forward or backward HMM values.

    • Constructor Summary

      Constructors 
      Constructor Description
      HmmUpdater​(float pErr)
      Constructs a new HmmUpdater instance from the specified data.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void bwdUpdate​(double[] bwd, double pSwitch, byte[] mismatch, int nStates)
      Updates the backward values.
      void bwdUpdate​(float[] bwd, float pSwitch, byte[] mismatch, int nStates)
      Updates the backward values.
      double fwdUpdate​(double[] fwd, double sum, double pSwitch, byte[] mismatch, int nStates)
      Updates the forward values and returns the sum of the updated forward values.
      float fwdUpdate​(float[] fwd, float sum, float pSwitch, byte[] mismatch, int nStates)
      Updates the forward values and returns the sum of the updated forward values.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HmmUpdater

        public HmmUpdater​(float pErr)
        Constructs a new HmmUpdater instance from the specified data.
        Parameters:
        pErr - the probability that the observed allele does not match the state allele
    • Method Detail

      • fwdUpdate

        public float fwdUpdate​(float[] fwd,
                               float sum,
                               float pSwitch,
                               byte[] mismatch,
                               int nStates)
        Updates the forward values and returns the sum of the updated forward values.
        Parameters:
        fwd - the array of forward values that will be updated
        pSwitch - the probability of jumping to a random state
        sum - the sum of forward values in the specified array
        mismatch - the number of allele mismatches (0 or 1) for each HMM state
        nStates - the number of states
        Returns:
        the sum of the updated forward values
        Throws:
        java.lang.IndexOutOfBoundsException - if fwd.length < nStates || mismatch.length < nStates
        java.lang.NullPointerException - if fwd == null || mismatch == null
      • bwdUpdate

        public void bwdUpdate​(float[] bwd,
                              float pSwitch,
                              byte[] mismatch,
                              int nStates)
        Updates the backward values.
        Parameters:
        bwd - the array of backward values that will be updated
        pSwitch - the probability of jumping to a random state
        mismatch - the number of allele mismatches (0 or 1) for each HMM state
        nStates - the number of states
        Throws:
        java.lang.IndexOutOfBoundsException - if bwd.length < nStates || mismatch.length < nStates
        java.lang.NullPointerException - if bwd == null || mismatch == null
      • fwdUpdate

        public double fwdUpdate​(double[] fwd,
                                double sum,
                                double pSwitch,
                                byte[] mismatch,
                                int nStates)
        Updates the forward values and returns the sum of the updated forward values.
        Parameters:
        fwd - the array of forward values that will be updated
        pSwitch - the probability of jumping to a random state
        sum - the sum of forward values in the specified array
        mismatch - the number of allele mismatches (0 or 1) for each HMM state
        nStates - the number of states
        Returns:
        the sum of the updated forward values
        Throws:
        java.lang.IndexOutOfBoundsException - if fwd.length < nStates || mismatch.length < nStates
        java.lang.NullPointerException - if fwd == null || mismatch == null
      • bwdUpdate

        public void bwdUpdate​(double[] bwd,
                              double pSwitch,
                              byte[] mismatch,
                              int nStates)
        Updates the backward values.
        Parameters:
        bwd - the array of backward values that will be updated
        pSwitch - the probability of jumping to a random state
        mismatch - the number of allele mismatches (0 or 1) for each HMM state
        nStates - the number of states
        Throws:
        java.lang.IndexOutOfBoundsException - if bwd.length < nStates || mismatch.length < nStates
        java.lang.NullPointerException - if bwd == null || mismatch == null