private void tstExists(String path, boolean expectExists) throws IOException{ boolean exists = ParsingUtils.resourceExists(path); Assert.assertEquals(exists, expectExists); }
public static boolean isTabix(String resourcePath, String indexPath) throws IOException { if(indexPath == null){ indexPath = ParsingUtils.appendToPath(resourcePath, TabixUtils.STANDARD_INDEX_EXTENSION); } return IOUtil.hasBlockCompressedExtension(resourcePath) && ParsingUtils.resourceExists(indexPath); }
public static boolean isTabix(String resourcePath, String indexPath) throws IOException { if(indexPath == null){ indexPath = ParsingUtils.appendToPath(resourcePath, TabixUtils.STANDARD_INDEX_EXTENSION); } return IOUtil.hasBlockCompressedExtension(resourcePath) && ParsingUtils.resourceExists(indexPath); }
public boolean isTabix(String resourcePath, String indexPath) throws IOException{ if(indexPath == null){ indexPath = ParsingUtils.appendToPath(resourcePath, TabixUtils.STANDARD_INDEX_EXTENSION); } return hasBlockCompressedExtension(resourcePath) && ParsingUtils.resourceExists(indexPath); } }
private Index loadIndex(String path) { try { String indexFile = Tribble.indexFile(path); Index index = null; if (ParsingUtils.resourceExists(indexFile)) { index = IndexFactory.loadIndex(indexFile); } else { // See if the index itself is gzipped indexFile = ParsingUtils.appendToPath(indexFile, ".gz"); if (ParsingUtils.resourceExists(indexFile)) { index = IndexFactory.loadIndex(indexFile); } } return index; } catch (IOException e) { log.error("Error loading index file", e); return null; } } }
/** * Attempt to load the index for the specified {@link #path}. * If the {@link #path} has no available index file, * does nothing * * @throws IOException */ private void loadIndex() throws IOException { String indexFile = Tribble.indexFile(this.path); if (ParsingUtils.resourceExists(indexFile)) { index = IndexFactory.loadIndex(indexFile, indexWrapper); } else { // See if the index itself is gzipped indexFile = ParsingUtils.appendToPath(indexFile, ".gz"); if (ParsingUtils.resourceExists(indexFile)) { index = IndexFactory.loadIndex(indexFile, indexWrapper); } } this.needCheckForIndex = false; }
/** * Attempt to load the index for the specified {@link #path}. * If the {@link #path} has no available index file, * does nothing * @throws IOException */ private void loadIndex() throws IOException{ String indexFile = Tribble.indexFile(this.path); if (ParsingUtils.resourceExists(indexFile)) { index = IndexFactory.loadIndex(indexFile); } else { // See if the index itself is gzipped indexFile = ParsingUtils.appendToPath(indexFile, ".gz"); if (ParsingUtils.resourceExists(indexFile)) { index = IndexFactory.loadIndex(indexFile); } } this.needCheckForIndex = false; }
/** * Attempt to load the index for the specified {@link #path}. * If the {@link #path} has no available index file, * does nothing * * @throws IOException */ private void loadIndex() throws IOException { String indexFile = Tribble.indexFile(this.path); if (ParsingUtils.resourceExists(indexFile)) { index = IndexFactory.loadIndex(indexFile, indexWrapper); } else { // See if the index itself is gzipped indexFile = ParsingUtils.appendToPath(indexFile, ".gz"); if (ParsingUtils.resourceExists(indexFile)) { index = IndexFactory.loadIndex(indexFile, indexWrapper); } } this.needCheckForIndex = false; }
/** * @param featureFile - path to the feature file, can be a local file path, http url, or ftp url, or any other * uri supported by a {@link java.nio.file.Path} plugin * @param indexFile - path to the index file * @param codec - codec to decode the features * @param requireIndex - true if the reader will be queries for specific ranges. An index (idx) file must exist * @throws IOException */ public TribbleIndexedFeatureReader(final String featureFile, final String indexFile, final FeatureCodec<T, SOURCE> codec, final boolean requireIndex, Function<SeekableByteChannel, SeekableByteChannel> wrapper, Function<SeekableByteChannel, SeekableByteChannel> indexWrapper) throws IOException { this(featureFile, codec, false, wrapper, indexWrapper); // required to read the header if (indexFile != null && ParsingUtils.resourceExists(indexFile)) { index = IndexFactory.loadIndex(indexFile, indexWrapper); this.needCheckForIndex = false; } else { if (requireIndex) { this.loadIndex(); if (!this.hasIndex()) { throw new TribbleException("An index is required, but none found."); } } } }
/** * @param featureFile - path to the feature file, can be a local file path, http url, or ftp url * @param indexFile - path to the index file * @param codec - codec to decode the features * @param requireIndex - true if the reader will be queries for specific ranges. An index (idx) file must exist * @throws IOException */ public TribbleIndexedFeatureReader(final String featureFile, final String indexFile, final FeatureCodec<T, SOURCE> codec, final boolean requireIndex) throws IOException { this(featureFile, codec, false); // required to read the header if (indexFile != null && ParsingUtils.resourceExists(indexFile)) { index = IndexFactory.loadIndex(indexFile); this.needCheckForIndex = false; } else { if (requireIndex) { this.loadIndex(); if(!this.hasIndex()){ throw new TribbleException("An index is required, but none found."); } } } }
/** * @param featureFile - path to the feature file, can be a local file path, http url, or ftp url, or any other * uri supported by a {@link java.nio.file.Path} plugin * @param indexFile - path to the index file * @param codec - codec to decode the features * @param requireIndex - true if the reader will be queries for specific ranges. An index (idx) file must exist * @throws IOException */ public TribbleIndexedFeatureReader(final String featureFile, final String indexFile, final FeatureCodec<T, SOURCE> codec, final boolean requireIndex, Function<SeekableByteChannel, SeekableByteChannel> wrapper, Function<SeekableByteChannel, SeekableByteChannel> indexWrapper) throws IOException { this(featureFile, codec, false, wrapper, indexWrapper); // required to read the header if (indexFile != null && ParsingUtils.resourceExists(indexFile)) { index = IndexFactory.loadIndex(indexFile, indexWrapper); this.needCheckForIndex = false; } else { if (requireIndex) { this.loadIndex(); if (!this.hasIndex()) { throw new TribbleException("An index is required, but none found."); } } } }