Package phase

Class EstPhase


  • public final class EstPhase
    extends java.lang.Object

    Class EstPhase stores original input genotype data. the current estimated haplotype pair for each target sample, a list of missing genotypes for each target sample, and a list of remaining unphased heterozygote genotypes for each target sample.

    Instances of class EstPhase are thread-safe.

    • Constructor Summary

      Constructors 
      Constructor Description
      EstPhase​(GT targGT, RefGT refGT, int overlap, long seed)
      Constructs a new EstPhase instance from the specified data.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void getHaps​(int sample, int[] hap1, int[] hap2)
      Sets the k-th element of the specified hap1 and hap2 arrays to the specified sample's phased genotype at the k-th marker.
      HapsGT hapsGT()
      Returns the current estimated phased genotypes for the target samples.
      IntArray missing​(int sample)
      Returns a list of marker indices in increasing order for which the specified sample has a missing genotype.
      void setHapPair​(int sample, int[] hap1, int[] hap2)
      Sets the haplotype pair for the specified sample to the specified haplotypes.
      void setUnphased​(int sample, IntArray newUnphased)
      Sets the list of remaining marker indices with unphased heterozygote genotypes for the specified sample to the specified list
      GT targGT()
      Returns the input target genotype data.
      IntArray unphased​(int sample)
      Returns a list of remaining marker indices in increasing order for which the specified sample has an unphased heterozygote genotype.
      • Methods inherited from class java.lang.Object

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

      • EstPhase

        public EstPhase​(GT targGT,
                        RefGT refGT,
                        int overlap,
                        long seed)
        Constructs a new EstPhase instance from the specified data.
        Parameters:
        targGT - the original input target genotype data
        refGT - the reference genotype data or null if there are no reference samples
        overlap - the number of initial markers with phased, non-missing genotypes due to overlap with the previous marker window
        seed - the seed for random number generation
        Throws:
        java.lang.IllegalArgumentException - if refGT != null && targGT.markers().equals(refGT.markers()) == false
        java.lang.IllegalArgumentException - if overlap < 0
        java.lang.NullPointerException - if targGT == null
    • Method Detail

      • targGT

        public GT targGT()
        Returns the input target genotype data.
        Returns:
        the input target genotype data
      • unphased

        public IntArray unphased​(int sample)
        Returns a list of remaining marker indices in increasing order for which the specified sample has an unphased heterozygote genotype.
        Parameters:
        sample - the sample index
        Returns:
        a list of remaining marker indices in increasing order for which the specified sample has an unphased heterozygote genotype
        Throws:
        java.lang.IndexOutOfBoundsException - if sample < 0 || sample >= this.nSamples()
      • setUnphased

        public void setUnphased​(int sample,
                                IntArray newUnphased)
        Sets the list of remaining marker indices with unphased heterozygote genotypes for the specified sample to the specified list
        Parameters:
        sample - the sample index
        newUnphased - a list of remaining marker indices with unphased heterozygote genotypes
        Throws:
        java.lang.IllegalArgumentException - if the specified newUnphased list is not sorted in increasing order, contains a duplicate elements, or is not a subset of this.getUnphased(sample).
        java.lang.IndexOutOfBoundsException - if sample < 0 || sample >= this.targGT().nSamples()
        java.lang.NullPointerException - if newUnphased == null
      • missing

        public IntArray missing​(int sample)
        Returns a list of marker indices in increasing order for which the specified sample has a missing genotype.
        Parameters:
        sample - the sample index
        Returns:
        a list of marker indices in increasing order for which the specified sample has a missing genotype
        Throws:
        java.lang.IndexOutOfBoundsException - if sample < 0 || sample >= this.targGT().nSamples()
      • setHapPair

        public void setHapPair​(int sample,
                               int[] hap1,
                               int[] hap2)
        Sets the haplotype pair for the specified sample to the specified haplotypes.
        Parameters:
        sample - the sample index
        hap1 - an array whose elements are the estimated alleles carried by the sample's first haplotype.
        hap2 - an array whose elements are the estimated alleles carried by the sample's second haplotype.
        Throws:
        java.lang.IndexOutOfBoundsException - if sample < 0 || sample >= this.targGT().nSamples()
        java.lang.IllegalArgumentException - if hap1.length != this.targGT().nMarkers()
        java.lang.IllegalArgumentException - if hap2.length != this.targGT().nMarkers()
        java.lang.IllegalArgumentException - if (hap1[k] < 0 || hap1[k] >= this.targGT().marker(k).nAlleles()) for any k satisfying (0 <= k && k < this.targGT().nMarkers())
        java.lang.IllegalArgumentException - if (hap2[k] < 0 || hap2[k] >= this.targGT().marker(k).nAlleles()) for any k satisfying (0 <= k && k < this.targGT().nMarkers())
        java.lang.NullPointerException - if hap1 == null || hap2 == null
      • getHaps

        public void getHaps​(int sample,
                            int[] hap1,
                            int[] hap2)
        Sets the k-th element of the specified hap1 and hap2 arrays to the specified sample's phased genotype at the k-th marker.
        Parameters:
        sample - the sample index
        hap1 - an array whose elements will be set to the current estimated alleles carried by the sample's first haplotype.
        hap2 - an array whose elements will be set to the current estimated allele carried by the sample's second haplotype.
        Throws:
        java.lang.IndexOutOfBoundsException - if hap1.length != this.targGT().nMarkers()
        java.lang.IndexOutOfBoundsException - if hap2.length != this.targGT().nMarkers()
        java.lang.IndexOutOfBoundsException - if sample < 0 || sample >= this.targGT().nSamples()
        java.lang.NullPointerException - if hap1 == null || hap2 == null
      • hapsGT

        public HapsGT hapsGT()
        Returns the current estimated phased genotypes for the target samples.
        Returns:
        the current estimated phased genotypes for the target samples