Package beagleutil
Class PbwtUpdater
java.lang.Object
beagleutil.PbwtUpdater
Class PbwtDivUpdater updates prefix arrays using the positional
Burrows-Wheeler transform (PBWT).
Instances of PbwtDivUpdater are not thread-safe.
Reference: Durbin, Richard (2014) Efficient haplotype matching and storage using the positional Burrows-Wheeler transform (PBWT). Bioinformatics 30(9):166-1272. doi: 10.1093/bioinformatics/btu014
-
Constructor Summary
ConstructorsConstructorDescriptionPbwtUpdater(int nHaps) Constructs a newPbwtUpdaterinstance for the specified data. -
Method Summary
Modifier and TypeMethodDescriptionintnHaps()Returns the number of haplotypes.voidupdate(int[] alleles, int nAlleles, int[] prefix) Update the specified prefix and divergence arrays using the forward Positional Burrows-Wheeler Transform.voidUpdate the specified prefix and divergence arrays using the forward Positional Burrows-Wheeler Transform.
-
Constructor Details
-
PbwtUpdater
public PbwtUpdater(int nHaps) Constructs a newPbwtUpdaterinstance for the specified data.- Parameters:
nHaps- the number of haplotypes at each position- Throws:
IllegalArgumentException- ifnHaps < 0
-
-
Method Details
-
nHaps
public int nHaps()Returns the number of haplotypes.- Returns:
- the number of haplotypes
-
update
Update the specified prefix and divergence arrays using the forward Positional Burrows-Wheeler Transform. The contract for this method is undefined if the specifiedprefixarray is not a permutation of0, 1, 2, ..., (nHaps - 1).- Parameters:
rec- the haplotype allelesnAlleles- the number of allelesprefix- the prefix array- Throws:
IllegalArgumentException- ifnAlleles < 1IllegalArgumentException- ifrec.size() != this.nHaps() || prefix.length != this.nHaps()IndexOutOfBoundsException- if(prefix[j] < 0 || prefix[j] >= rec.size()for anyjsatisfying(0 <= j && j < prefix.length)IndexOutOfBoundsException- if(rec.get[j] < 0 || rec.get(j) >= nAlleles)for anyjsatisfying(0 <= j && j < this.nHaps())NullPointerException- ifrec == null || prefix == null
-
update
public void update(int[] alleles, int nAlleles, int[] prefix) Update the specified prefix and divergence arrays using the forward Positional Burrows-Wheeler Transform. The contract for this method is undefined if the specifiedprefixarray is not a permutation of0, 1, 2, ..., (nHaps - 1).- Parameters:
alleles- the haplotype allelesnAlleles- the number of allelesprefix- the prefix array- Throws:
IllegalArgumentException- ifnAlleles < 1IllegalArgumentException- ifalleles.length != this.nHaps() || prefix.length != this.nHaps()IndexOutOfBoundsException- if(prefix[j] < 0 || prefix[j] >= rec.size()for anyjsatisfying(0 <= j && j < prefix.length)IndexOutOfBoundsException- if(alleles[j] < 0 || alleles[j] >= nAlleles)for anyjsatisfying(0 <= j && j < this.nHaps())NullPointerException- ifalleles == null || prefix == null
-