Package phase
Class PbwtRecPhaser
java.lang.Object
phase.PbwtRecPhaser
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
ConstructorsConstructorDescriptionCreates a newPbwtPhaserfor the specified data. -
Method Summary
Modifier and TypeMethodDescriptionstatic BitSet[]bitSets(int nBitSets, int initBitSetCapacity) Returns an array of bit sets.intnHaps()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 markernextMkrto theallelesarray and partially phases and imputes the alleles.targGT()Returns the input target genotypes.
-
Constructor Details
-
PbwtRecPhaser
Creates a newPbwtPhaserfor the specified data.- Parameters:
fpd- the input data for phasing- Throws:
NullPointerException- iffpd == 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
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 markernextMkrto theallelesarray and partially phases and imputes the alleles. When the method returns, theallelesarray will contain the partially phased and imputed genotypes atnextMkr, thetrueelements of themissingarray will identify target samples whose genotype at markernextMkris missing before partial phasing and imputation, and thetrueelements of theunphHetarray will identify samples with a non-missing, unphased heteroygote genotype at markernextMkrthat remain unphased after partial phasing and imputation.- Parameters:
currentMkr- the marker index corresponding to the specified phased alleles or-1if the the alleles array does not contain phased allelesalleles- phased alleles at markercurrentMkrthat will be overwritten with partially phased genotypes at markernextMkrnextMkr- the marker whose partially phased genotypes will be stored in the specifiedallelesarraymissing- an array whosetrueelements identify samples with missing genotype at markernextMkrbefore partial phasing and imputationunphHet- an array whosetrueelements identify samples with non-missing, unphased heterozygote genotype at markernextMkrthat remain unphased after partial phasing- Returns:
- the CDF for the allele counts at marker
nextMkr - Throws:
IndexOutOfBoundsException- ifcurrentMkr < -1 || currentMkr >= this.targGT().nMarkers()IndexOutOfBoundsException- ifnextMkr < 0 || nextMkr >= this.targGT().nMarkers()IndexOutOfBoundsException- if(0 <= currentMkr && currentMkr < this.targGT().nMarkers())and there existshsuch that(0 <= h && h < alleles.length)and(alleles[h] < 0 || alleles[h] >= this.targGT.marker(currentMkr).nAlleles())IndexOutOfBoundsException- ifalleles.length != this.nHaps()IndexOutOfBoundsException- ifmissing.length != this.nTargGT().nSamples()IndexOutOfBoundsException- ifunphHet.length != this.targGT().nSamples()NullPointerException- if any array isnull
-
bitSets
Returns an array of bit sets.- Parameters:
nBitSets- the size of the returned arrayinitBitSetCapacity- the initial capacity of each bit set in the returned array- Returns:
- an array of bit sets
- Throws:
NegativeArraySizeException- if {nBitSets < 0 || initBitSetCapacity < 0
-