IntArray
, DuplicatesGTRec
, GTRec
, MarkerContainer
, RefGTRec
public final class LowMafRefGT extends java.lang.Object implements RefGTRec
Class LowMafRefGT
represent represents phased, non-missing
genotypes for a list of reference samples at a single marker.
Genotype emission probabilities are determined by the sample
genotypes.
Class LowMafRefGT
stores the non-major allele indices.
Instances of class LowMemRefGT
are immutable.
Constructor | Description |
---|---|
LowMafRefGT(Marker marker,
Samples samples,
int[][] hapIndices) |
Constructs a new
LowMafRefGT instance from the specified data. |
LowMafRefGT(RefGTRec rec) |
Constructs a new
LowMafRefGT instance with phased
non-missing genotypes from the specified data. |
LowMafRefGT(VcfRecGTParser gtp) |
Constructs a new
LowMafRefGT instance with phased
non-missing genotypes from the specified VcfRecGTParser
object. |
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, wait
public LowMafRefGT(RefGTRec rec)
LowMafRefGT
instance with phased
non-missing genotypes from the specified data.rec
- the phased, non-missing genotype datajava.lang.NullPointerException
- if rec == null
public LowMafRefGT(VcfRecGTParser gtp)
LowMafRefGT
instance with phased
non-missing genotypes from the specified VcfRecGTParser
object.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 a format error is detected in the
VCF recordjava.lang.NullPointerException
- if gtp == null
public LowMafRefGT(Marker marker, Samples samples, int[][] hapIndices)
LowMafRefGT
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 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.length
java.lang.NullPointerException
- if
marker == null || samples == null || hapIndices == null
public int[][] hapIndices()
RefGTRec
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 orderhapIndices
in interface RefGTRec
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 orderpublic boolean isPhased(int sample)
RefGTRec
true
.isPhased
in interface DuplicatesGTRec
isPhased
in interface RefGTRec
sample
- the sample indextrue
public boolean isPhased()
true
.isPhased
in interface DuplicatesGTRec
isPhased
in interface RefGTRec
true
public Samples samples()
GTRec
public int nSamples()
DuplicatesGTRec
this.size()/2
.nSamples
in interface DuplicatesGTRec
public int size()
DuplicatesGTRec
2*this.nSamples()
.size
in interface DuplicatesGTRec
size
in interface IntArray
public Marker marker()
MarkerContainer
marker
in interface MarkerContainer
public boolean isGTData()
GTRec
true
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)
GTRec
public int allele1(int sample)
DuplicatesGTRec
this.unphased(marker, sample) == false
.allele1
in interface DuplicatesGTRec
sample
- a sample indexpublic int allele2(int sample)
DuplicatesGTRec
this.unphased(marker, sample) == false
.allele2
in interface DuplicatesGTRec
sample
- a sample indexpublic int get(int hap)
DuplicatesGTRec
this.unphased(marker, hap/2) == false
.get
in interface DuplicatesGTRec
get
in interface IntArray
hap
- a haplotype indexpublic int[] alleles()
DuplicatesGTRec
this.size()
whose j
-th
element is equal to this.allele(j
}alleles
in interface DuplicatesGTRec
this.size()
whose j
-th
element is equal to this.allele(j
}public int nAlleles()
MarkerContainer
nAlleles
in interface MarkerContainer
public boolean isAlleleCoded()
RefGTRec
true
if this instance stores the indices of haplotypes
that carry non-major alleles, and returns false
otherwise.isAlleleCoded
in interface RefGTRec
true
if this instance stores the indices of haplotypes
that carry non-major allelespublic int majorAllele()
RefGTRec
majorAllele
in interface RefGTRec
public int alleleCount(int allele)
RefGTRec
alleleCount
in interface RefGTRec
allele
- an allele indexpublic int hapIndex(int allele, int copy)
RefGTRec
public boolean isCarrier(int allele, int hap)
RefGTRec
true
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.Object
this
as a VCF
record with a GT format fieldpublic int nMaps()
RefGTRec
this.maps().length
public IntArray[] maps()
RefGTRec
h
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