Package phase

Class HapImputer


  • public class HapImputer
    extends java.lang.Object

    Class ImputableHaps performs imputation to estimate missing alleles and missing haplotype phase.

    Instances of ImputableHaps are thread-safe.

    • Constructor Summary

      Constructors 
      Constructor Description
      HapImputer​(Markers markers, Samples samples)
      Constructs a new ImputedHaps instance from the specified data.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      GT imputedHaps()
      Returns the imputed haplotypes.
      Markers markers()
      Returns the list of markers.
      void setHap​(int hap, int[] alleles)
      Stores the specified haplotype.
      void setPartlyImputedAllele​(int hap, int marker, float[] alProbs, IntList refHaps, FloatList stateProbs)
      Stores a partially-imputed allele.
      Samples targSamples()
      Returns the list of target samples.
      • Methods inherited from class java.lang.Object

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

      • HapImputer

        public HapImputer​(Markers markers,
                          Samples samples)
        Constructs a new ImputedHaps instance from the specified data.
        Parameters:
        markers - the list of markers
        samples - the list of target samples
        Throws:
        java.lang.NullPointerException - if markers == null || samples == null
    • Method Detail

      • targSamples

        public Samples targSamples()
        Returns the list of target samples.
        Returns:
        the list of target samples
      • markers

        public Markers markers()
        Returns the list of markers.
        Returns:
        the list of markers
      • setHap

        public void setHap​(int hap,
                           int[] alleles)
        Stores the specified haplotype.
        Parameters:
        hap - the haplotype index
        alleles - the haplotype
        Throws:
        java.lang.IndexOutOfBoundsException - if hap < 0 || hap >= 2*this.samples()
        java.lang.IllegalArgumentException - if alleles.length != this.markers().nMarkers()
        java.lang.NullPointerException - if alleles == null
      • setPartlyImputedAllele

        public void setPartlyImputedAllele​(int hap,
                                           int marker,
                                           float[] alProbs,
                                           IntList refHaps,
                                           FloatList stateProbs)
        Stores a partially-imputed allele. if alProbs.length < this.markers().marker(marker).nAlleles(), the missing allele probabilities are assumed to be 0.0.
        Parameters:
        hap - the haplotype index
        marker - the marker index
        alProbs - the posterior allele probabilities computed from a subset of HMM states
        refHaps - the list of reference haplotypes for HMM states not included in the specified allele probabilities
        stateProbs - the list of state probabilities for each HMM state in the specified list of reference haplotypes
        Throws:
        java.lang.IndexOutOfBoundsException - if hap < 0 || hap >= 2 * this.targSamples().nSamples()
        java.lang.IndexOutOfBoundsException - if marker < 0 || marker >= this.markers().nMarkers()
        java.lang.IllegalArgumentException - if refHaps.size() != stateProbs.size()
        java.lang.NullPointerException - if alProbs == null || refHaps == null || stateProbs == null
      • imputedHaps

        public GT imputedHaps()
        Returns the imputed haplotypes.
        Returns:
        the imputed haplotypes
        Throws:
        java.lang.NullPointerException - if this.setHap() has not previously been called for each haplotype h satisfying (0 <= h && h <= 2 * this.targSamples().nSamples())