Package vcf

Interface Marker

All Superinterfaces:
Comparable<Marker>
All Known Implementing Classes:
BasicMarker

public interface Marker extends Comparable<Marker>

Interface Marker represents a genetic marker.

All instances of class Marker are required to be immutable.

  • Method Summary

    Modifier and Type
    Method
    Description
    allele(int index)
    Returns the specified allele.
    Returns the alleles.
    int
    Returns the minimum number of bits required to store a non-missing allele.
    Returns the chromosome.
    int
    Returns the chromosome index.
    int
    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
    Returns true if the specified object is a Marker with the same chromosome, position, allele lists, and INFO END field, and returns false otherwise.
    int
    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 returns this.chr() + ":" + this.pos() otherwise.
    id(int index)
    Returns the specified marker identifier.
    int
    Returns the number of alleles for the marker, including the REF allele.
    int
    Returns the number of distinct genotypes, which equals this.nAlleles()*(1 + this.nAlleles())/2.
    int
    Returns the number of marker identifiers.
    int
    pos()
    Returns the chromosome position coordinate.
    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

      String id(int index)
      Returns the specified marker identifier.
      Parameters:
      index - a marker identifier index
      Returns:
      the specified marker identifier
      Throws:
      IndexOutOfBoundsException - if index < 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 returns this.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

      String allele(int index)
      Returns the specified allele. The reference allele has index 0.
      Parameters:
      index - an allele index
      Returns:
      the specified allele
      Throws:
      IndexOutOfBoundsException - if index < 0 || index >= this.nAlleles()
    • alleles

      String[] alleles()
      Returns the alleles. The k-th element of the returned array is equal to this.allele(k).
      Returns:
      the alleles
    • nGenotypes

      int nGenotypes()
      Returns the number of distinct genotypes, which equals this.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(Object obj)
      Returns true if the specified object is a Marker with the same chromosome, position, allele lists, and INFO END field, and returns false otherwise. Equality does not depend on value of the VCF record ID field.
      Overrides:
      equals in class Object
      Parameters:
      obj - object to be compared with this for equality
      Returns:
      true if the specified object is a Marker 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 class 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 the String compareTo() method.
      Specified by:
      compareTo in interface Comparable<Marker>
      Parameters:
      other - the Marker 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

      String toString()
      Returns a string equal to the first five tab-delimited fields of a VCF record corresponding to this marker.
      Overrides:
      toString in class Object
      Returns:
      a string equal to the first five tab-delimited fields of a VCF record corresponding to this marker