String chr = "chr9";
// Linear index
TestUtils.createIndex(file);
// First test query
AbstractFeatureReader bfr = AbstractFeatureReader.getFeatureReader(file, new VCFCodec());
Iterator<htsjdk.variant.variantcontext.VariantContext> iter = bfr.query(chr, 5073767 - 5, 5073767 + 5);
int count = 0;
while (iter.hasNext()) {
htsjdk.variant.variantcontext.VariantContext feat = iter.next();
assertEquals("chr9", feat.getChr());
assertEquals(feat.getStart(), 5073767);
assertTrue(feat.hasAttribute("MapQs"));
count++;
}
assertEquals(1, count);
// Test non-indexed access (iterator)
iter = bfr.iterator();
count = 0;
while (iter.hasNext()) {
htsjdk.variant.variantcontext.VariantContext feat = iter.next();
assertEquals("chr9", feat.getChr());
assertEquals(feat.getStart(), 5073767);
assertTrue(feat.hasAttribute("MapQs"));
count++;
}
assertEquals(1, count);
//Do similar as above, but have a different test file
file = TestUtils.DATA_DIR + "vcf/outputPileup.flt1.vcf";
chr = "1";
// Linear index
TestUtils.createIndex(file);
bfr = AbstractFeatureReader.getFeatureReader(file, new VCFCodec());
iter = bfr.query(chr, 984163 - 5, 984163 + 5);
count = 0;
while (iter.hasNext()) {
htsjdk.variant.variantcontext.VariantContext feat = iter.next();
assertEquals(chr, feat.getChr());
if (count == 0) {