FeatureReader<T>
, Closeable
, AutoCloseable
TabixFeatureReader
, TribbleIndexedFeatureReader
public abstract class AbstractFeatureReader<T extends Feature,SOURCE> extends Object implements FeatureReader<T>
Modifier and Type | Class | Description |
---|---|---|
static class |
AbstractFeatureReader.ComponentMethods |
Modifier and Type | Field | Description |
---|---|---|
static Set<String> |
BLOCK_COMPRESSED_EXTENSIONS |
|
protected FeatureCodec<T,SOURCE> |
codec |
|
protected FeatureCodecHeader |
header |
Modifier | Constructor | Description |
---|---|---|
protected |
AbstractFeatureReader(String path,
FeatureCodec<T,SOURCE> codec) |
|
protected |
AbstractFeatureReader(String path,
FeatureCodec<T,SOURCE> codec,
Function<SeekableByteChannel,SeekableByteChannel> wrapper,
Function<SeekableByteChannel,SeekableByteChannel> indexWrapper) |
Modifier and Type | Method | Description |
---|---|---|
static <FEATURE extends Feature,SOURCE> |
getFeatureReader(String featureFile,
FeatureCodec<FEATURE,SOURCE> codec) |
Calls
getFeatureReader(String, FeatureCodec, boolean) with requireIndex = true |
static <FEATURE extends Feature,SOURCE> |
getFeatureReader(String featureResource,
FeatureCodec<FEATURE,SOURCE> codec,
boolean requireIndex) |
getFeatureReader(String, String, FeatureCodec, boolean, Function, Function) with null for indexResource, wrapper, and indexWrapper |
static <FEATURE extends Feature,SOURCE> |
getFeatureReader(String featureResource,
FeatureCodec<FEATURE,SOURCE> codec,
Index index) |
Return a reader with a supplied index.
|
static <FEATURE extends Feature,SOURCE> |
getFeatureReader(String featureResource,
String indexResource,
FeatureCodec<FEATURE,SOURCE> codec,
boolean requireIndex) |
getFeatureReader(String, String, FeatureCodec, boolean, Function, Function) with null for wrapper, and indexWrapper |
static <FEATURE extends Feature,SOURCE> |
getFeatureReader(String featureResource,
String indexResource,
FeatureCodec<FEATURE,SOURCE> codec,
boolean requireIndex,
Function<SeekableByteChannel,SeekableByteChannel> wrapper,
Function<SeekableByteChannel,SeekableByteChannel> indexWrapper) |
|
Object |
getHeader() |
get the header
|
static boolean |
hasBlockCompressedExtension(File file) |
Whether the name of a file ends in one of the BLOCK_COMPRESSED_EXTENSIONS
|
static boolean |
hasBlockCompressedExtension(String fileName) |
Whether a filename ends in one of the BLOCK_COMPRESSED_EXTENSIONS
|
static boolean |
hasBlockCompressedExtension(URI uri) |
Whether the path of a URI resource ends in one of the BLOCK_COMPRESSED_EXTENSIONS
|
boolean |
hasIndex() |
Whether the reader has an index or not
Default implementation returns false
|
boolean |
isQueryable() |
|
static boolean |
isTabix(String resourcePath,
String indexPath) |
|
static void |
setComponentMethods(AbstractFeatureReader.ComponentMethods methods) |
close, getSequenceNames, iterator, query, query
protected final FeatureCodec<T extends Feature,SOURCE> codec
protected FeatureCodecHeader header
protected AbstractFeatureReader(String path, FeatureCodec<T,SOURCE> codec)
protected AbstractFeatureReader(String path, FeatureCodec<T,SOURCE> codec, Function<SeekableByteChannel,SeekableByteChannel> wrapper, Function<SeekableByteChannel,SeekableByteChannel> indexWrapper)
public static <FEATURE extends Feature,SOURCE> AbstractFeatureReader<FEATURE,SOURCE> getFeatureReader(String featureFile, FeatureCodec<FEATURE,SOURCE> codec) throws TribbleException
getFeatureReader(String, FeatureCodec, boolean)
with requireIndex
= trueTribbleException
public static <FEATURE extends Feature,SOURCE> AbstractFeatureReader<FEATURE,SOURCE> getFeatureReader(String featureResource, FeatureCodec<FEATURE,SOURCE> codec, boolean requireIndex) throws TribbleException
getFeatureReader(String, String, FeatureCodec, boolean, Function, Function)
with null
for indexResource, wrapper, and indexWrapperTribbleException
public static <FEATURE extends Feature,SOURCE> AbstractFeatureReader<FEATURE,SOURCE> getFeatureReader(String featureResource, String indexResource, FeatureCodec<FEATURE,SOURCE> codec, boolean requireIndex) throws TribbleException
getFeatureReader(String, String, FeatureCodec, boolean, Function, Function)
with null
for wrapper, and indexWrapperTribbleException
public static <FEATURE extends Feature,SOURCE> AbstractFeatureReader<FEATURE,SOURCE> getFeatureReader(String featureResource, String indexResource, FeatureCodec<FEATURE,SOURCE> codec, boolean requireIndex, Function<SeekableByteChannel,SeekableByteChannel> wrapper, Function<SeekableByteChannel,SeekableByteChannel> indexWrapper) throws TribbleException
featureResource
- the feature file to create fromindexResource
- the index for the feature file. If null, will auto-generate (if necessary)codec
- the codec to use to decode the individual featuresrequireIndex
- whether an index is required for this filewrapper
- a wrapper to apply to the byte stream from the featureResource allowing injecting features
like caching and prefetching of the stream, may be null, will only be applied if featureResource
is a uri representing a Path
indexWrapper
- a wrapper to apply to the byte stream from the indexResource, may be null, will only be
applied if indexResource is a uri representing a Path
TribbleException
public static <FEATURE extends Feature,SOURCE> AbstractFeatureReader<FEATURE,SOURCE> getFeatureReader(String featureResource, FeatureCodec<FEATURE,SOURCE> codec, Index index) throws TribbleException
featureResource
- the path to the source file containing the featurescodec
- used to decode the featuresindex
- index of featureResourceTribbleException
public boolean hasIndex()
public boolean isQueryable()
isQueryable
in interface FeatureReader<T extends Feature>
public static void setComponentMethods(AbstractFeatureReader.ComponentMethods methods)
public static boolean hasBlockCompressedExtension(String fileName)
fileName
- public static boolean hasBlockCompressedExtension(File file)
file
- public static boolean hasBlockCompressedExtension(URI uri)
uri
- a URI representing the resource to checkpublic Object getHeader()
getHeader
in interface FeatureReader<T extends Feature>
public static boolean isTabix(String resourcePath, String indexPath) throws IOException
IOException