IntArray
, DuplicatesGTRec
, GTRec
, MarkerContainer
, RefGTRec
public class SeqCodedRefGT extends java.lang.Object implements RefGTRec
Class SeqCodedRefGT
represents phased, non-missing
genotypes for a list of reference samples at a single marker.
Genotype emission probabilities are determined by the sample
genotypes.
Instances of class SeqCodedRefGT
are immutable.
Constructor | Description |
---|---|
SeqCodedRefGT(Marker marker,
Samples samples,
IntArray hapToSeq,
IntArray seqToAllele) |
Creates a new
SeqCodedRefGT instance with phased,
non-missing genotypes from the specified marker, samples,
and haplotype alleles. |
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 SeqCodedRefGT(Marker marker, Samples samples, IntArray hapToSeq, IntArray seqToAllele)
SeqCodedRefGT
instance with phased,
non-missing genotypes from the specified marker, samples,
and haplotype alleles. The contract for the constructed object
is undefined if any element of hapToSeq
is negative or
greater than or equal to seqToAllele.size()
or if any element
of seqToAllele
is negative or greater than or equal to
marker.nAlleles()
.marker
- the markersamples
- the sampleshapToSeq
- an array whose j
-th element is the index
of the distinct allele sequence carried by the j
-th haplotypeseqToAllele
- an array whose j
-th element is the marker
allele carried by the j
-th distinct allele sequencejava.lang.IllegalArgumentException
- if
hapToSeq.size() != 2*samples.nSamples()
java.lang.NullPointerException
- if any parameter is null
public 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 int nSamples()
DuplicatesGTRec
this.size()/2
.nSamples
in interface DuplicatesGTRec
public Samples samples()
GTRec
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[][] 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 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 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 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