Package phase
Class HapImputer
- java.lang.Object
-
- phase.HapImputer
-
public class HapImputer extends java.lang.ObjectClass
ImputableHapsperforms imputation to estimate missing alleles and missing haplotype phase.Instances of
ImputableHapsare thread-safe.
-
-
Constructor Summary
Constructors Constructor Description HapImputer(Markers markers, Samples samples)Constructs a newImputedHapsinstance from the specified data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GTimputedHaps()Returns the imputed haplotypes.Markersmarkers()Returns the list of markers.voidsetHap(int hap, int[] alleles)Stores the specified haplotype.voidsetPartlyImputedAllele(int hap, int marker, float[] alProbs, IntList refHaps, FloatList stateProbs)Stores a partially-imputed allele.SamplestargSamples()Returns the list of target samples.
-
-
-
Method Detail
-
targSamples
public Samples targSamples()
Returns the list of target samples.- Returns:
- the list of target samples
-
markers
public Markers markers()
Returns the list of markers.- Returns:
- the list of markers
-
setHap
public void setHap(int hap, int[] alleles)Stores the specified haplotype.- Parameters:
hap- the haplotype indexalleles- the haplotype- Throws:
java.lang.IndexOutOfBoundsException- ifhap < 0 || hap >= 2*this.samples()java.lang.IllegalArgumentException- ifalleles.length != this.markers().nMarkers()java.lang.NullPointerException- ifalleles == null
-
setPartlyImputedAllele
public void setPartlyImputedAllele(int hap, int marker, float[] alProbs, IntList refHaps, FloatList stateProbs)Stores a partially-imputed allele. ifalProbs.length < this.markers().marker(marker).nAlleles(), the missing allele probabilities are assumed to be 0.0.- Parameters:
hap- the haplotype indexmarker- the marker indexalProbs- the posterior allele probabilities computed from a subset of HMM statesrefHaps- the list of reference haplotypes for HMM states not included in the specified allele probabilitiesstateProbs- the list of state probabilities for each HMM state in the specified list of reference haplotypes- Throws:
java.lang.IndexOutOfBoundsException- ifhap < 0 || hap >= 2 * this.targSamples().nSamples()java.lang.IndexOutOfBoundsException- ifmarker < 0 || marker >= this.markers().nMarkers()java.lang.IllegalArgumentException- ifrefHaps.size() != stateProbs.size()java.lang.NullPointerException- ifalProbs == null || refHaps == null || stateProbs == null
-
imputedHaps
public GT imputedHaps()
Returns the imputed haplotypes.- Returns:
- the imputed haplotypes
- Throws:
java.lang.NullPointerException- ifthis.setHap()has not previously been called for each haplotypehsatisfying(0 <= h && h <= 2 * this.targSamples().nSamples())
-
-