Package vcf
Interface Marker
-
- All Superinterfaces:
java.lang.Comparable<Marker>
- All Known Implementing Classes:
BasicMarker
public interface Marker extends java.lang.Comparable<Marker>
Interface
Markerrepresents a genetic marker.All instances of class
Markerare required to be immutable.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Stringallele(int index)Returns the specified allele.java.lang.String[]alleles()Returns the alleles.intbitsPerAllele()Returns the minimum number of bits required to store a non-missing allele.java.lang.Stringchrom()Returns the chromosome.intchromIndex()Returns the chromosome index.intcompareTo(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.intend()Returns the INFO END field, or -1 if there is no INFO END field.booleanequals(java.lang.Object obj)Returnstrueif 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.java.lang.Stringid()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.Stringid(int index)Returns the specified marker identifier.intnAlleles()Returns the number of alleles for the marker, including the REF allele.intnGenotypes()Returns 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.java.lang.StringtoString()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)
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.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- object to be compared withthisfor equality- Returns:
trueif the specified object is aMarkerwith 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:
hashCodein 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:
compareToin interfacejava.lang.Comparable<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
java.lang.String toString()
Returns a string equal to the first five tab-delimited fields of a VCF record corresponding to this marker.- Overrides:
toStringin classjava.lang.Object- Returns:
- a string equal to the first five tab-delimited fields of a VCF record corresponding to this marker
-
-