Package imp

Class HaplotypeCoder

java.lang.Object
imp.HaplotypeCoder

public class HaplotypeCoder extends Object

Class HaplotypeCoder indexes the observed allele sequences in phased reference and target genotype data in a chromosome interval.

Instances of class HaplotypeCoder are immutable.

  • Constructor Details

    • HaplotypeCoder

      public HaplotypeCoder(RefGT restrictRefGT, GT phasedTarg)
      Constructs a new HaplotypeCoder instance from the specified data.
      Parameters:
      restrictRefGT - the phased reference genotypes at the target markers
      phasedTarg - the phased target genotypes
      Throws:
      IllegalArgumentException - if refHapPairs.markers().equals(targetHapPairs.markers()) == false
      NullPointerException - if refHapPairs == null || targetHapPairs == null
  • Method Details

    • refHapPairs

      public RefGT refHapPairs()
      Returns the phased reference genotypes at the target markers.
      Returns:
      the phased reference genotypes at the target markers
    • targHapPairs

      public GT targHapPairs()
      Returns the phased target genotypes.
      Returns:
      the phased target genotypes
    • run

      public IndexArray run(int start, int end)
      Returns an array mapping haplotype indices to allele sequence indices in the specified marker interval. The target haplotype indices are shifted by the number of reference haplotypes in the returned array. Thus the first target haplotype index is this.refHapPairs.nHaps() and the last target haplotype index is (this.refHapPairs.nHaps() + this.targHapPairs().nHaps() - 1).
      Parameters:
      start - the first marker index (inclusive)
      end - the last marker index (exclusive)
      Returns:
      an array mapping haplotype indices to allele sequence indices
      Throws:
      IllegalArgumentException - if start >= end
      IndexOutOfBoundsException - if start < 0 || end >= this.refHapPairs.nMarkers()