Package vcf

Class Window<E extends GTRec>

  • Type Parameters:
    E - the type of elements in this window

    public class Window<E extends GTRec>
    extends java.lang.Object

    Class Window represents a window of VCF records.

    Instances of class [@code Window} are immutable.

    • Constructor Summary

      Constructors 
      Constructor Description
      Window​(java.util.List<E> recList, int overlapEnd, int overlapStart, boolean lastWindowOnChrom, boolean lastWindow)
      Constructs a new Window instance from the specified data.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addRecords​(java.util.List<E> list, int start, int end)
      Adds the specified records to he specified list.
      int chromIndex()
      Returns the chromosome index of the first maker in the window.
      boolean lastWindow()
      Returns true if the sliding window of genotype records is the last window and returns false otherwise.
      boolean lastWindowOnChrom()
      Returns true if the sliding window of genotype records is the last window for its chromosome and returns false otherwise.
      int nextOverlap()
      Returns the index of the first marker in the overlap with the next marker window.
      int nMarkers()
      Returns the number of markers in this window.
      int prevOverlap()
      Returns the index of the first marker after the overlap with the preceding marker window.
      E rec​(int marker)
      Returns the specified record.
      java.util.List<E> recList()
      Returns the list of recList in this window.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Window

        public Window​(java.util.List<E> recList,
                      int overlapEnd,
                      int overlapStart,
                      boolean lastWindowOnChrom,
                      boolean lastWindow)
        Constructs a new Window instance from the specified data. The contract for the constructed instance is undefined if any element of the specified recList is null.
        Parameters:
        recList - a list of marker recList
        overlapEnd - the index of the first marker after the overlap with the preceding marker window
        overlapStart - the index of the first marker in the overlap with the next marker window
        lastWindowOnChrom - true if the sliding window of VCF Records is the last window for its chromosome
        lastWindow - true if the sliding window of VCF Records is the last window
        Throws:
        java.lang.IllegalArgumentException - if recList.isEmpty()
        java.lang.IllegalArgumentException - if lastWindowOnChrom && overlapStart != recList.size()
        java.lang.NullPointerException - if recList==null
    • Method Detail

      • nMarkers

        public int nMarkers()
        Returns the number of markers in this window.
        Returns:
        the number of markers in this window
      • recList

        public java.util.List<E> recList()
        Returns the list of recList in this window.
        Returns:
        the list of recList in this window
      • rec

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

        public void addRecords​(java.util.List<E> list,
                               int start,
                               int end)
        Adds the specified records to he specified list.
        Parameters:
        list - the list to be added to
        start - the start record index (inclusive)
        end - the end record index (exclusive)
        Throws:
        java.lang.IndexOutOfBoundsException - if start < 0 || end > this.nMarkers() || start > end
        java.lang.NullPointerException - if list == null
      • prevOverlap

        public int prevOverlap()
        Returns the index of the first marker after the overlap with the preceding marker window. Returns 0 if the current window is the first window.
        Returns:
        the index of the first marker after the overlap with the preceding marker window
      • nextOverlap

        public int nextOverlap()
        Returns the index of the first marker in the overlap with the next marker window. Returns this.size() if the next marker window does not exist or is from a different chromosome.
        Returns:
        the first marker index in the overlap between this marker window and the next marker window
      • chromIndex

        public int chromIndex()
        Returns the chromosome index of the first maker in the window.
        Returns:
        the chromosome index of the first maker in the window
      • lastWindowOnChrom

        public boolean lastWindowOnChrom()
        Returns true if the sliding window of genotype records is the last window for its chromosome and returns false otherwise.
        Returns:
        true if the sliding window of genotype records is the last window for its chromosome
      • lastWindow

        public boolean lastWindow()
        Returns true if the sliding window of genotype records is the last window and returns false otherwise.
        Returns:
        true if the sliding window of genotype records is the last window