Package vcf

Class RefIt

java.lang.Object
vcf.RefIt
All Implemented Interfaces:
FileIt<RefGTRec>, SampleFileIt<RefGTRec>, VcfFileIt<RefGTRec>, Closeable, AutoCloseable, Iterator<RefGTRec>

public class RefIt extends Object implements VcfFileIt<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 Details

    • create

      public static RefIt create(FileIt<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:
      IllegalArgumentException - if a format error is detected in a line of a VCF file returned by it
      NullPointerException - if it == null
    • create

      public static RefIt create(FileIt<String> it, Filter<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:
      IllegalArgumentException - if a format error is detected in a line of a VCF file returned by it
      IllegalArgumentException - if bufferSize < 1
      NullPointerException - if it == null
    • create

      public static RefIt create(FileIt<String> it, Filter<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:
      IllegalArgumentException - if a format error is detected in a line of a VCF file returned by it
      IllegalArgumentException - if bufferSize < 1
      NullPointerException - if it == null
    • close

      public void close()
      Description copied from interface: FileIt
      Closes the input stream and releases any system resources that are associated with it. If the input stream is already closed then invoking this method has no effect.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface 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 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 Iterator<RefGTRec>
      Returns:
      the next element in the iteration
      Throws:
      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 Iterator<RefGTRec>
      Throws:
      UnsupportedOperationException - if this method is invoked
    • file

      public 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
    • samples

      public Samples samples()
      Description copied from interface: SampleFileIt
      Returns the list of samples.
      Specified by:
      samples in interface SampleFileIt<RefGTRec>
      Returns:
      the list of samples
    • vcfHeader

      public VcfHeader vcfHeader()
      Description copied from interface: VcfFileIt
      Returns the VCF meta-information lines and header line
      Specified by:
      vcfHeader in interface VcfFileIt<RefGTRec>
      Returns:
      the VCF meta-information lines and header line
    • toString

      public 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 Object
      Returns:
      a string representation of this