public final class BitSetRefGT extends java.lang.Object implements VcfEmission
Class BitSetRefGT
represents genotype emission
probabilities for a list reference samples with phased, non-missing
genotypes at a single marker.
The genotype emission probabilities are determined by the called
genotypes for the reference samples.
Class BitSetRefGT
stores alleles using
java.util.BitSet
objects.
Instances of class BitSetRefGT
are immutable.
Constructor and Description |
---|
BitSetRefGT(VcfHeader vcfHeader,
java.lang.String vcfRecord)
Creates a new
BitSetRefGT instance from a VCF record
storing phased, non-missing reference genotypes. |
BitSetRefGT(VcfRecGTParser gtp)
Creates a new
VcfEmission instance from a VCF record
containing phased, non-missing genotypes for a list of reference samples. |
Modifier and Type | Method and Description |
---|---|
int |
allele(int hap)
Returns the allele on the specified haplotype or -1 if the
allele is missing.
|
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.
|
float |
gl(int sample,
int allele1,
int allele2)
Returns the probability of the observed data if the specified pair
of ordered alleles is the true genotype in the specified sample.
|
int |
hapIndex(int allele,
int copy)
Returns index of the haplotype that carries the specified copy of the
specified allele.
|
boolean |
isPhased(int sample)
Returns
true if the genotype emission probabilities for
the specified sample are determined by a phased, nonmissing genotype,
and returns false otherwise. |
boolean |
isRefData()
Returns
true if the genotype emission probabilities
for each sample are determined by a phased called genotype
that has no missing alleles, and returns false otherwise. |
int |
majorAllele()
Returns the index of the major allele.
|
Marker |
marker()
Returns the marker.
|
int |
nAlleles()
Returns the number of marker alleles.
|
int |
nHapPairs()
Returns the number of haplotype pairs.
|
int |
nHaps()
Returns the number of haplotypes.
|
int |
nSamples()
Returns the number of samples.
|
Samples |
samples()
Returns the samples.
|
boolean |
storesNonMajorIndices()
Returns
true if this instance stores the indices of haplotypes
that carry non-major alleles, and returns false otherwise. |
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
toVcfRec
public BitSetRefGT(VcfHeader vcfHeader, java.lang.String vcfRecord)
BitSetRefGT
instance from a VCF record
storing phased, non-missing reference genotypes.vcfHeader
- meta-information lines and header line for the
specified VCF recordvcfRecord
- a VCF record corresponding to the specified
vcfHeader
objectjava.lang.IllegalArgumentException
- if a format error is detected
in the VCF record or if any allele is missing or unphasedjava.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 BitSetRefGT(VcfRecGTParser gtp)
VcfEmission
instance from a VCF record
containing phased, non-missing genotypes for a list of reference samples.gtp
- a parser for the VCF recordjava.lang.IllegalArgumentException
- if a format error, a missing genotype,
or an unphased genotype is detected in the VCF recordjava.lang.NullPointerException
- if gtp==null
public boolean isPhased(int sample)
VcfEmission
true
if the genotype emission probabilities for
the specified sample are determined by a phased, nonmissing genotype,
and returns false
otherwise.isPhased
in interface VcfEmission
sample
- the sample indextrue
if the genotype emission probabilities
for the specified sample are determined by a phased, nonmissing genotypepublic Samples samples()
samples
in interface VcfEmission
public int nSamples()
VcfEmission
nSamples
in interface VcfEmission
public int nHaps()
HapsMarker
2*this.nHapPairs()
.nHaps
in interface HapsMarker
public int nHapPairs()
HapsMarker
this.nHaps()/2
.nHapPairs
in interface HapsMarker
public Marker marker()
HapsMarker
marker
in interface HapsMarker
marker
in interface MarkerContainer
public boolean isRefData()
VcfEmission
true
if the genotype emission probabilities
for each sample are determined by a phased called genotype
that has no missing alleles, and returns false
otherwise.isRefData
in interface VcfEmission
true
if the genotype emission probabilities
for each sample are determined by a phased called genotype
that has no missing allelespublic float gl(int sample, int allele1, int allele2)
VcfEmission
gl
in interface VcfEmission
sample
- the sample indexallele1
- the first allele indexallele2
- the second allele indexpublic int allele1(int sample)
VcfEmission
allele1
in interface HapsMarker
allele1
in interface VcfEmission
sample
- the sample indexpublic int allele2(int sample)
VcfEmission
allele2
in interface HapsMarker
allele2
in interface VcfEmission
sample
- the sample indexpublic int allele(int hap)
VcfEmission
allele
in interface HapsMarker
allele
in interface VcfEmission
hap
- the haplotype indexpublic int nAlleles()
VcfEmission
nAlleles
in interface VcfEmission
public boolean storesNonMajorIndices()
VcfEmission
true
if this instance stores the indices of haplotypes
that carry non-major alleles, and returns false
otherwise.storesNonMajorIndices
in interface VcfEmission
true
if this instance stores the indices of haplotypes
that carry non-major alleles, and returns false
otherwisepublic int majorAllele()
VcfEmission
majorAllele
in interface VcfEmission
public int alleleCount(int allele)
VcfEmission
alleleCount
in interface VcfEmission
allele
- an allele indexpublic int hapIndex(int allele, int copy)
VcfEmission
hapIndex
in interface VcfEmission
allele
- an allele indexcopy
- a copy indexpublic 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