public class ConstrainedAlleleProbs extends java.lang.Object implements AlleleProbs
Class ConstrainedAlleleProbs is a wrapper for an
AlleleProbs instance that changes the wrapped haplotype allele
probabilities for a subset of markers.
Instances of class ConstrainedAlleleProbs are immutable.
| Constructor and Description |
|---|
ConstrainedAlleleProbs(SampleHapPairs shp,
AlleleProbs alProbs,
int[] indexMap)
Construct a new
ConstrainedAlleleProbs instance. |
| Modifier and Type | Method and Description |
|---|---|
int |
allele1(int marker,
int sample)
Returns the marker allele with maximum probability for the
first haplotype of the specified sample.
|
int |
allele2(int marker,
int sample)
Returns the marker allele with maximum probability for the
second haplotype of the specified sample.
|
float |
alProb1(int marker,
int sample,
int allele)
Returns the probability that the specified marker allele is
present on the first haplotype of the specified sample.
|
float |
alProb2(int marker,
int sample,
int allele)
Returns the probability that the specified marker allele is
present on the second haplotype of the specified sample.
|
float |
gtProb(int marker,
int sample,
int allele1,
int allele2)
Returns the phased genotype probability, equal to
(this.allele1(marker, sample, allele1)
* this.allele2(marker, sample, allele2)). |
boolean |
isImputed(int marker)
Returns
true if the specified marker is not present in the
input data and returns false otherwise. |
Marker |
marker(int marker)
Returns the specified marker.
|
Markers |
markers()
Returns the list of markers.
|
int |
nMarkers()
Returns the number of markers.
|
int |
nSamples()
Returns the number of samples.
|
Samples |
samples()
Returns the list of samples.
|
public ConstrainedAlleleProbs(SampleHapPairs shp, AlleleProbs alProbs, int[] indexMap)
ConstrainedAlleleProbs instance. The alleles
in the specified SampleHapPairs object will
have probability 1 in the new ConstrainedAlleleProbs object.
All other allele probabilities in the constructed object
are determined by the wrapped AlleleProbs object.shp - phased haplotype pairs for a subset of markersalProbs - the allele probabilitiesindexMap - an array of length alProbs.nMarkers()
whose j-th element is the index of marker
alProbs.marker(j) in shp.markers(), or is -1 if the
marker is not present in shp.markers()java.lang.IllegalArgumentException - if
alProbs.nMarkers() != indexMap.lengthjava.lang.IllegalArgumentException - if
(indexMap[j] != -1
&& alProbs.marker(j).equals(shp.marker(indexMap[j])) == false)
for any j satisfying (0 <= j && j < indexMap.length)java.lang.NullPointerException - if
shp == null || alProbs == null || indexMap == nullpublic boolean isImputed(int marker)
true if the specified marker is not present in the
input data and returns false otherwise.marker - a marker indextrue if the specified marker is not present in the
input target datajava.lang.IndexOutOfBoundsException - if
marker < 0 || marker >= this.nMarkers()public float alProb1(int marker,
int sample,
int allele)
AlleleProbsalProb1 in interface AlleleProbsmarker - a marker indexsample - a sample indexallele - an allele indexpublic float alProb2(int marker,
int sample,
int allele)
AlleleProbsalProb2 in interface AlleleProbsmarker - a marker indexsample - a sample indexallele - an allele indexpublic float gtProb(int marker,
int sample,
int allele1,
int allele2)
AlleleProbs(this.allele1(marker, sample, allele1)
* this.allele2(marker, sample, allele2)).gtProb in interface AlleleProbsmarker - a marker indexsample - a sample indexallele1 - allele index of the allele on the first haplotypeallele2 - allele index of the allele on the second haplotype(this.allele1(marker, sample, allele1)
* this.allele2(marker, sample, allele2))public int allele1(int marker,
int sample)
AlleleProbsallele1 in interface AlleleProbsmarker - a marker indexsample - a sample indexpublic int allele2(int marker,
int sample)
AlleleProbsallele2 in interface AlleleProbsmarker - a marker indexsample - a sample indexpublic int nMarkers()
AlleleProbsnMarkers in interface AlleleProbspublic Markers markers()
AlleleProbsmarkers in interface AlleleProbspublic Marker marker(int marker)
AlleleProbsmarker in interface AlleleProbsmarker - a marker indexpublic int nSamples()
AlleleProbsnSamples in interface AlleleProbspublic Samples samples()
AlleleProbssamples in interface AlleleProbs