Package haplotype

Interface HapPair

  • All Known Implementing Classes:
    BitHapPair, WrappedHapPair

    public interface HapPair

    Interface HapPair represents a pair of haplotypes for a sample. The pair of haplotypes are guaranteed to have non-missing alleles at each marker.

    All instances of HapPair are required to be immutable.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int allele1​(int marker)
      Returns the first allele for the specified marker.
      int allele2​(int marker)
      Returns the second allele for the specified marker.
      static java.util.Comparator<HapPair> comparator​(Samples samples)
      Returns a Comparator<HapPairInterface> whose compare(hp1, hp2) method returns -1, 0, or 1 depending on whether samples.index(hp1.idIndex()) is less than, equal, or greater than samples.index(hp2.idIndex()).
      int idIndex()
      Returns the sample identifier index.
      Marker marker​(int marker)
      Returns the specified marker.
      Markers markers()
      Returns the markers.
      int nMarkers()
      Returns the number of markers.
    • Method Detail

      • allele1

        int allele1​(int marker)
        Returns the first allele for the specified marker.
        Parameters:
        marker - a marker index
        Returns:
        the first allele for the specified marker
        Throws:
        java.lang.IndexOutOfBoundsException - if marker < 0 || marker >= this.nMarkers()
      • allele2

        int allele2​(int marker)
        Returns the second allele for the specified marker.
        Parameters:
        marker - a marker index
        Returns:
        the second allele for the specified marker
        Throws:
        java.lang.IndexOutOfBoundsException - if marker < 0 || marker >= this.nMarkers()
      • markers

        Markers markers()
        Returns the markers.
        Returns:
        the markers
      • marker

        Marker marker​(int marker)
        Returns the specified marker.
        Parameters:
        marker - a marker index
        Returns:
        the specified marker
        Throws:
        java.lang.IndexOutOfBoundsException - if marker < 0 || marker >= this.nMarkers()
      • nMarkers

        int nMarkers()
        Returns the number of markers.
        Returns:
        the number of markers
      • idIndex

        int idIndex()
        Returns the sample identifier index.
        Returns:
        the sample identifier index
      • comparator

        static java.util.Comparator<HapPair> comparator​(Samples samples)
        Returns a Comparator<HapPairInterface> whose compare(hp1, hp2) method returns -1, 0, or 1 depending on whether samples.index(hp1.idIndex()) is less than, equal, or greater than samples.index(hp2.idIndex()).
        Parameters:
        samples - the list of samples used to compare HapsPair objects
        Returns:
        a Comparator<HapPairInterface> whose compare(hp1, hp2) method compares two haplotype pairs for order
        Throws:
        java.lang.NullPointerException - if samples == null