IntArray
, DuplicatesGTRec
, GTRec
, MarkerContainer
public final class BitSetGT extends java.lang.Object implements GTRec
Class BitSetGT
represents genotype emission
probabilities for a list of samples at a single marker.
The genotype emission probabilities are determined by the called
genotypes for the samples.
Class BitSetGT
stores alleles using
java.util.BitSet
objects.
Instances of class BitSetGT
are immutable.
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
GT_FORMAT |
The VCF FORMAT code for genotype data: "GT".
|
Constructor | Description |
---|---|
BitSetGT(VcfHeader vcfHeader,
java.lang.String vcfRecord) |
Constructs a new
BitSetGT instance representing
the specified VCF record's GT format field 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[] |
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 a1,
int a2) |
Returns the probability of the observed data for the specified sample
if the specified pair of ordered alleles is the true ordered genotype.
|
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 if every genotype for each sample is a phased,
non-missing genotype, and returns false otherwise. |
boolean |
isPhased(int sample) |
Returns
true if the genotype for the specified sample is
a phased, nonmissing genotype, and returns false otherwise. |
Marker |
marker() |
Returns the marker.
|
int |
nAlleles() |
Returns the number of marker alleles.
|
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. |
public static final java.lang.String GT_FORMAT
public BitSetGT(VcfHeader vcfHeader, java.lang.String vcfRecord)
BitSetGT
instance representing
the specified VCF record's GT format field data.vcfHeader
- meta-information lines and header line for the
specified VCF record.vcfRecord
- a VCF record corresponding to the specified
vcfHeader
objectjava.lang.IllegalArgumentException
- if a format error is detected
in the VCF recordjava.lang.IllegalArgumentException
- if rec.nSamples() == 0
java.lang.IllegalArgumentException
- if the header line
or VCF record does not have a "GT" format fieldjava.lang.NullPointerException
- if
vcfHeader == null || vcfRecord == null
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 isPhased()
DuplicatesGTRec
true
if every genotype for each sample is a phased,
non-missing genotype, and returns false
otherwise.isPhased
in interface DuplicatesGTRec
true
if the genotype for each sample is a phased,
non-missing genotypepublic boolean isGTData()
GTRec
true
if the value returned by this.gl()
is
determined by a called or missing genotype, and returns false
otherwise.public boolean isPhased(int sample)
DuplicatesGTRec
true
if the genotype for the specified sample is
a phased, nonmissing genotype, and returns false
otherwise.isPhased
in interface DuplicatesGTRec
sample
- a sample indextrue
if the genotype for the specified sample
is a phased, nonmissing genotypepublic 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 float gl(int sample, int a1, int a2)
GTRec
public 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 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 field