示例#1
0
 /**
  * Utility class to read all of the VC records from a file
  *
  * @param file
  * @param codec
  * @return
  * @throws java.io.IOException
  */
 public static final <SOURCE> Pair<VCFHeader, VCIterable<SOURCE>> readAllVCs(
     final File file, final FeatureCodec<VariantContext, SOURCE> codec) throws IOException {
   // read in the features
   SOURCE source = codec.makeSourceFromStream(new FileInputStream(file));
   FeatureCodecHeader header = codec.readHeader(source);
   final VCFHeader vcfHeader = (VCFHeader) header.getHeaderValue();
   return new Pair<>(vcfHeader, new VCIterable<>(source, codec, vcfHeader));
 }
 @Override
 public VariantContext next() {
   try {
     final VariantContext vc = codec.decode(nextSource());
     return vc == null ? null : vc.fullyDecode(header, false);
   } catch (IOException e) {
     throw new RuntimeException(e);
   }
 }
示例#3
0
 @Override
 public boolean hasNext() {
   return !codec.isDone(source);
 }