/** * attempt to close the VCF file */ public void close() { try { // close the underlying output stream outputStream.close(); // close the index stream (keep it separate to help debugging efforts) if (indexer != null) { if (indexer instanceof TribbleIndexCreator) { setIndexSequenceDictionary((TribbleIndexCreator)indexer, refDict); } final Index index = indexer.finalizeIndex(locationSource.getPosition()); index.writeBasedOnFeatureFile(location); } } catch (final IOException e) { throw new RuntimeException("Unable to close index for " + getStreamName(), e); } }
index.writeBasedOnFeatureFile(outFile); writer.close();
@Test(dataProvider = "writeIndexData") public void testWriteBasedOnNonRegularFeatureFile(final File inputFile, final IndexFactory.IndexType type, final FeatureCodec codec) throws Exception { final File tmpFolder = IOUtil.createTempDir("NonRegultarFeatureFile", null); // create the index final Index index = IndexFactory.createIndex(inputFile, codec, type); // try to write based on the tmpFolder Assert.assertThrows(IOException.class, () -> index.writeBasedOnFeatureFile(tmpFolder)); } }
index.writeBasedOnFeatureFile(bgzfOut); writer.close(); CloserUtil.close(lin);
index.writeBasedOnFeatureFile(tmpBCF); final File tempIndex = Tribble.indexFile(tmpBCF); tempIndex.deleteOnExit();
vcfIndexFile.delete(); IndexFactory.createDynamicIndex(vcfFile, new VCFCodec()).writeBasedOnFeatureFile(vcfFile);