use of htsjdk.variant.vcf.VCFCodec in project gatk-protected by broadinstitute.
the class GenotypeGVCFsIntegrationTest method getVariantContexts.
/**
* Returns a list of VariantContext records from a VCF file
*
* @param vcfFile VCF file
* @return list of VariantContext records
* @throws IOException if the file does not exist or can not be opened
*/
private static List<VariantContext> getVariantContexts(final File vcfFile) throws IOException {
final VCFCodec codec = new VCFCodec();
final FileInputStream s = new FileInputStream(vcfFile);
final LineIterator lineIteratorVCF = codec.makeSourceFromStream(new PositionalBufferedStream(s));
codec.readHeader(lineIteratorVCF);
final List<VariantContext> VCs = new ArrayList<>();
while (lineIteratorVCF.hasNext()) {
final String line = lineIteratorVCF.next();
Assert.assertFalse(line == null);
VCs.add(codec.decode(line));
}
return VCs;
}
Aggregations