public final class EstPhase
extends java.lang.Object
Class EstPhase
stores haplotype pairs, missing genotypes,
and unphased, nonmissing heteroygote genotypes for a list of samples.
Instances of class EstPhase
are thread-safe.
Modifier and Type | Class | Description |
---|---|---|
class |
EstPhase.HapsGT |
Constructor | Description |
---|---|
EstPhase(GT gt,
java.util.List<LongArray> haps) |
Constructs a new
EstPhase instance from the specified data. |
Modifier and Type | Method | Description |
---|---|---|
IntArray |
getMissing(int sample) |
Returns a list of marker indices in increasing order for which
the specified sample has a missing genotype.
|
void |
getMissing(int sample,
boolean[] isMissing) |
Sets the
k -th entry of the specified isMissing array
to true if the specified sample's genotype at the
k -th marker is missing, and to false otherwise. |
IntArray |
getUnphasedHets(int sample) |
Returns a list of marker indices in increasing order for which
the specified sample has an unphased, non-missing heterozygote genotype.
|
void |
getUnphasedHets(int sample,
boolean[] isUnphased) |
Sets the
k -th entry of the specified isUnphased array
to true if the specified sample's genotype at the
k -th marker is an unphased, nonmissing heterozygote, and
to false otherwise. |
EstPhase.HapsGT |
hapsGT() |
|
boolean |
hasMissingGT(int sample) |
Returns
true if the specified sample has a missing genotype,
and returns false otherwise. |
boolean |
hasUnphasedHets(int sample) |
Returns
true if the specified sample has an unphased
heterozygote genotype, and returns false otherwise. |
Markers |
markers() |
Returns the list of markers.
|
int |
nMarkers() |
Returns the number of markers.
|
int |
nSamples() |
Returns the number of samples.
|
int |
nUnphasedHets(int sample) |
Returns the number of unphased, non-missing heterozygote
genotypes.
|
Samples |
samples() |
Returns the list of target samples.
|
void |
setHapPair(int sample,
int[] hap1,
int[] hap2) |
Sets the haplotype pair for the specified sample to the specified
haplotypes.
|
void |
setHapsWithMaskedMissingAlleles(int sample,
int[] hap1,
int[] hap2) |
Sets the
k -th element of the specified hap1 and
hap2 arrays to the specified sample's phased genotype
at the k -th marker if the genotype is nonmissing, and sets the
k -th element of hap1 and hap2 to
-1 otherwise. |
void |
setUnphasedHets(int sample,
IntArray newUnphased) |
Sets the array with marker indices of unphased, nonmissing heterozygote
genotypes to the specified array.
|
public EstPhase(GT gt, java.util.List<LongArray> haps)
EstPhase
instance from the specified data.
The haplotypes for the k
-th sample must be stored in
entries haps.get(2*k
} and haps.get(2*k + 1)
gt
- the observed genotype datahaps
- the initial haplotypes for each samplejava.lang.IllegalArgumentException
- if
gt.nSamples() != hapPairs.nSamples()
java.lang.IllegalArgumentException
- if
(hapPairs.get(s).idIndex!= this.gt().samples().idIndex(s))
for any s
satisfying (0 <= s && s < gt.nSamples())
java.lang.NullPointerException
- if gt == null || hapPairs == null
java.lang.NullPointerException
- if (hapPairs.get(j) == null)
for any
j
satisfying (0 <= j && j < hapPairs.size())
public int nSamples()
public Samples samples()
public int nMarkers()
public Markers markers()
public boolean hasUnphasedHets(int sample)
true
if the specified sample has an unphased
heterozygote genotype, and returns false
otherwise.sample
- the sample indextrue
if the specified sample has an unphased
heterozygote genotypejava.lang.IndexOutOfBoundsException
- if
sample < 0 || sample >= this.nSamples()
public int nUnphasedHets(int sample)
sample
- the sample indexjava.lang.IndexOutOfBoundsException
- if
sample < 0 || sample >= this.nSamples()
public IntArray getUnphasedHets(int sample)
sample
- the sample indexjava.lang.IndexOutOfBoundsException
- if
sample < 0 || sample >= this.nSamples()
public void setUnphasedHets(int sample, IntArray newUnphased)
sample
- the sample indexnewUnphased
- the marker indices of unphased heterozygote genotypesjava.lang.IllegalArgumentException
- if the specified newUnphased
list is not sorted in increasing order, contains a duplicate elements,
or is not a subset of this.getUnphased(sample)
.java.lang.IndexOutOfBoundsException
- if
sample < 0 || sample >= this.nSamples()
java.lang.NullPointerException
- if newUnphased == null
public void setHapPair(int sample, int[] hap1, int[] hap2)
sample
- the sample indexhap1
- an array whose k
-th entry is the estimated allele
carried by the sample's first haplotype.hap2
- an array whose k
-th entry is the estimated allele
carried by the sample's second haplotype.java.lang.IndexOutOfBoundsException
- if
sample < 0 || sample >= this.nSamples()
java.lang.IllegalArgumentException
- if
hap1.length != this.nMarkers() || hap2.length != this.nMarkers()
java.lang.IllegalArgumentException
- if
(hap1[k] < 0 || hap1[k] >= this.markers().marker(k).nAlleles())
for any k
satisfying (0 <= k && k < this.nMarkers())
java.lang.IllegalArgumentException
- if
(hap2[k] < 0 || hap2[k] >= this.markers().marker(k).nAlleles())
for any k
satisfying (0 <= k && k < this.nMarkers())
java.lang.NullPointerException
- if hap1 == null || hap2 == null
public void getUnphasedHets(int sample, boolean[] isUnphased)
k
-th entry of the specified isUnphased
array
to true
if the specified sample's genotype at the
k
-th marker is an unphased, nonmissing heterozygote, and
to false
otherwise.sample
- the sample indexisUnphased
- an array whose k
-th entry
will be set to true
if the specified sample's genotype at the
k
-th marker is an unphased, nonmissing heterozygote,
and to false
otherwise.java.lang.IllegalArgumentException
- if
isUnphased.length != this.nMarkers()
java.lang.IndexOutOfBoundsException
- if
sample < 0 || sample >= this.nSamples()
java.lang.NullPointerException
- if isUnphased == null
public boolean hasMissingGT(int sample)
true
if the specified sample has a missing genotype,
and returns false
otherwise.sample
- the sample indextrue
if the specified sample has a missing genotypejava.lang.IndexOutOfBoundsException
- if
sample < 0 || sample >= this.nSamples()
public IntArray getMissing(int sample)
sample
- the sample indexjava.lang.IndexOutOfBoundsException
- if
sample < 0 || sample >= this.nSamples()
public void getMissing(int sample, boolean[] isMissing)
k
-th entry of the specified isMissing
array
to true
if the specified sample's genotype at the
k
-th marker is missing, and to false
otherwise.sample
- the sample indexisMissing
- an array whose k
-th entry will be
set to true
if the specified sample's genotype at the
k
-th marker is missing and to false
otherwisejava.lang.IllegalArgumentException
- if
isMissing.length != this.nMarkers()
java.lang.IndexOutOfBoundsException
- if
sample < 0 || sample >= this.nSamples()
java.lang.NullPointerException
- if isMissing == null
public void setHapsWithMaskedMissingAlleles(int sample, int[] hap1, int[] hap2)
k
-th element of the specified hap1
and
hap2
arrays to the specified sample's phased genotype
at the k
-th marker if the genotype is nonmissing, and sets the
k
-th element of hap1
and hap2
to
-1
otherwise.sample
- the sample indexhap1
- an array whose k
-th entry will be set to the
current estimated allele carried by the sample's first haplotype if the
observed genotype is non-missing and to -1 otherwise.hap2
- an array whose k
-th entry will be set to the
current estimated allele carried by the sample's second haplotype if the
observed genotype is non-missing and to -1 otherwise.java.lang.IllegalArgumentException
- if
hap1.length != this.nMarkers()
java.lang.IllegalArgumentException
- if
hap2.length != this.nMarkers()
java.lang.IndexOutOfBoundsException
- if
sample < 0 || sample >= this.nSamples()
java.lang.NullPointerException
- if hap1 == null || hap2 == null
public EstPhase.HapsGT hapsGT()