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
FieldsModifier and TypeFieldDescriptionprotected PriorityQueue
<org.snpeff.vcf.VariantVcfEntry> protected String
protected org.snpeff.vcf.VcfEntry
protected org.snpeff.fileIterator.VcfFileIterator
protected String
protected int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
boolean
hasNext()
Iterator
<org.snpeff.vcf.VariantVcfEntry> iterator()
static SortedVariantsVcfIterator
lines2SortedVariantsVcfIterator
(String vcfLines) Create a VcfFileIterator from a string containig VCF linesorg.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
-
vcfFileIterator
protected org.snpeff.fileIterator.VcfFileIterator vcfFileIterator -
variantsMinHeap
-
vcfChr
-
vcfPos
protected int vcfPos -
vcfEntryPending
protected org.snpeff.vcf.VcfEntry vcfEntryPending
-
-
Constructor Details
-
SortedVariantsVcfIterator
-
SortedVariantsVcfIterator
-
-
Method Details
-
lines2SortedVariantsVcfIterator
Create a VcfFileIterator from a string containig VCF lines -
close
public void close() -
iterator
-
hasNext
public boolean hasNext() -
next
public org.snpeff.vcf.VariantVcfEntry next()
-