Package phase

Class FwdBwd


  • public class FwdBwd
    extends java.lang.Object

    Class FwdBwd implements computes HMM reference haplotypes and state probabilities.

    Instances of class FwdBwd are not thread-safe.

    • Constructor Summary

      Constructors 
      Constructor Description
      FwdBwd​(PhaseIbs phaseIbs)
      Creates a FwdBwd instance from the specified data.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int maxStates()
      Returns the maximum number of HMM states.
      PhaseIbs phaseIbs()
      Return the haplotype IBS
      int run​(int hap, int[][] refHaps, float[][] stateProbs)
      Stores the HMM reference haplotypes and states probabilities for the specified target haplotype, and returns the number of HMM states per marker.
      • Methods inherited from class java.lang.Object

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

      • FwdBwd

        public FwdBwd​(PhaseIbs phaseIbs)
        Creates a FwdBwd instance from the specified data.
        Parameters:
        phaseIbs - the IBS haplotypes
        Throws:
        java.lang.NullPointerException - if phaseIbs == null
    • Method Detail

      • run

        public int run​(int hap,
                       int[][] refHaps,
                       float[][] stateProbs)
        Stores the HMM reference haplotypes and states probabilities for the specified target haplotype, and returns the number of HMM states per marker. The contract for this method is undefined if the number of elements in each row of the specified arrays is not greater than or equal to this.maxStates().
        Parameters:
        hap - a target haplotype index
        refHaps - the array in which the reference haplotypes for each hidden state will be stored
        stateProbs - the array in which estimated probabilities for each hidden state will be stored
        Returns:
        the number of hidden states at each marker
        Throws:
        java.lang.IndexOutOfBoundsException - if hap < 0 || hap >= this.phaseIbs().phaseData().targGT().nHaps()
        java.lang.IndexOutOfBoundsException - if refHaps.length < this.phaseIbs().phaseData.targGT().nMarkers()
        java.lang.IndexOutOfBoundsException - if stateProbs.length < this.phaseIbs().phaseData.targGT().nMarkers()
        java.lang.NullPointerException - if refHaps == null || stateProbs == null
      • phaseIbs

        public PhaseIbs phaseIbs()
        Return the haplotype IBS
        Returns:
        the haplotype IBS
      • maxStates

        public int maxStates()
        Returns the maximum number of HMM states.
        Returns:
        the maximum number of HMM states