Class SortedVariantsVcfIterator

java.lang.Object
org.snpsift.annotate.mem.SortedVariantsVcfIterator
All Implemented Interfaces:
Iterable<org.snpeff.vcf.VariantVcfEntry>, Iterator<org.snpeff.vcf.VariantVcfEntry>

public class SortedVariantsVcfIterator extends Object implements Iterator<org.snpeff.vcf.VariantVcfEntry>, Iterable<org.snpeff.vcf.VariantVcfEntry>
This is a class that reads a VCF file and returns the variants in sorted order. It uses a min heap to keep track of the next variant to be returned. The min heap is populated with the first variant from each chromosome. The next variant to be returned is the one with the smallest position. When a variant is returned, the min heap is updated with the next variant from the same chromosome. The process continues until all variants have been returned.
  • Field Details

    • vcfFileName

      protected String vcfFileName
    • vcfFileIterator

      protected org.snpeff.fileIterator.VcfFileIterator vcfFileIterator
    • variantsMinHeap

      protected PriorityQueue<org.snpeff.vcf.VariantVcfEntry> variantsMinHeap
    • vcfChr

      protected String vcfChr
    • vcfPos

      protected int vcfPos
    • vcfEntryPending

      protected org.snpeff.vcf.VcfEntry vcfEntryPending
  • Constructor Details

    • SortedVariantsVcfIterator

      public SortedVariantsVcfIterator(String vcfFileName)
    • SortedVariantsVcfIterator

      public SortedVariantsVcfIterator(BufferedReader reader)
  • Method Details

    • lines2SortedVariantsVcfIterator

      public static SortedVariantsVcfIterator lines2SortedVariantsVcfIterator(String vcfLines)
      Create a VcfFileIterator from a string containig VCF lines
    • close

      public void close()
    • iterator

      public Iterator<org.snpeff.vcf.VariantVcfEntry> iterator()
      Specified by:
      iterator in interface Iterable<org.snpeff.vcf.VariantVcfEntry>
    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<org.snpeff.vcf.VariantVcfEntry>
    • next

      public org.snpeff.vcf.VariantVcfEntry next()
      Specified by:
      next in interface Iterator<org.snpeff.vcf.VariantVcfEntry>