/**
   * Returns a list of VariantContext records from a VCF file
   *
   * @param vcfFile VCF file
   * @throws IOException if the file does not exist or can not be opened
   * @return list of VariantContext records
   */
  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;
  }
  /**
   * Returns a list of attribute values from a VCF file
   *
   * @param vcfFile VCF file
   * @param attributeName attribute name
   * @throws IOException if the file does not exist or can not be opened
   * @return list of attribute values
   */
  private List<String> getAttributeValues(final File vcfFile, final String attributeName)
      throws IOException {
    final VCFCodec codec = new VCFCodec();
    final FileInputStream s = new FileInputStream(vcfFile);
    final LineIterator lineIteratorVCF =
        codec.makeSourceFromStream(new PositionalBufferedStream(s));
    codec.readHeader(lineIteratorVCF);

    List<String> attributeValues = new ArrayList<String>();
    while (lineIteratorVCF.hasNext()) {
      final String line = lineIteratorVCF.next();
      Assert.assertFalse(line == null);
      final VariantContext vc = codec.decode(line);

      for (final Genotype g : vc.getGenotypes()) {
        if (g.hasExtendedAttribute(attributeName)) {
          attributeValues.add((String) g.getExtendedAttribute(attributeName));
        }
      }
    }

    return attributeValues;
  }
  public static VariantContextContainer readAllVCs(final File input, final VCFCodec codec)
      throws FileNotFoundException {
    final LineIterator lineIterator =
        new LineIteratorImpl(
            LineReaderUtil.fromBufferedStream(new BufferedInputStream(new FileInputStream(input))));
    final VCFHeader vcfHeader = (VCFHeader) codec.readActualHeader(lineIterator);
    return new VariantContextTestProvider.VariantContextContainer(
        vcfHeader,
        new VariantContextTestProvider.VCIterable<LineIterator>(codec, vcfHeader) {
          @Override
          public boolean hasNext() {
            return lineIterator.hasNext();
          }

          @Override
          public LineIterator nextSource() {
            return lineIterator;
          }
        });
  }