Package vcf
Class BitSetGTRec
- java.lang.Object
-
- vcf.BitSetGTRec
-
- All Implemented Interfaces:
IntArray,DuplicatesGTRec,GTRec,MarkerContainer
public final class BitSetGTRec extends java.lang.Object implements GTRec
Class
BitSetGTrepresents 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.Instances of class
BitSetGTare immutable.
-
-
Constructor Summary
Constructors Constructor Description BitSetGTRec(VcfHeader vcfHeader, java.lang.String vcfRecord)Constructs a newBitSetGTinstance representing the specified VCF record's GT format field data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intallele1(int sample)Returns the first allele for the specified sample or -1 if the allele is missing.intallele2(int sample)Returns the second allele for the specified sample or -1 if the allele is missing.int[]alleles()Returns an array of lengththis.size()whosej-th element is equal tothis.allele(j}intget(int hap)Returns the specified allele for the specified haplotype or -1 if the allele is missing.floatgl(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.booleanisGTData()Returnstrueif the value returned bythis.gl()is determined by a called or missing genotype, and returnsfalseotherwise.booleanisPhased()Returnstrueif every genotype for each sample is a phased, non-missing genotype, and returnsfalseotherwise.booleanisPhased(int sample)Returnstrueif the genotype for the specified sample has non-missing alleles and is either haploid or diploid with a phased allele separator, and returnsfalseotherwise.Markermarker()Returns the marker.intnAlleles()Returns the number of marker alleles.intnSamples()Returns the number of samples.Samplessamples()Returns the list of samples.intsize()Returns the number of haplotypes.java.lang.StringtoString()Returns the data represented bythisas a VCF record with a GT format field.
-
-
-
Constructor Detail
-
BitSetGTRec
public BitSetGTRec(VcfHeader vcfHeader, java.lang.String vcfRecord)
Constructs a newBitSetGTinstance representing the specified VCF record's GT format field data.- Parameters:
vcfHeader- meta-information lines and header line for the specified VCF record.vcfRecord- a VCF record corresponding to the specifiedvcfHeaderobject- Throws:
java.lang.IllegalArgumentException- if a format error is detected in the VCF recordjava.lang.IllegalArgumentException- ifrec.nSamples() == 0java.lang.IllegalArgumentException- if the header line or VCF record does not have a "GT" format fieldjava.lang.NullPointerException- ifvcfHeader == null || vcfRecord == null
-
-
Method Detail
-
nSamples
public int nSamples()
Description copied from interface:DuplicatesGTRecReturns the number of samples. The returned value is equal tothis.size()/2.- Specified by:
nSamplesin interfaceDuplicatesGTRec- Returns:
- the number of samples
-
samples
public Samples samples()
Description copied from interface:GTRecReturns the list of samples.
-
size
public int size()
Description copied from interface:DuplicatesGTRecReturns the number of haplotypes. The returned value is equal to2*this.nSamples().- Specified by:
sizein interfaceDuplicatesGTRec- Specified by:
sizein interfaceIntArray- Returns:
- the number of haplotypes
-
marker
public Marker marker()
Description copied from interface:MarkerContainerReturns the marker.- Specified by:
markerin interfaceMarkerContainer- Returns:
- the marker
-
isPhased
public boolean isPhased()
Description copied from interface:DuplicatesGTRecReturnstrueif every genotype for each sample is a phased, non-missing genotype, and returnsfalseotherwise.- Specified by:
isPhasedin interfaceDuplicatesGTRec- Returns:
trueif the genotype for each sample is a phased, non-missing genotype
-
isGTData
public boolean isGTData()
Description copied from interface:GTRecReturnstrueif the value returned bythis.gl()is determined by a called or missing genotype, and returnsfalseotherwise.
-
isPhased
public boolean isPhased(int sample)
Description copied from interface:DuplicatesGTRecReturnstrueif the genotype for the specified sample has non-missing alleles and is either haploid or diploid with a phased allele separator, and returnsfalseotherwise.- Specified by:
isPhasedin interfaceDuplicatesGTRec- Parameters:
sample- a sample index- Returns:
trueif the genotype for the specified sample is a phased, nonmissing genotype
-
allele1
public int allele1(int sample)
Description copied from interface:DuplicatesGTRecReturns the first allele for the specified sample or -1 if the allele is missing. The two alleles for a sample are arbitrarily ordered ifthis.unphased(marker, sample) == false.- Specified by:
allele1in interfaceDuplicatesGTRec- Parameters:
sample- a sample index- Returns:
- the first allele for the specified sample
-
allele2
public int allele2(int sample)
Description copied from interface:DuplicatesGTRecReturns the second allele for the specified sample or -1 if the allele is missing. The two alleles for a sample are arbitrarily ordered ifthis.unphased(marker, sample) == false.- Specified by:
allele2in interfaceDuplicatesGTRec- Parameters:
sample- a sample index- Returns:
- the second allele for the specified sample
-
get
public int get(int hap)
Description copied from interface:DuplicatesGTRecReturns the specified allele for the specified haplotype or -1 if the allele is missing. The two alleles for a sample at a marker are arbitrarily ordered ifthis.unphased(marker, hap/2) == false.- Specified by:
getin interfaceDuplicatesGTRec- Specified by:
getin interfaceIntArray- Parameters:
hap- a haplotype index- Returns:
- the specified allele for the specified sample
-
gl
public float gl(int sample, int a1, int a2)Description copied from interface:GTRecReturns the probability of the observed data for the specified sample if the specified pair of ordered alleles is the true ordered genotype.
-
alleles
public int[] alleles()
Description copied from interface:DuplicatesGTRecReturns an array of lengththis.size()whosej-th element is equal tothis.allele(j}- Specified by:
allelesin interfaceDuplicatesGTRec- Returns:
- an array of length
this.size()whosej-th element is equal tothis.allele(j}
-
nAlleles
public int nAlleles()
Description copied from interface:MarkerContainerReturns the number of marker alleles.- Specified by:
nAllelesin interfaceMarkerContainer- Returns:
- the number of marker alleles.
-
toString
public java.lang.String toString()
Returns the data represented bythisas 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.- Overrides:
toStringin classjava.lang.Object- Returns:
- the data represented by
thisas a VCF record with a GT format field
-
-