Package imp

Class RefHapHash

java.lang.Object
imp.RefHapHash

public class RefHapHash extends Object

Class RefHapHash stores a hash code for each haplotype in a sublist of reference haplotypes. The hash code is computed from the allele sequence carried by the reference haplotype.

Instances of class RefHapHash are immutable.

  • Constructor Summary

    Constructors
    Constructor
    Description
    RefHapHash(AtomicReferenceArray<StateProbs> stateProbs, int targMarker, RefGT refHapPairs, int start, int end)
    Constructs a new RefHapHash instance for the specified data.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    end()
    Returns the ending reference marker index (exclusive) for the reference haplotype allele sequences.
    int
    hap(int index)
    Return the specified haplotype in the sublist of reference haplotypes.
    int
    hap2Index(int hap)
    Returns the index of the specified haplotype in the sublist of reference haplotypes.
    int
    hash(int index)
    Return a hash code computed from the allele sequence of the specified haplotype in the sublist of reference haplotypes.
    int
    Returns the size of the sublist of reference haplotypes.
    Returns the phased reference genotypes.
    void
    setAlleles(int index, int[] alleles)
    Copies the alleles between this.start() (inclusive) and this.end() (exclusive) of the specified haplotype in the sublist of reference haplotypes to the specified array.
    int
    Returns the starting reference marker index (inclusive) for the reference haplotype allele sequences.
    int
    Returns the target marker.

    Methods inherited from class java.lang.Object

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

    • RefHapHash

      public RefHapHash(AtomicReferenceArray<StateProbs> stateProbs, int targMarker, RefGT refHapPairs, int start, int end)
      Constructs a new RefHapHash instance for the specified data. The sublist of reference haplotypes is the ordered list of distinct reference haplotypes with stored state probability data at the specified target marker in the stateProbs parameter.
      Parameters:
      stateProbs - HMM state probabilities at the genotyped markers in the target samples
      targMarker - a target marker index
      refHapPairs - the reference haplotypes
      start - the starting reference marker index (inclusive) for the reference haplotype allele sequences
      end - the ending reference marker index (exclusive) for the reference haplotype allele sequences
      Throws:
      IndexOutOfBoundsException - if targMarker < 0
      IndexOutOfBoundsException - if there exists a j satisfying (0 <= j && j < stateProbs.size()) && (targMarker >= stateProbs.get(j).nMarkers())
      IllegalArgumentException - if start < 0 || start >= end || end > refHapPairs.nMarkers()
      NullPointerException - if stateProbs == null || refHapPairs == null
      NullPointerException - if there exists a j satisfying (0 <= j && j < stateProbs.size()) && (stateProbs.get(j) == null)
  • Method Details

    • targMarker

      public int targMarker()
      Returns the target marker.
      Returns:
      the target marker
    • refGT

      public RefGT refGT()
      Returns the phased reference genotypes.
      Returns:
      the phased reference genotypes
    • start

      public int start()
      Returns the starting reference marker index (inclusive) for the reference haplotype allele sequences.
      Returns:
      the starting reference marker index (inclusive) for the reference haplotype allele sequences
    • end

      public int end()
      Returns the ending reference marker index (exclusive) for the reference haplotype allele sequences.
      Returns:
      the ending reference marker index (exclusive) for the reference haplotype allele sequences
    • setAlleles

      public void setAlleles(int index, int[] alleles)
      Copies the alleles between this.start() (inclusive) and this.end() (exclusive) of the specified haplotype in the sublist of reference haplotypes to the specified array.
      Parameters:
      index - an index in the sublist of reference haplotypes
      alleles - the array to which haplotype alleles will be copied
      Throws:
      IllegalArgumentException - if alleles.length < (this.end() - this.start())
      NullPointerException - if alleles == null
    • nHaps

      public int nHaps()
      Returns the size of the sublist of reference haplotypes.
      Returns:
      the size of the sublist of reference haplotypes
    • hap2Index

      public int hap2Index(int hap)
      Returns the index of the specified haplotype in the sublist of reference haplotypes. Returns (-insertionPoint - 1) if the specified haplotype is not found in the sublist of reference haplotypes.
      Parameters:
      hap - a reference haplotype index
      Returns:
      the index of the specified haplotype in the sublist of reference haplotypes
    • hap

      public int hap(int index)
      Return the specified haplotype in the sublist of reference haplotypes.
      Parameters:
      index - an index in the sublist of reference haplotypes
      Returns:
      the specified haplotype in the sublist of reference haplotypes
    • hash

      public int hash(int index)
      Return a hash code computed from the allele sequence of the specified haplotype in the sublist of reference haplotypes. The hash code is computed from the allele sequence between markers with index this.start() (inclusive) and this.end() (exclusive).
      Parameters:
      index - an index in the sublist of reference haplotypes
      Returns:
      a hash code computed from the allele sequence of the specified haplotype in the sublist of reference haplotypes