Package vcf
Class BasicGT
- java.lang.Object
-
- vcf.BasicGT
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete 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 int
genotype(int a1, int a2)
Returns the genotype index corresponding to the specified unordered alleles.boolean
isPhased()
Returnstrue
if the genotype for each marker and sample is a phased, non-missing genotype, and returnsfalse
otherwise.Marker
marker(int markerIndex)
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.java.lang.String
toString()
-
-
-
Constructor Detail
-
BasicGT
public BasicGT(Samples samples, GTRec[] vma)
Constructs aBasicGT
instance.- Parameters:
samples
- the list of samples with genotype datavma
- genotype emission probabilities- Throws:
java.lang.IllegalArgumentException
- if elements ofvma
corresponding to the same chromosome are not contiguous and sorted in chromosome position orderjava.lang.IllegalArgumentException
- if any twovma
elements correspond to the same genetic markerjava.lang.IllegalArgumentException
- ifvma[j].samples().equals(samples) == false
for anyj
satisfying0 <= j && j < vma.length
java.lang.NullPointerException
- ifsamples == null
java.lang.NullPointerException
- ifvma == null
java.lang.NullPointerException
- ifvma[j] == null
anyj
satisfying0 <= 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:GT
Returnstrue
if the genotype for each marker and sample is a phased, non-missing genotype, and returnsfalse
otherwise.
-
allele1
public int allele1(int marker, int sample)
Description copied from interface:GT
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
.
-
allele2
public int allele2(int marker, int sample)
Description copied from interface:GT
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
.
-
allele
public int allele(int marker, int hap)
Description copied from interface:GT
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
.
-
nMarkers
public int nMarkers()
Description copied from interface:GT
Returns the number of markers.
-
marker
public Marker marker(int markerIndex)
Description copied from interface:GT
Returns the specified marker.
-
nHaps
public int nHaps()
Description copied from interface:GT
Returns the number of haplotypes. The returned value is equal to2*this.nSamples()
.
-
nSamples
public int nSamples()
Description copied from interface:GT
Returns the number of samples.
-
restrict
public GT restrict(Markers markers, int[] indices)
Description copied from interface:GT
Returns aGT
instance restricted to genotype data for the specified markers.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-