Package vcf
Class HapsGT
- java.lang.Object
-
- vcf.HapsGT
-
-
Constructor Summary
Constructors Constructor Description HapsGT(Markers markers, Samples samples, LongArray[] haps)Constructs a newHapsGTinstance from the specified data.HapsGT(Markers markers, Samples samples, java.util.concurrent.atomic.AtomicReferenceArray<LongArray> haps)Constructs a newHapsGTinstance from the specified data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intallele(int marker, int haplotype)Returns the allele on the specified haplotype for the specified marker or return -1 if the allele is missing.intallele1(int marker, int hapPair)Returns the first allele for the specified marker and sample or return -1 if the allele is missing.intallele2(int marker, int hapPair)Returns the second allele for the specified marker and sample or return -1 if the allele is missing.booleanisPhased()Returnstrueif the genotype for each marker and sample has non-missing alleles and is either haploid or diploid with a phased allele separator, and returnsfalseotherwise.booleanisReversed()Returnstrueif the markers are ordered by decreasing chromosome base position, and returnsfalseotherwise.Markermarker(int marker)Returns the specified marker.Markersmarkers()Returns the list of markers in order of increasing chromosome position.intnHaps()Returns the number of haplotypes.intnMarkers()Returns the number of markers.intnSamples()Returns the number of samples.GTrestrict(Markers markers, int[] indices)Returns aGTinstance restricted to genotype data for the specified markers.Samplessamples()Returns the list of samples.
-
-
-
Constructor Detail
-
HapsGT
public HapsGT(Markers markers, Samples samples, LongArray[] haps)
Constructs a newHapsGTinstance from the specified data. Two haplotypes for thek-th sample are required to stored in the2*kand2*k + 1elements of thehapsarray.- Parameters:
markers- the list of markerssamples- the list of sampleshaps- the list of haplotypes- Throws:
java.lang.IllegalArgumentException- ifhaps.length != 2*samples.nSamples()java.lang.IllegalArgumentException- if there exists ajsuch that(0 <= j && j < haps.length)and(haps[j].size() < (markers.sumHaplotypeBits() + 63)/64)java.lang.NullPointerException- ifmarkers == null || samples == null || haps == nulljava.lang.NullPointerException- if any elements ofhapsisnull
-
HapsGT
public HapsGT(Markers markers, Samples samples, java.util.concurrent.atomic.AtomicReferenceArray<LongArray> haps)
Constructs a newHapsGTinstance from the specified data. Two haplotypes for thek-th sample are required to stored in the2*kand2*k + 1elements of thehapsarray.- Parameters:
markers- the list of markerssamples- the list of sampleshaps- the list of haplotypes- Throws:
java.lang.IllegalArgumentException- ifhaps.length() != 2*samples.nSamples()java.lang.IllegalArgumentException- if there exists ajsuch that(0 <= j && j < haps.length)and(haps[j].size() < (markers.sumHaplotypeBits() + 63)/64)java.lang.NullPointerException- ifmarkers == null || samples == null || haps == nulljava.lang.NullPointerException- if any elements ofhapsisnull
-
-
Method Detail
-
isReversed
public boolean isReversed()
Description copied from interface:GTReturnstrueif the markers are ordered by decreasing chromosome base position, and returnsfalseotherwise.- Specified by:
isReversedin interfaceGT- Returns:
trueif the markers are ordered by decreasing chromosome base position
-
nMarkers
public int nMarkers()
Description copied from interface:GTReturns the number of markers.
-
markers
public Markers markers()
Description copied from interface:GTReturns the list of markers in order of increasing chromosome position. If(this.isReversed() == false)then(this.markers().marker(j).equals(this.marker(j)) == true)for all(0 <= j && j < this.nMarkers()). If(this.isReversed() == true)then(this.markers().marker(this.nMarkers() - 1 - j).equals(this.marker(j)) == true)for all(0 <= j && j < this.nMarkers())
-
marker
public Marker marker(int marker)
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.
-
isPhased
public boolean isPhased()
Description copied from interface:GTReturnstrueif the genotype for each marker and sample has non-missing alleles and is either haploid or diploid with a phased allele separator, and returnsfalseotherwise.
-
allele1
public int allele1(int marker, int hapPair)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 hapPair)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 haplotype)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.
-
restrict
public GT restrict(Markers markers, int[] indices)
Description copied from interface:GTReturns aGTinstance restricted to genotype data for the specified markers.
-
-