Package vcf

Class WindowIt<E extends GTRec>

  • Type Parameters:
    E - the type of elements in the window corresponding to this window iterator.
    All Implemented Interfaces:
    FileIt<Window<E>>, SampleFileIt<Window<E>>, java.io.Closeable, java.lang.AutoCloseable, java.util.Iterator<Window<E>>

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

    Class WindowIt represents a sliding window of VCF recList.

    Instances of class WindowIt are not thread-safe.

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Releases any I/O resources controlled by this object.
      java.io.File file()
      Returns the file from which VCF recList are read, or returns null if the source is standard input.
      GeneticMap genMap()
      Returns the genetic map.
      boolean hasNext()
      Returns true if the sliding window of VCF recList can advance and returns false otherwise.
      static <E extends GTRec>
      WindowIt<E>
      newInstance​(java.util.function.Supplier<SampleFileIt<E>> supplier, GeneticMap genMap, float windowCM, float overlapCM)
      Constructs and returns a new WindowIt instance for the specified data.
      Window<E> next()
      Advances the sliding window of VCF recList, and returns the advanced window as a RefGTRec[] object.
      Samples samples()
      Returns the list of samples.
      java.lang.String toString()
      Returns a string representation of this.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining, remove
    • Method Detail

      • newInstance

        public static <E extends GTRecWindowIt<E> newInstance​(java.util.function.Supplier<SampleFileIt<E>> supplier,
                                                                GeneticMap genMap,
                                                                float windowCM,
                                                                float overlapCM)
        Constructs and returns a new WindowIt instance for the specified data.
        Type Parameters:
        E - the type of elements in windows for the returned window iterator.
        Parameters:
        supplier - the object which supplies the SampleFileIt which reads input data
        genMap - the genetic map
        windowCM - the requested window length in cM
        overlapCM - the requested overlap in cM between consecutive windows on the same chromosome
        Returns:
        a new WindowIt instance for the specified data
        Throws:
        java.lang.IllegalArgumentException - if a format error is detected in the input file
        java.lang.IllegalArgumentException - if overlap < 0 || Float.isFinite(overlap) == false
        java.lang.IllegalArgumentException - if window <= overlap || Float.isFinite(window) == false
        java.lang.NullPointerException - if it == null || genMap == null
      • genMap

        public GeneticMap genMap()
        Returns the genetic map.
        Returns:
        the genetic map
      • hasNext

        public boolean hasNext()
        Returns true if the sliding window of VCF recList can advance and returns false otherwise.
        Specified by:
        hasNext in interface java.util.Iterator<E extends GTRec>
        Returns:
        true if the sliding window of VCF recList can advance
      • next

        public Window<E> next()
        Advances the sliding window of VCF recList, and returns the advanced window as a RefGTRec[] object.
        Specified by:
        next in interface java.util.Iterator<E extends GTRec>
        Returns:
        the advanced window of VCF recList
        Throws:
        java.lang.IllegalArgumentException - if a format error in the input data is detected
        java.lang.IllegalArgumentException - if windowCm <= this.overlap() || Float.isFinite(windowCm) == false
        java.lang.IllegalStateException - if this.canAdvanceWindow() == false
      • file

        public java.io.File file()
        Returns the file from which VCF recList are read, or returns null if the source is standard input.
        Specified by:
        file in interface FileIt<E extends GTRec>
        Returns:
        the file from which VCF recList are read, or null if the source is standard input
      • samples

        public Samples samples()
        Returns the list of samples.
        Specified by:
        samples in interface SampleFileIt<E extends GTRec>
        Returns:
        the list of samples
      • close

        public void close()
        Releases any I/O resources controlled by this object.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface FileIt<E extends GTRec>
      • toString

        public java.lang.String toString()
        Returns a string representation of this. The exact details of the representation are unspecified and subject to change.
        Specified by:
        toString in interface FileIt<E extends GTRec>
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of this