Package vcf
Interface GTRec
- All Superinterfaces:
IntArray
- All Known Subinterfaces:
RefGTRec
- All Known Implementing Classes:
AlleleRefGTRec,BasicGTRec,BitArrayGTRec,BitArrayRefGTRec,HapRefGTRec,IntArrayRefGTRec,LowMafDiallelicGTRec,LowMafGTRec,TwoAlleleRefGTRec,VcfRec
Interface GTRec represents represents genotype data for one
marker.
All instances of GTRec are required to be immutable.
-
Method Summary
Modifier and TypeMethodDescriptionstatic int[]alleleCounts(GTRec rec) Returns the allele counts.static double[]alleleFreq(GTRec rec) Returns the allele frequencies.intget(int hap) Returns the specified allele for the specified haplotype or -1 if the allele is missing.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.marker()Returns the marker.samples()Returns the list of samples.intsize()Returns the number of haplotypes.static StringReturns a VCF record corresponding to the specifiedGTRecobject.
-
Method Details
-
samples
Samples samples()Returns the list of samples.- Returns:
- the list of samples
-
marker
Marker marker()Returns the marker.- Returns:
- the marker
-
get
int get(int hap) Returns 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 interfaceIntArray- Parameters:
hap- a haplotype index- Returns:
- the specified allele for the specified sample
- Throws:
IndexOutOfBoundsException- ifhap < 0 || hap >= this.size()
-
size
int size()Returns the number of haplotypes. -
isPhased
boolean isPhased(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.- Parameters:
sample- a sample index- Returns:
trueif the genotype for the specified sample is a phased, nonmissing genotype- Throws:
IndexOutOfBoundsException- ifsample < 0 || sample >= this.size()/2
-
isPhased
boolean isPhased()Returnstrueif every genotype for each sample is a phased, non-missing genotype, and returnsfalseotherwise.- Returns:
trueif the genotype for each sample is a phased, non-missing genotype
-
alleleFreq
Returns the allele frequencies. Thek-th element of the returned array is the frequency of thek-th allele.- Parameters:
rec- the genotype data for a marker- Returns:
- the allele frequencies
-
alleleCounts
Returns the allele counts. Thek-th element of the returned array is the count of thek-th allele.- Parameters:
rec- the genotype data for a marker- Returns:
- the allele frequencies
-
toVcfRec
Returns a VCF record corresponding to the specifiedGTRecobject. 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.- Parameters:
gtRec- the genotype data- Returns:
- a VCF record corresponding to the specified
GTRecobject - Throws:
NullPointerException- ifgtRec == null
-