Package phase
Class EstPhase
- java.lang.Object
-
- phase.EstPhase
-
public final class EstPhase extends java.lang.ObjectClass
EstPhasestores original input genotype data. the current estimated haplotype pair for each target sample, a list of missing genotypes for each target sample, and a list of remaining unphased heterozygote genotypes for each target sample.Instances of class
EstPhaseare thread-safe.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidgetHaps(int sample, int[] hap1, int[] hap2)Sets thek-th element of the specifiedhap1andhap2arrays to the specified sample's phased genotype at thek-th marker.HapsGThapsGT()Returns the current estimated phased genotypes for the target samples.IntArraymissing(int sample)Returns a list of marker indices in increasing order for which the specified sample has a missing genotype.voidsetHapPair(int sample, int[] hap1, int[] hap2)Sets the haplotype pair for the specified sample to the specified haplotypes.voidsetUnphased(int sample, IntArray newUnphased)Sets the list of remaining marker indices with unphased heterozygote genotypes for the specified sample to the specified listGTtargGT()Returns the input target genotype data.IntArrayunphased(int sample)Returns a list of remaining marker indices in increasing order for which the specified sample has an unphased heterozygote genotype.
-
-
-
Constructor Detail
-
EstPhase
public EstPhase(GT targGT, RefGT refGT, int overlap, long seed)
Constructs a newEstPhaseinstance from the specified data.- Parameters:
targGT- the original input target genotype datarefGT- the reference genotype data ornullif there are no reference samplesoverlap- the number of initial markers with phased, non-missing genotypes due to overlap with the previous marker windowseed- the seed for random number generation- Throws:
java.lang.IllegalArgumentException- ifrefGT != null && targGT.markers().equals(refGT.markers()) == falsejava.lang.IllegalArgumentException- ifoverlap < 0java.lang.NullPointerException- iftargGT == null
-
-
Method Detail
-
targGT
public GT targGT()
Returns the input target genotype data.- Returns:
- the input target genotype data
-
unphased
public IntArray unphased(int sample)
Returns a list of remaining marker indices in increasing order for which the specified sample has an unphased heterozygote genotype.- Parameters:
sample- the sample index- Returns:
- a list of remaining marker indices in increasing order for which the specified sample has an unphased heterozygote genotype
- Throws:
java.lang.IndexOutOfBoundsException- ifsample < 0 || sample >= this.nSamples()
-
setUnphased
public void setUnphased(int sample, IntArray newUnphased)Sets the list of remaining marker indices with unphased heterozygote genotypes for the specified sample to the specified list- Parameters:
sample- the sample indexnewUnphased- a list of remaining marker indices with unphased heterozygote genotypes- Throws:
java.lang.IllegalArgumentException- if the specifiednewUnphasedlist is not sorted in increasing order, contains a duplicate elements, or is not a subset ofthis.getUnphased(sample).java.lang.IndexOutOfBoundsException- ifsample < 0 || sample >= this.targGT().nSamples()java.lang.NullPointerException- ifnewUnphased == null
-
missing
public IntArray missing(int sample)
Returns a list of marker indices in increasing order for which the specified sample has a missing genotype.- Parameters:
sample- the sample index- Returns:
- a list of marker indices in increasing order for which the specified sample has a missing genotype
- Throws:
java.lang.IndexOutOfBoundsException- ifsample < 0 || sample >= this.targGT().nSamples()
-
setHapPair
public void setHapPair(int sample, int[] hap1, int[] hap2)Sets the haplotype pair for the specified sample to the specified haplotypes.- Parameters:
sample- the sample indexhap1- an array whose elements are the estimated alleles carried by the sample's first haplotype.hap2- an array whose elements are the estimated alleles carried by the sample's second haplotype.- Throws:
java.lang.IndexOutOfBoundsException- ifsample < 0 || sample >= this.targGT().nSamples()java.lang.IllegalArgumentException- ifhap1.length != this.targGT().nMarkers()java.lang.IllegalArgumentException- ifhap2.length != this.targGT().nMarkers()java.lang.IllegalArgumentException- if(hap1[k] < 0 || hap1[k] >= this.targGT().marker(k).nAlleles())for anyksatisfying(0 <= k && k < this.targGT().nMarkers())java.lang.IllegalArgumentException- if(hap2[k] < 0 || hap2[k] >= this.targGT().marker(k).nAlleles())for anyksatisfying(0 <= k && k < this.targGT().nMarkers())java.lang.NullPointerException- ifhap1 == null || hap2 == null
-
getHaps
public void getHaps(int sample, int[] hap1, int[] hap2)Sets thek-th element of the specifiedhap1andhap2arrays to the specified sample's phased genotype at thek-th marker.- Parameters:
sample- the sample indexhap1- an array whose elements will be set to the current estimated alleles carried by the sample's first haplotype.hap2- an array whose elements will be set to the current estimated allele carried by the sample's second haplotype.- Throws:
java.lang.IndexOutOfBoundsException- ifhap1.length != this.targGT().nMarkers()java.lang.IndexOutOfBoundsException- ifhap2.length != this.targGT().nMarkers()java.lang.IndexOutOfBoundsException- ifsample < 0 || sample >= this.targGT().nSamples()java.lang.NullPointerException- ifhap1 == null || hap2 == null
-
hapsGT
public HapsGT hapsGT()
Returns the current estimated phased genotypes for the target samples.- Returns:
- the current estimated phased genotypes for the target samples
-
-