Package vcf

Class RefIt

  • All Implemented Interfaces:
    FileIt<RefGTRec>, SampleFileIt<RefGTRec>, java.io.Closeable, java.lang.AutoCloseable, java.util.Iterator<RefGTRec>

    public class RefIt
    extends java.lang.Object
    implements SampleFileIt<RefGTRec>

    Class RefIt represents an iterator whose next() method returns an object storing data from a VCF record with phased, non-missing genotypes.

    Instances of class RefIt are not thread-safe.

    Methods of this class will terminate the Java Virtual Machine with an error message if an I/O error or file format error is detected.

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Stops reading data elements and releases any system resources that are held by this object.
      static RefIt create​(FileIt<java.lang.String> it)
      Create and returns a new RefIt instance from the specified iterator.
      static RefIt create​(FileIt<java.lang.String> it, Filter<java.lang.String> sampleFilter, Filter<Marker> markerFilter)
      Create and returns a new RefIt instance from the specified objects.
      static RefIt create​(FileIt<java.lang.String> it, Filter<java.lang.String> sampleFilter, Filter<Marker> markerFilter, int bufferSize)
      Create and returns a new RefIt instance from the specified objects.
      java.io.File file()
      Returns the file from which the data are read, or null if the data are read from standard input or if the data source is unknown.
      boolean hasNext()
      Returns true if the iteration has more elements, and returns false otherwise.
      RefGTRec next()
      Returns the next element in the iteration.
      void remove()
      The remove method is not supported by this iterator.
      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
    • Method Detail

      • create

        public static RefIt create​(FileIt<java.lang.String> it)
        Create and returns a new RefIt instance from the specified iterator.
        Parameters:
        it - an iterator that returns lines of a VCF file
        Returns:
        a new RefIt instance
        Throws:
        java.lang.IllegalArgumentException - if a format error is detected in a line of a VCF file returned by it
        java.lang.NullPointerException - if it == null
      • create

        public static RefIt create​(FileIt<java.lang.String> it,
                                   Filter<java.lang.String> sampleFilter,
                                   Filter<Marker> markerFilter)
        Create and returns a new RefIt instance from the specified objects.
        Parameters:
        it - an iterator that returns lines of a VCF file
        sampleFilter - a sample filter or null
        markerFilter - a marker filter or null
        Returns:
        a new RefIt instance
        Throws:
        java.lang.IllegalArgumentException - if a format error is detected in a line of a VCF file returned by it
        java.lang.IllegalArgumentException - if bufferSize < 1
        java.lang.NullPointerException - if it == null
      • create

        public static RefIt create​(FileIt<java.lang.String> it,
                                   Filter<java.lang.String> sampleFilter,
                                   Filter<Marker> markerFilter,
                                   int bufferSize)
        Create and returns a new RefIt instance from the specified objects.
        Parameters:
        it - an iterator that returns lines of a VCF file
        sampleFilter - a sample filter or null
        markerFilter - a marker filter or null
        bufferSize - the number of VCF records stored in a buffer
        Returns:
        a new RefIt instance
        Throws:
        java.lang.IllegalArgumentException - if a format error is detected in a line of a VCF file returned by it
        java.lang.IllegalArgumentException - if bufferSize < 1
        java.lang.NullPointerException - if it == null
      • close

        public void close()
        Description copied from interface: FileIt
        Stops reading data elements and releases any system resources that are held by this object. Buffered data elements may remain accessible via the hasNext() and next() methods after invoking close(). After invoking close(), further invocations of close() have no effect.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface FileIt<RefGTRec>
      • hasNext

        public boolean hasNext()
        Returns true if the iteration has more elements, and returns false otherwise.
        Specified by:
        hasNext in interface java.util.Iterator<RefGTRec>
        Returns:
        true if the iteration has more elements
      • next

        public RefGTRec next()
        Returns the next element in the iteration.
        Specified by:
        next in interface java.util.Iterator<RefGTRec>
        Returns:
        the next element in the iteration
        Throws:
        java.util.NoSuchElementException - if the iteration has no more elements
      • remove

        public void remove()
        The remove method is not supported by this iterator.
        Specified by:
        remove in interface java.util.Iterator<RefGTRec>
        Throws:
        java.lang.UnsupportedOperationException - if this method is invoked
      • file

        public java.io.File file()
        Description copied from interface: FileIt
        Returns the file from which the data are read, or null if the data are read from standard input or if the data source is unknown.
        Specified by:
        file in interface FileIt<RefGTRec>
        Returns:
        the file from which the data are read, or null if the data are read from standard input or if the data source is unknown
      • toString

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