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.int
get
(int hap) Returns the specified allele for the specified haplotype or -1 if the allele is missing.boolean
isPhased()
Returnstrue
if every genotype for each sample is a phased, non-missing genotype, and returnsfalse
otherwise.boolean
isPhased
(int sample) Returnstrue
if the genotype for the specified sample has non-missing alleles and is either haploid or diploid with a phased allele separator, and returnsfalse
otherwise.marker()
Returns the marker.samples()
Returns the list of samples.int
size()
Returns the number of haplotypes.static String
Returns a VCF record corresponding to the specifiedGTRec
object.
-
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:
get
in 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) Returnstrue
if the genotype for the specified sample has non-missing alleles and is either haploid or diploid with a phased allele separator, and returnsfalse
otherwise.- Parameters:
sample
- a sample index- Returns:
true
if the genotype for the specified sample is a phased, nonmissing genotype- Throws:
IndexOutOfBoundsException
- ifsample < 0 || sample >= this.size()/2
-
isPhased
boolean isPhased()Returnstrue
if every genotype for each sample is a phased, non-missing genotype, and returnsfalse
otherwise.- Returns:
true
if 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 specifiedGTRec
object. 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
GTRec
object - Throws:
NullPointerException
- ifgtRec == null
-