Package org.snpsift.annotate.mem

# 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 Summary

Fields
Modifier and Type
Field
Description
`protected PriorityQueue<org.snpeff.vcf.VariantVcfEntry>`
`variantsMinHeap`
`protected String`
`vcfChr`
`protected org.snpeff.vcf.VcfEntry`
`vcfEntryPending`
`protected org.snpeff.fileIterator.VcfFileIterator`
`vcfFileIterator`
`protected String`
`vcfFileName`
`protected int`
`vcfPos`

## Constructor Summary

Constructors
Constructor
Description
`SortedVariantsVcfIterator(BufferedReader reader)`
`SortedVariantsVcfIterator(String vcfFileName)`

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
`boolean`
`hasNext()`
`Iterator<org.snpeff.vcf.VariantVcfEntry>`
`iterator()`
`static SortedVariantsVcfIterator`
`lines2SortedVariantsVcfIterator(String vcfLines)`
Create a VcfFileIterator from a string containig VCF lines
`org.snpeff.vcf.VariantVcfEntry`
`next()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

### Methods inherited from interface java.util.Iterator

`forEachRemaining, remove`

## 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>`