Package vcf
Interface GT
- All Known Implementing Classes:
BasicGT,RefGT,RestrictedGT,SplicedGT,XRefGT
public interface GT
Interface GT represents genotype data
for a list of markers and a list of samples.
All instances of GT are required to be immutable.
-
Method Summary
Modifier and TypeMethodDescriptionintallele(int marker, int hap) Returns the allele on the specified haplotype for the specified marker 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.booleanReturnstrueif the markers are ordered by decreasing chromosome base position, and returnsfalseotherwise.marker(int marker) Returns the specified marker.markers()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.restrict(int start, int end) Returns a newGTinstance restricted to genotype data for the specified markers.Returns aGTinstance restricted to genotype data for the specified markers.samples()Returns the list of samples.
-
Method Details
-
isReversed
boolean isReversed()Returnstrueif the markers are ordered by decreasing chromosome base position, and returnsfalseotherwise.- Returns:
trueif the markers are ordered by decreasing chromosome base position
-
nMarkers
int nMarkers()Returns the number of markers.- Returns:
- the number of markers
-
marker
Returns the specified marker.- Parameters:
marker- a marker index- Returns:
- the specified marker
- Throws:
IndexOutOfBoundsException- ifmarker < 0 || marker >= this.nMarkers()
-
markers
Markers markers()Returns 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())- Returns:
- the list of markers in order of increasing chromosome position
-
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
-
isPhased
boolean isPhased()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.- Returns:
trueif the genotype for each marker and sample is a phased, non-missing genotype
-
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 order of the two alleles is unspecified ifthis.isPhased() == false.- Parameters:
marker- the marker indexhap- the haplotype index- Returns:
- the allele on the specified haplotype for the specified marker
- Throws:
IndexOutOfBoundsException- ifmarker < 0 || marker >= this.nMarkers()IndexOutOfBoundsException- ifhap < 0 || hap >= this.nHaps()
-
restrict
Returns aGTinstance 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
GTinstance restricted to genotype data for the specified markers - Throws:
IndexOutOfBoundsException- if there existsjsuch that(0 <= j && j < indices.length)such that(indices[j] < 0 || indices[j] >= this.nMarkers())IllegalArgumentException- if there existsjsuch that(1 <= j && j < indices.length)such that(indices[j] <= indice[j - 1])IllegalArgumentException- if there existsjsuch that(0 <= j && j < indices.length)such that(this.marker(indices[j]).equals(markers.marker(j)) == false)NullPointerException- ifindices == nullUnsupportedOperationException- ifthis.isReversed() == true
-
restrict
Returns a newGTinstance restricted to genotype data for the specified markers.- Parameters:
start- the start marker (inclusive)end- the end marker (exclusive)- Returns:
- a
GTinstance restricted to genotype data for the specified markers - Throws:
IllegalArgumentException- ifstart >= endIndexOutOfBoundsException- ifstart < 0 || end > this.markers()
-