Package vcf
Interface GT
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description int
allele(int marker, int hap)
Returns the allele on the specified haplotype for the specified marker or return -1 if the allele is missing.int
allele1(int marker, int sample)
Returns the first allele for the specified marker and sample or return -1 if the allele is missing.int
allele2(int marker, int sample)
Returns the second allele for the specified marker and sample or return -1 if the allele is missing.static float
gl(GT gt, int marker, int sample, int allele1, int allele2)
Returns the probability of the observed data for the specified marker and sample if the specified pair of unordered alleles is the true genotype.boolean
isPhased()
Returnstrue
if the genotype for each marker and sample is a phased, non-missing genotype, and returnsfalse
otherwise.Marker
marker(int marker)
Returns the specified marker.Markers
markers()
Returns the list of markers.int
nHaps()
Returns the number of haplotypes.int
nMarkers()
Returns the number of markers.int
nSamples()
Returns the number of samples.GT
restrict(Markers markers, int[] indices)
Returns aGT
instance restricted to genotype data for the specified markers.Samples
samples()
Returns the list of samples.
-
-
-
Method Detail
-
nMarkers
int nMarkers()
Returns the number of markers.- Returns:
- the number of markers
-
markers
Markers markers()
Returns the list of markers.- Returns:
- the list of markers
-
marker
Marker marker(int marker)
Returns the specified marker.- Parameters:
marker
- a marker index- Returns:
- the specified marker
- Throws:
java.lang.IndexOutOfBoundsException
- ifmarker < 0 || marker >= this.nMarkers()
-
nHaps
int nHaps()
Returns the number of haplotypes. The returned value is equal to2*this.nSamples()
.- Returns:
- the number of haplotypes
-
nSamples
int nSamples()
Returns the number of samples.- Returns:
- the number of samples
-
samples
Samples samples()
Returns the list of samples.- Returns:
- the list of samples
-
allele1
int allele1(int marker, int sample)
Returns the first allele for the specified marker and sample or return -1 if the allele is missing. The two alleles for a sample are arbitrarily ordered ifthis.unphased(marker, sample) == false
.- Parameters:
marker
- the marker indexsample
- the sample index- Returns:
- the first allele for the specified marker and sample
- Throws:
java.lang.IndexOutOfBoundsException
- ifmarker < 0 || marker >= this.nMarkers()
java.lang.IndexOutOfBoundsException
- ifsample < 0 || sample >= this.nSamples()
-
allele2
int allele2(int marker, int sample)
Returns the second allele for the specified marker and sample or return -1 if the allele is missing. The two alleles for a sample are arbitrarily ordered ifthis.unphased(marker, sample) == false
.- Parameters:
marker
- the marker indexsample
- the sample index- Returns:
- the allele for the specified marker and sample
- Throws:
java.lang.IndexOutOfBoundsException
- ifmarker < 0 || marker >= this.nMarkers()
java.lang.IndexOutOfBoundsException
- ifsample < 0 || sample >= this.nSamples()
-
allele
int allele(int marker, int hap)
Returns the allele on the specified haplotype for the specified marker or return -1 if the allele is missing. The two alleles for an individual are arbitrarily ordered ifthis.unphased(marker, hap/2) == false
.- Parameters:
marker
- the marker indexhap
- the haplotype index- Returns:
- the allele on the specified haplotype for the specified marker
- Throws:
java.lang.IndexOutOfBoundsException
- ifmarker < 0 || marker >= this.nMarkers()
java.lang.IndexOutOfBoundsException
- ifhap < 0 || hap >= this.nHaps()
-
isPhased
boolean isPhased()
Returnstrue
if the genotype for each marker and sample is a phased, non-missing genotype, and returnsfalse
otherwise.- Returns:
true
if the genotype for each marker and sample is a phased, non-missing genotype
-
restrict
GT restrict(Markers markers, int[] indices)
Returns aGT
instance restricted to genotype data for the specified markers.- Parameters:
markers
- the list of markers in the returned instanceindices
- a list of distinct marker indices (fromthis.markers())
in increasing order- Returns:
- a
GT
instance restricted to genotype data for the specified markers - Throws:
java.lang.IndexOutOfBoundsException
- if there existsj
such that(0 <= j && j < indices.length)
such that(indices[j] < 0 || indices[j] >= this.nMarkers())
java.lang.IllegalArgumentException
- if there existsj
such that(1 <= j && j < indices.length)
such that(indices[j] <= indice[j - 1])
java.lang.IllegalArgumentException
- if there existsj
such that(0 <= j && j < indices.length)
such that(this.marker(indices[j]).equals(markers.marker(j)) == false)
java.lang.NullPointerException
- ifindices == null
-
gl
static float gl(GT gt, int marker, int sample, int allele1, int allele2)
Returns the probability of the observed data for the specified marker and sample if the specified pair of unordered alleles is the true genotype.- Parameters:
gt
- the genotype datamarker
- the marker indexsample
- the sample indexallele1
- the first allele indexallele2
- the second allele index- Returns:
- the probability of the observed data for the specified marker and sample if the specified pair of ordered alleles is the true ordered genotype
- Throws:
java.lang.IndexOutOfBoundsException
- ifmarker < 0 || marker >= this.nMarkers()
java.lang.IndexOutOfBoundsException
- ifsamples < 0 || samples >= this.nSamples()
java.lang.IndexOutOfBoundsException
- ifallele1 < 0 || allele1 >= this.marker(marker).nAlleles()
java.lang.IndexOutOfBoundsException
- ifallele2 < 0 || allele2 >= this.marker(marker).nAlleles()
-
-