Package vcf
Interface Marker
-
- All Superinterfaces:
java.lang.Comparable<Marker>
- All Known Implementing Classes:
BasicMarker
public interface Marker extends java.lang.Comparable<Marker>
Interface
Marker
represents a genetic marker.All instances of class
Marker
are required to be immutable.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
allele(int index)
Returns the specified allele.java.lang.String[]
alleles()
Returns the alleles.int
bitsPerAllele()
Returns the minimum number of bits required to store a non-missing allele.java.lang.String
chrom()
Returns the chromosome.int
chromIndex()
Returns the chromosome index.int
compareTo(Marker other)
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.int
end()
Returns the INFO END field, or -1 if there is no INFO END field.boolean
equals(java.lang.Object obj)
Returnstrue
if the specified object is aMarker
with the same chromosome, position, allele lists, and INFO END field, and returnsfalse
otherwise.int
hashCode()
Returns the hash code value for this object.java.lang.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.java.lang.String
id(int index)
Returns the specified marker identifier.int
nAlleles()
Returns the number of alleles for the marker, including the REF allele.int
nGenotypes()
Returns the number of distinct genotypes, which equalsthis.nAlleles()*(1 + this.nAlleles())/2
.int
nIds()
Returns the number of marker identifiers.int
pos()
Returns the chromosome position coordinate.java.lang.String
toString()
Returns a string equal to the first five tab-delimited fields of a VCF record corresponding to this marker.
-
-
-
Method Detail
-
chrom
java.lang.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
java.lang.String id(int index)
Returns the specified marker identifier.- Parameters:
index
- a marker identifier index- Returns:
- the specified marker identifier
- Throws:
java.lang.IndexOutOfBoundsException
- ifindex < 0 || index >= this.nIds()
-
id
java.lang.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
java.lang.String allele(int index)
Returns the specified allele. The reference allele has index 0.- Parameters:
index
- an allele index- Returns:
- the specified allele
- Throws:
java.lang.IndexOutOfBoundsException
- ifindex < 0 || index >= this.nAlleles()
-
alleles
java.lang.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
boolean equals(java.lang.Object obj)
Returnstrue
if the specified object is aMarker
with the same chromosome, position, allele lists, and INFO END field, and returnsfalse
otherwise. Equality does not depend on value of the VCF record ID field.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- object to be compared withthis
for equality- Returns:
true
if the specified object is aMarker
with the same chromosome, position, and allele lists, and INFO END 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();
- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- the hash code value for this marker
-
compareTo
int compareTo(Marker other)
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:
compareTo
in interfacejava.lang.Comparable<Marker>
- Parameters:
other
- theMarker
to 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
java.lang.String toString()
Returns a string equal to the first five tab-delimited fields of a VCF record corresponding to this marker.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string equal to the first five tab-delimited fields of a VCF record corresponding to this marker
-
-