IntArray, DuplicatesGTRec, GTRec, MarkerContainer, RefGTRecpublic final class LowMafRefDiallelicGT extends java.lang.Object implements RefGTRec
Class LowMafRefDiallelicGT represent represents phased,
non-missing genotypes for a list of reference samples at a single diallelic
marker. Genotype emission probabilities are determined by the sample
genotypes.
Class LowMafRefDiallelicGT stores the minor allele indices.
Instances of class LowMemRefDiallelicGT are immutable.
| Constructor | Description |
|---|---|
LowMafRefDiallelicGT(Marker marker,
Samples samples,
int[][] hapIndices) |
Constructs a new
LowMafRefDiallelicGT instance from the
specified data. |
LowMafRefDiallelicGT(RefGTRec rec) |
Constructs a new
LowMafRefDiallelicGT instance with phased
non-missing genotypes from the specified data. |
LowMafRefDiallelicGT(VcfRecGTParser gtp) |
Constructs a new
LowMafRefDiallelicGT instance with phased
non-missing genotypes from the specified data. |
| Modifier and Type | Method | Description |
|---|---|---|
int |
allele1(int sample) |
Returns the first allele for the specified sample or
-1 if the allele is missing.
|
int |
allele2(int sample) |
Returns the second allele for the specified sample or
-1 if the allele is missing.
|
int |
alleleCount(int allele) |
Returns the number of haplotypes that carry the specified allele.
|
int[] |
alleles() |
Returns an array of length
this.size() whose j-th
element is equal to this.allele(j} |
int |
get(int hap) |
Returns the specified allele for the specified haplotype or
-1 if the allele is missing.
|
float |
gl(int sample,
int allele1,
int allele2) |
Returns the probability of the observed data for the specified sample
if the specified pair of ordered alleles is the true ordered genotype.
|
int |
hapIndex(int allele,
int copy) |
Returns index of the haplotype that carries the specified copy of the
specified allele.
|
int[][] |
hapIndices() |
Returns an array whose
j-th element is null
if j is the major allele with lowest index, and otherwise is
an array of indices of haplotypes that carry the j-th allele
sorted in increasing order |
boolean |
isAlleleCoded() |
Returns
true if this instance stores the indices of haplotypes
that carry non-major alleles, and returns false otherwise. |
boolean |
isCarrier(int allele,
int hap) |
Returns
true if the specified haplotype carries the specified
allele and return false otherwise. |
boolean |
isGTData() |
Returns
true if the value returned by this.gl() is
determined by a called or missing genotype, and returns false
otherwise. |
boolean |
isPhased() |
Returns
true. |
boolean |
isPhased(int sample) |
Returns
true. |
int |
majorAllele() |
Returns the index of the major allele.
|
IntArray |
map(int index) |
Returns
this.maps()[index]. |
IntArray[] |
maps() |
Returns an array of maps, which when composed map haplotype indices
to values.
|
Marker |
marker() |
Returns the marker.
|
int |
nAlleles() |
Returns the number of marker alleles.
|
int |
nMaps() |
Returns
this.maps().length |
int |
nSamples() |
Returns the number of samples.
|
Samples |
samples() |
Returns the list of samples.
|
int |
size() |
Returns the number of haplotypes.
|
java.lang.String |
toString() |
Returns the data represented by
this as a VCF
record with a GT format field. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic LowMafRefDiallelicGT(RefGTRec rec)
LowMafRefDiallelicGT instance with phased
non-missing genotypes from the specified data.rec - the phased, non-missing genotype datajava.lang.IllegalArgumentException - if rec.marker().nAlleles() != 2java.lang.NullPointerException - if rec == nullpublic LowMafRefDiallelicGT(VcfRecGTParser gtp)
LowMafRefDiallelicGT instance with phased
non-missing genotypes from the specified data.gtp - a VCF record parser that extracts sample genotypesjava.lang.IllegalArgumentException - if the VCF record contains an
unphased genotype or missing allelejava.lang.IllegalArgumentException - if gtp.nAlleles() != 2java.lang.IllegalArgumentException - if a format error is detected in the
VCF recordjava.lang.NullPointerException - if gtp == nullpublic LowMafRefDiallelicGT(Marker marker, Samples samples, int[][] hapIndices)
LowMafRefDiallelicGT instance from the
specified data. The contract for this class is unspecified if a
haplotype index is duplicated in the specified hapIndices array.marker - the markersamples - the sampleshapIndices - an array whose j-th element is null
if j is the major allele with lowest index, and otherwise is
an array of indices of haplotypes that carry the j-th allele
sorted in increasing orderjava.lang.IllegalArgumentException - if marker.nAlleles() != 2java.lang.IllegalArgumentException - if the (hapIndices[j] == null)
and j is not the major allele with lowest index, or if
(hapIndices[j] != null) and j is the major allele with
lowest indexjava.lang.IllegalArgumentException - if any element of hapIndices
is not not a sorted array of distinct haplotype indices
between 0 (inclusive) and 2*samples.nSamples() (exclusive)java.lang.IllegalArgumentException - if
marker.nAlleles() != hapIndices.lengthjava.lang.NullPointerException - if
marker == null || samples == null || hapIndices == nullpublic int[][] hapIndices()
RefGTRecj-th element is null
if j is the major allele with lowest index, and otherwise is
an array of indices of haplotypes that carry the j-th allele
sorted in increasing orderhapIndices in interface RefGTRecj-th element is null
if j is the major allele with lowest index, and otherwise is
an array of indices of haplotypes that carry the j-th allele
sorted in increasing orderpublic boolean isPhased(int sample)
RefGTRectrue.isPhased in interface DuplicatesGTRecisPhased in interface RefGTRecsample - the sample indextruepublic boolean isPhased()
true.isPhased in interface DuplicatesGTRecisPhased in interface RefGTRectruepublic Samples samples()
GTRecpublic int nSamples()
DuplicatesGTRecthis.size()/2.nSamples in interface DuplicatesGTRecpublic int size()
DuplicatesGTRec2*this.nSamples().size in interface DuplicatesGTRecsize in interface IntArraypublic Marker marker()
MarkerContainermarker in interface MarkerContainerpublic boolean isGTData()
GTRectrue if the value returned by this.gl() is
determined by a called or missing genotype, and returns false
otherwise.public float gl(int sample,
int allele1,
int allele2)
GTRecpublic int allele1(int sample)
DuplicatesGTRecthis.unphased(marker, sample) == false.allele1 in interface DuplicatesGTRecsample - a sample indexpublic int allele2(int sample)
DuplicatesGTRecthis.unphased(marker, sample) == false.allele2 in interface DuplicatesGTRecsample - a sample indexpublic int get(int hap)
DuplicatesGTRecthis.unphased(marker, hap/2) == false.get in interface DuplicatesGTRecget in interface IntArrayhap - a haplotype indexpublic int[] alleles()
DuplicatesGTRecthis.size() whose j-th
element is equal to this.allele(j}alleles in interface DuplicatesGTRecthis.size() whose j-th
element is equal to this.allele(j}public int nAlleles()
MarkerContainernAlleles in interface MarkerContainerpublic boolean isAlleleCoded()
RefGTRectrue if this instance stores the indices of haplotypes
that carry non-major alleles, and returns false otherwise.isAlleleCoded in interface RefGTRectrue if this instance stores the indices of haplotypes
that carry non-major allelespublic int majorAllele()
RefGTRecmajorAllele in interface RefGTRecpublic int alleleCount(int allele)
RefGTRecalleleCount in interface RefGTRecallele - an allele indexpublic int hapIndex(int allele,
int copy)
RefGTRecpublic boolean isCarrier(int allele,
int hap)
RefGTRectrue if the specified haplotype carries the specified
allele and return false otherwise.public java.lang.String toString()
this as a VCF
record with a GT format field. The returned VCF record
will have missing QUAL and INFO fields, will have "PASS"
in the filter field, and will have a GT format field.toString in class java.lang.Objectthis as a VCF
record with a GT format fieldpublic int nMaps()
RefGTRecthis.maps().lengthpublic IntArray[] maps()
RefGTRech is determined
by the following calculation:
IntArray[] maps = this.maps();
int value = maps[0].get(h);
for (int j=1; j<maps.length; ++j) {
value = indexArrays[j].get(value);
}
int allele = value