Package phase
Class PbwtRecPhaser
- java.lang.Object
-
- phase.PbwtRecPhaser
-
public class PbwtRecPhaser extends java.lang.ObjectClass
PbwtRecPhaserpartially phases and imputes genotypes using the Positional Burrows-Wheeler transform.Instances of class
PbwtRecPhaserare 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 PbwtRecPhaser(FixedPhaseData fpd)Creates a newPbwtPhaserfor the specified data.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.util.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.GTtargGT()Returns the input target genotypes.
-
-
-
Constructor Detail
-
PbwtRecPhaser
public PbwtRecPhaser(FixedPhaseData fpd)
Creates a newPbwtPhaserfor the specified data.- Parameters:
fpd- the input data for phasing- Throws:
java.lang.NullPointerException- iffpd == null
-
-
Method Detail
-
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 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:
java.lang.IndexOutOfBoundsException- ifcurrentMkr < -1 || currentMkr >= this.targGT().nMarkers()java.lang.IndexOutOfBoundsException- ifnextMkr < 0 || nextMkr >= this.targGT().nMarkers()java.lang.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())java.lang.IndexOutOfBoundsException- ifalleles.length != this.nHaps()java.lang.IndexOutOfBoundsException- ifmissing.length != this.nTargGT().nSamples()java.lang.IndexOutOfBoundsException- ifunphHet.length != this.targGT().nSamples()java.lang.NullPointerException- if any array isnull
-
bitSets
public static java.util.BitSet[] bitSets(int nBitSets, int initBitSetCapacity)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:
java.lang.NegativeArraySizeException- if {nBitSets < 0 || initBitSetCapacity < 0
-
-