Package phase

Class BasicPhaseStates

java.lang.Object
phase.BasicPhaseStates

public final class BasicPhaseStates extends Object

Class BasicPhaseStates has methods for constructing a Li and Stephens HMM for a target haplotype or target sample.

Instances of BasicPhaseStates are not thread-safe.

  • Constructor Summary

    Constructors
    Constructor
    Description
    BasicPhaseStates(PbwtPhaseIbs ibsHaps, int maxStates)
    Constructs a new BasicPhaseStates object from the specified data.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    ibsStates(int sample, byte[][][] nMismatches)
    Stores the Li and Stephens HMM for the specified target sample in the specified arrays.
    int
    ibsStates(MarkerCluster mc, List<int[]> refAtMissingGT, byte[][][] nMismatches)
    Stores the Li and Stephens HMM for the specified target sample in the specified arrays.The nMismatches parameter is an array of three two-dimensional arrays: nMismatches[0] stores stores the allele mismatch data between the reference haplotypes and the haplotype composed of homozygous target genotypes, nMismatches[1] stores the allele mismatch data between the reference haplotypes and the first target haplotype, and nMismatches[2] stores the allele mismatch data between the reference haplotypes and the first target haplotype.
    int
    Returns the maximum number of HMM states at a marker.
    int
    Returns the number of markers.
    int
    Returns the number of target samples.

    Methods inherited from class java.lang.Object

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

    • BasicPhaseStates

      public BasicPhaseStates(PbwtPhaseIbs ibsHaps, int maxStates)
      Constructs a new BasicPhaseStates object from the specified data.
      Parameters:
      ibsHaps - the IBS haplotype segments
      maxStates - the maximum number of composite reference haplotypes that will be constructed
      Throws:
      IllegalArgumentException - if maxStates < 1
      NullPointerException - if ibsHaps == null
  • Method Details

    • nTargSamples

      public int nTargSamples()
      Returns the number of target samples.
      Returns:
      the number of target samples
    • nMarkers

      public int nMarkers()
      Returns the number of markers.
      Returns:
      the number of markers
    • maxStates

      public int maxStates()
      Returns the maximum number of HMM states at a marker.
      Returns:
      the maximum number of HMM states at a marker
    • ibsStates

      public int ibsStates(MarkerCluster mc, List<int[]> refAtMissingGT, byte[][][] nMismatches)
      Stores the Li and Stephens HMM for the specified target sample in the specified arrays.The nMismatches parameter is an array of three two-dimensional arrays: nMismatches[0] stores stores the allele mismatch data between the reference haplotypes and the haplotype composed of homozygous target genotypes, nMismatches[1] stores the allele mismatch data between the reference haplotypes and the first target haplotype, and nMismatches[2] stores the allele mismatch data between the reference haplotypes and the first target haplotype. Each two-dimensional array must have at least mc.nClusters() rows, and a column for each HMM state. An element of the two-dimensional array is 0 if the target and reference allele match and is 1 otherwise.
      Parameters:
      mc - the marker clusters
      refAtMissingGT - a list of arrays in which HMM state alleles at markers for which one or both target haplotypes have a missing allele
      nMismatches - arrays for storing present or absence of mismatches between target and reference alleles
      Returns:
      the number of state alleles at each marker
      Throws:
      IndexOutOfBoundsException - if sample < 0 || sample >= this.nTargSamples()
      IndexOutOfBoundsException - if nMismatches.length < 3
      IndexOutOfBoundsException - if there exists j such that 0 < j && j < 3 && nMismatches[j].length < mc.nClusters()
      IndexOutOfBoundsException - if there exists j, m such that (0 < j && j < 3 && 0 < m && m < mc.nClusters()), and nMismatches[j][m].length is less than the number of model states at marker m
      IndexOutOfBoundsException - if missAlleles.get(j) is less than the number of model states for any j that indexes the missing genotypes
      NullPointerException - if (samplePhase == null || mc == null || refAtMissingGT == null) or if any array is null
    • ibsStates

      public int ibsStates(int sample, byte[][][] nMismatches)
      Stores the Li and Stephens HMM for the specified target sample in the specified arrays. The number of allele mismatches (0 or 1) between hap1[m] and hap2[m] for the j-th state are stored in nMismatchs[0][m][j] and nMismatches[1][m][j] respectively.
      Parameters:
      sample - the target sample index
      nMismatches - an array of two two-dimensional arrays in which the number of allele mismatches with reference haplotypes for the first haplotype and the second haplotype will be stored
      Returns:
      the number of state alleles at each marker
      Throws:
      IndexOutOfBoundsException - if sample < 0 || sample >= this.nTargSamples()
      IndexOutOfBoundsException - if nMismatches.length < 2
      IndexOutOfBoundsException - if there exists j such that (0 < j && j < 2 && nMismatches[j].length < this.nMarkers())
      IndexOutOfBoundsException - if there exists j, m such that (0 < j && j < 2 && 0 < m && m < this.nMarkers()), and nMismatches[j][m].length is less than the total number of model states
      NullPointerException - if any array is null