Package phase
Class PbwtRecPhaser
- java.lang.Object
-
- phase.PbwtRecPhaser
-
public class PbwtRecPhaser extends java.lang.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 PbwtRecPhaser(FixedPhaseData fpd)
Creates a newPbwtPhaser
for 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.int
nHaps()
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 markernextMkr
to thealleles
array and partially phases and imputes the alleles.GT
targGT()
Returns the input target genotypes.
-
-
-
Constructor Detail
-
PbwtRecPhaser
public PbwtRecPhaser(FixedPhaseData fpd)
Creates a newPbwtPhaser
for 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 markernextMkr
to thealleles
array and partially phases and imputes the alleles. When the method returns, thealleles
array will contain the partially phased and imputed genotypes atnextMkr
, thetrue
elements of themissing
array will identify target samples whose genotype at markernextMkr
is missing before partial phasing and imputation, and thetrue
elements of theunphHet
array will identify samples with a non-missing, unphased heteroygote genotype at markernextMkr
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 allelesalleles
- phased alleles at markercurrentMkr
that will be overwritten with partially phased genotypes at markernextMkr
nextMkr
- the marker whose partially phased genotypes will be stored in the specifiedalleles
arraymissing
- an array whosetrue
elements identify samples with missing genotype at markernextMkr
before partial phasing and imputationunphHet
- an array whosetrue
elements identify samples with non-missing, unphased heterozygote genotype at markernextMkr
that 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 existsh
such 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
-
-