Package vcf
Interface Marker
- All Superinterfaces:
Comparable<Marker>
- All Known Implementing Classes:
BasicMarker
Interface Marker represents a genetic marker.
All instances of class Marker are required to be immutable.
-
Method Summary
Modifier and TypeMethodDescriptionallele(int index) Returns the specified allele.String[]alleles()Returns the alleles.intReturns the minimum number of bits required to store a non-missing allele.chrom()Returns the chromosome.intReturns the chromosome index.intCompares this marker with the specified marker for order, and returns a negative integer, 0, or a positive integer depending on whether this marker is less than, equal to, or greater than the specified marker.intend()Returns the INFO END field, or -1 if there is no INFO END field.booleanReturnstrueif the specified object is aMarkerwith the same chromosome, position, allele lists, and INFO END field, and returnsfalseotherwise.inthashCode()Returns the hash code value for this object.id()Returns the first marker identifier if there is at least one identifier in the VCF record ID field, and returnsthis.chr() + ":" + this.pos()otherwise.id(int index) Returns the specified marker identifier.intnAlleles()Returns the number of alleles for the marker, including the REF allele.intReturns the number of distinct genotypes, which equalsthis.nAlleles()*(1 + this.nAlleles())/2.intnIds()Returns the number of marker identifiers.intpos()Returns the chromosome position coordinate.toString()Returns a string equal to the first five tab-delimited fields of a VCF record corresponding to this marker.
-
Method Details
-
chrom
String chrom()Returns the chromosome.- Returns:
- the chromosome
-
chromIndex
int chromIndex()Returns the chromosome index.- Returns:
- the chromosome index
-
pos
int pos()Returns the chromosome position coordinate.- Returns:
- the chromosome position coordinate
-
nIds
int nIds()Returns the number of marker identifiers.- Returns:
- the number of marker identifiers
-
id
Returns the specified marker identifier.- Parameters:
index- a marker identifier index- Returns:
- the specified marker identifier
- Throws:
IndexOutOfBoundsException- ifindex < 0 || index >= this.nIds()
-
id
String id()Returns the first marker identifier if there is at least one identifier in the VCF record ID field, and returnsthis.chr() + ":" + this.pos()otherwise.- Returns:
- a marker identifier
-
nAlleles
int nAlleles()Returns the number of alleles for the marker, including the REF allele.- Returns:
- the number of alleles for the marker, including the REF allele
-
bitsPerAllele
int bitsPerAllele()Returns the minimum number of bits required to store a non-missing allele.- Returns:
- the minimum number of bits required to store a non-missing allele
-
allele
Returns the specified allele. The reference allele has index 0.- Parameters:
index- an allele index- Returns:
- the specified allele
- Throws:
IndexOutOfBoundsException- ifindex < 0 || index >= this.nAlleles()
-
alleles
String[] alleles()Returns the alleles. Thek-th element of the returned array is equal tothis.allele(k).- Returns:
- the alleles
-
nGenotypes
int nGenotypes()Returns the number of distinct genotypes, which equalsthis.nAlleles()*(1 + this.nAlleles())/2.- Returns:
- the number of distinct genotypes
-
end
int end()Returns the INFO END field, or -1 if there is no INFO END field.- Returns:
- the INFO END field, or -1 if there is no INFO END field
-
equals
Returnstrueif the specified object is aMarkerwith the same chromosome, position, allele lists, and INFO END field, and returnsfalseotherwise. Equality does not depend on value of the VCF record ID field. -
hashCode
int hashCode()Returns the hash code value for this object. The hash code does not depend on value of the VCF record ID field. The hash code is defined by the following calculation:
int hash = 5; hash = 29 * hash + this.chromIndex(); hash = 29 * hash + this.pos(); for (int j=0, n=this.nAlleles(); j<n; ++j) { hash = 29 * hash + alleles[j].hashCode(); } hash = 29 * hash + end(); -
compareTo
Compares this marker with the specified marker for order, and returns a negative integer, 0, or a positive integer depending on whether this marker is less than, equal to, or greater than the specified marker. Comparison is on chromosome index, position, allele identifier lists, and end value in that order. Allele identifier lists are compared for lexicographical order, and alleles are compared using theString compareTo()method.- Specified by:
compareToin interfaceComparable<Marker>- Parameters:
other- theMarkerto be compared- Returns:
- a negative integer, 0, or a positive integer depending on whether this marker is less than, equal, or greater than the specified marker
-
toString
String toString()Returns a string equal to the first five tab-delimited fields of a VCF record corresponding to this marker.
-