Package phase

Class PbwtRecPhaser

java.lang.Object
phase.PbwtRecPhaser

public class PbwtRecPhaser extends Object

Class PbwtRecPhaser partially phases and imputes genotypes using the Positional Burrows-Wheeler transform.

Instances of class PbwtRecPhaser are not thread-safe.

Reference: Richard Durbin. (2014) Efficient haplotype matching and storage using the Positional Burrows-Wheeler Transform (PBWT). Bioinformatics 30(9):1266-72.

Reference: Olivier Delaneau, Jean-Francois Zagury, Matthew R Robinson, Jonathan Marchini, Emmanouil Dermitzakis. (2019) Accurate, scalable and integrative haplotype estimation. Nature Communications 10(1):5436.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new PbwtPhaser for the specified data.
  • Method Summary

    Modifier and Type
    Method
    Description
    static BitSet[]
    bitSets(int nBitSets, int initBitSetCapacity)
    Returns an array of bit sets.
    int
    Returns the total number of target and reference haplotypes.
    int[]
    phase(int currentMkr, int[] alleles, int nextMkr, boolean[] missing, boolean[] unphHet)
    Copies input target and reference alleles for the marker nextMkr to the alleles array and partially phases and imputes the alleles.
    Returns the input target genotypes.

    Methods inherited from class java.lang.Object

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

    • PbwtRecPhaser

      public PbwtRecPhaser(FixedPhaseData fpd)
      Creates a new PbwtPhaser for the specified data.
      Parameters:
      fpd - the input data for phasing
      Throws:
      NullPointerException - if fpd == null
  • Method Details

    • nHaps

      public int nHaps()
      Returns the total number of target and reference haplotypes.
      Returns:
      the total number of target and reference haplotypes
    • targGT

      public GT targGT()
      Returns the input target genotypes.
      Returns:
      the input target genotypes
    • phase

      public int[] phase(int currentMkr, int[] alleles, int nextMkr, boolean[] missing, boolean[] unphHet)
      Copies input target and reference alleles for the marker nextMkr to the alleles array and partially phases and imputes the alleles. When the method returns, the alleles array will contain the partially phased and imputed genotypes at nextMkr, the true elements of the missing array will identify target samples whose genotype at marker nextMkr is missing before partial phasing and imputation, and the true elements of the unphHet array will identify samples with a non-missing, unphased heteroygote genotype at marker nextMkr that remain unphased after partial phasing and imputation.
      Parameters:
      currentMkr - the marker index corresponding to the specified phased alleles or -1 if the the alleles array does not contain phased alleles
      alleles - phased alleles at marker currentMkr that will be overwritten with partially phased genotypes at marker nextMkr
      nextMkr - the marker whose partially phased genotypes will be stored in the specified alleles array
      missing - an array whose true elements identify samples with missing genotype at marker nextMkr before partial phasing and imputation
      unphHet - an array whose true elements identify samples with non-missing, unphased heterozygote genotype at marker nextMkr that remain unphased after partial phasing
      Returns:
      the CDF for the allele counts at marker nextMkr
      Throws:
      IndexOutOfBoundsException - if currentMkr < -1 || currentMkr >= this.targGT().nMarkers()
      IndexOutOfBoundsException - if nextMkr < 0 || nextMkr >= this.targGT().nMarkers()
      IndexOutOfBoundsException - if (0 <= currentMkr && currentMkr < this.targGT().nMarkers()) and there exists h such that (0 <= h && h < alleles.length) and (alleles[h] < 0 || alleles[h] >= this.targGT.marker(currentMkr).nAlleles())
      IndexOutOfBoundsException - if alleles.length != this.nHaps()
      IndexOutOfBoundsException - if missing.length != this.nTargGT().nSamples()
      IndexOutOfBoundsException - if unphHet.length != this.targGT().nSamples()
      NullPointerException - if any array is null
    • bitSets

      public static BitSet[] bitSets(int nBitSets, int initBitSetCapacity)
      Returns an array of bit sets.
      Parameters:
      nBitSets - the size of the returned array
      initBitSetCapacity - the initial capacity of each bit set in the returned array
      Returns:
      an array of bit sets
      Throws:
      NegativeArraySizeException - if { nBitSets < 0 || initBitSetCapacity < 0