Package vcf

Class RestrictedVcfWindow

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class RestrictedVcfWindow
    extends java.lang.Object
    implements java.io.Closeable

    Class RestrictedVcfWindow represents a sliding window of VCF records.

    Instances of class RestrictedVcfWindow are not thread.safe.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      GTRec[] advanceWindow​(Markers nextMarkers)
      Advances the sliding marker window, and returns the advanced window as a GTRec[] object.
      void close()
      Releases any I/O resources controlled by this object.
      int cumMarkerCnt()
      Returns the number of VCF records in the union of the current window and all previous windows.
      java.io.File file()
      Returns the file from which VCF records are read, or returns null if the source is standard input.
      int nSamples()
      Returns the number of samples.
      int overlap()
      Returns the number of VCF records in the overlap between the current window and the previous window.
      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
    • Constructor Detail

      • RestrictedVcfWindow

        public RestrictedVcfWindow​(SampleFileIt<? extends GTRec> it)
        Construct a new RestrictedVcfWindow instance.
        Parameters:
        it - an iterator that returns VCF records.
        Throws:
        java.lang.IllegalArgumentException - if it.hasNext() == false
        java.lang.IllegalArgumentException - if a format error is detected in a VCF record
        java.lang.NullPointerException - if it == null
    • Method Detail

      • advanceWindow

        public GTRec[] advanceWindow​(Markers nextMarkers)
        Advances the sliding marker window, and returns the advanced window as a GTRec[] object. The returned array will have length markers.nMarkers(). Markers not found in the data source will have null entries in the returned array.
        Parameters:
        nextMarkers - the set of markers in the advanced window
        Returns:
        the advanced marker window
        Throws:
        java.lang.IllegalArgumentException - if markers.nMarkers() == 0
        java.lang.IllegalArgumentException - if any two of the specified markers are on different chromosomes
        java.lang.IllegalArgumentException - if specified markers are inconsistent with a sliding marker window
        java.lang.IllegalArgumentException - if the specified markers do not advance the current marker window
        java.lang.IllegalArgumentException - if a format error is detected in a VCF record
        java.lang.IllegalArgumentException - if the input data does not contain any of the specified markers
        java.lang.NullPointerException - if nextMarkers == null
      • file

        public java.io.File file()
        Returns the file from which VCF records are read, or returns null if the source is standard input.
        Returns:
        the file from which VCF records are read, or null if the source is standard input
      • samples

        public Samples samples()
        Returns the list of samples.
        Returns:
        the list of samples
      • nSamples

        public int nSamples()
        Returns the number of samples.
        Returns:
        the number of samples
      • overlap

        public int overlap()
        Returns the number of VCF records in the overlap between the current window and the previous window. Returns 0 if the current window is the first window.
        Returns:
        the number of VCF records in the overlap between the current window and the previous window
      • cumMarkerCnt

        public int cumMarkerCnt()
        Returns the number of VCF records in the union of the current window and all previous windows.
        Returns:
        the number of VCF records in the union of the current window and all previous windows
      • 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
      • toString

        public java.lang.String toString()
        Returns a string representation of this. The exact details of the representation are unspecified and subject to change.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of this