Package vcf
Class BasicGT
- java.lang.Object
-
- vcf.BasicGT
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intallele(int marker, int hap)Returns the allele on the specified haplotype for the specified marker or return -1 if the allele is missing.intallele1(int marker, int sample)Returns the first allele for the specified marker and sample or return -1 if the allele is missing.intallele2(int marker, int sample)Returns the second allele for the specified marker and sample or return -1 if the allele is missing.static intgenotype(int a1, int a2)Returns the genotype index corresponding to the specified unordered alleles.floatgl(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 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 the genotype for each marker and sample is a phased, non-missing genotype, and returnsfalseotherwise.booleanisPhased(int sample)Returnstrueif the genotype for each marker for the specified sample is a phased, nonmissing genotype, and returnsfalseotherwise.booleanisPhased(int marker, int sample)Returnstrueif the genotype for the specified marker and sample is a phased, nonmissing genotype, and returnsfalseotherwise.Markermarker(int markerIndex)Returns the specified marker.Markersmarkers()Returns the list of markers.intnHaps()Returns the number of haplotypes.intnMarkers()Returns the number of markers.intnSamples()Returns the number of samples.Samplessamples()Returns the list of samples.java.lang.StringtoString()
-
-
-
Constructor Detail
-
BasicGT
public BasicGT(Samples samples, GTRec[] vma)
Constructs aBasicGTinstance.- Parameters:
samples- the list of samples with genotype datavma- genotype emission probabilities- Throws:
java.lang.IllegalArgumentException- if elements ofvmacorresponding to the same chromosome are not contiguous and sorted in chromosome position orderjava.lang.IllegalArgumentException- if any twovmaelements correspond to the same genetic markerjava.lang.IllegalArgumentException- ifvma[j].samples().equals(samples) == falsefor anyjsatisfying0 <= j && j < vma.lengthjava.lang.NullPointerException- ifsamples == nulljava.lang.NullPointerException- ifvma == nulljava.lang.NullPointerException- ifvma[j] == nullanyjsatisfying0 <= j && j < vma.length
-
-
Method Detail
-
genotype
public static int genotype(int a1, int a2)Returns the genotype index corresponding to the specified unordered alleles.- Parameters:
a1- the first allele index of an unordered genotypea2- the second allele index of an unordered genotype- Returns:
- the genotype index corresponding to the specified unordered alleles
- Throws:
java.lang.IllegalArgumentException- ifa1 < 0 || a2 < 0
-
isPhased
public boolean isPhased()
Description copied from interface:GTReturnstrueif the genotype for each marker and sample is a phased, non-missing genotype, and returnsfalseotherwise.
-
isGTData
public boolean isGTData()
Description copied from interface:GTReturnstrueif 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:GTReturnstrueif the genotype for each marker for the specified sample is a phased, nonmissing genotype, and returnsfalseotherwise.
-
gl
public float gl(int marker, int sample, int allele1, int allele2)Description copied from interface:GTReturns the probability of the observed data for the specified marker and sample if the specified pair of ordered alleles is the true ordered genotype.- Specified by:
glin interfaceGT- Parameters:
marker- 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
-
isPhased
public boolean isPhased(int marker, int sample)Description copied from interface:GTReturnstrueif the genotype for the specified marker and sample is a phased, nonmissing genotype, and returnsfalseotherwise.
-
allele1
public int allele1(int marker, int sample)Description copied from interface:GTReturns 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.
-
allele2
public int allele2(int marker, int sample)Description copied from interface:GTReturns 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.
-
allele
public int allele(int marker, int hap)Description copied from interface:GTReturns 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.
-
nMarkers
public int nMarkers()
Description copied from interface:GTReturns the number of markers.
-
marker
public Marker marker(int markerIndex)
Description copied from interface:GTReturns the specified marker.
-
nHaps
public int nHaps()
Description copied from interface:GTReturns the number of haplotypes. The returned value is equal to2*this.nSamples().
-
nSamples
public int nSamples()
Description copied from interface:GTReturns the number of samples.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-