Package htsjdk.tribble
Class AbstractFeatureReader<T extends Feature,SOURCE>
java.lang.Object
htsjdk.tribble.AbstractFeatureReader<T,SOURCE>
- All Implemented Interfaces:
FeatureReader<T>,Closeable,AutoCloseable
- Direct Known Subclasses:
TabixFeatureReader,TribbleIndexedFeatureReader
public abstract class AbstractFeatureReader<T extends Feature,SOURCE>
extends Object
implements FeatureReader<T>
jrobinso
the feature reader class, which uses indices and codecs to read in Tribble file formats.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionDeprecated.protected final FeatureCodec<T,SOURCE> protected FeatureCodecHeader -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractFeatureReader(String path, FeatureCodec<T, SOURCE> codec) protectedAbstractFeatureReader(String path, FeatureCodec<T, SOURCE> codec, Function<SeekableByteChannel, SeekableByteChannel> wrapper, Function<SeekableByteChannel, SeekableByteChannel> indexWrapper) -
Method Summary
Modifier and TypeMethodDescriptionstatic <FEATURE extends Feature,SOURCE>
AbstractFeatureReader<FEATURE,SOURCE> getFeatureReader(String featureFile, FeatureCodec<FEATURE, SOURCE> codec) CallsgetFeatureReader(String, FeatureCodec, boolean)withrequireIndex= truestatic <FEATURE extends Feature,SOURCE>
AbstractFeatureReader<FEATURE,SOURCE> getFeatureReader(String featureResource, FeatureCodec<FEATURE, SOURCE> codec, boolean requireIndex) getFeatureReader(String, String, FeatureCodec, boolean, Function, Function)withnullfor indexResource, wrapper, and indexWrapperstatic <FEATURE extends Feature,SOURCE>
AbstractFeatureReader<FEATURE,SOURCE> getFeatureReader(String featureResource, FeatureCodec<FEATURE, SOURCE> codec, Index index) Return a reader with a supplied index.static <FEATURE extends Feature,SOURCE>
AbstractFeatureReader<FEATURE,SOURCE> getFeatureReader(String featureResource, String indexResource, FeatureCodec<FEATURE, SOURCE> codec, boolean requireIndex) getFeatureReader(String, String, FeatureCodec, boolean, Function, Function)withnullfor wrapper, and indexWrapperstatic <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) get the headerstatic booleanDeprecated.static booleanhasBlockCompressedExtension(String fileName) Deprecated.static booleanDeprecated.booleanhasIndex()Whether the reader has an index or not Default implementation returns falsebooleanstatic booleanstatic voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface htsjdk.tribble.FeatureReader
close, getSequenceNames, iterator, query, query
-
Field Details
-
codec
-
header
-
BLOCK_COMPRESSED_EXTENSIONS
Deprecated.since June 2019 useFileExtensions.BLOCK_COMPRESSEDinstead.
-
-
Constructor Details
-
AbstractFeatureReader
-
AbstractFeatureReader
protected AbstractFeatureReader(String path, FeatureCodec<T, SOURCE> codec, Function<SeekableByteChannel, SeekableByteChannel> wrapper, Function<SeekableByteChannel, SeekableByteChannel> indexWrapper)
-
-
Method Details
-
getFeatureReader
public static <FEATURE extends Feature,SOURCE> AbstractFeatureReader<FEATURE,SOURCE> getFeatureReader(String featureFile, FeatureCodec<FEATURE, SOURCE> codec) throws TribbleExceptionCallsgetFeatureReader(String, FeatureCodec, boolean)withrequireIndex= true- Throws:
TribbleException
-
getFeatureReader
public static <FEATURE extends Feature,SOURCE> AbstractFeatureReader<FEATURE,SOURCE> getFeatureReader(String featureResource, FeatureCodec<FEATURE, SOURCE> codec, boolean requireIndex) throws TribbleExceptiongetFeatureReader(String, String, FeatureCodec, boolean, Function, Function)withnullfor indexResource, wrapper, and indexWrapper- Throws:
TribbleException
-
getFeatureReader
public static <FEATURE extends Feature,SOURCE> AbstractFeatureReader<FEATURE,SOURCE> getFeatureReader(String featureResource, String indexResource, FeatureCodec<FEATURE, SOURCE> codec, boolean requireIndex) throws TribbleExceptiongetFeatureReader(String, String, FeatureCodec, boolean, Function, Function)withnullfor wrapper, and indexWrapper- Throws:
TribbleException
-
getFeatureReader
public static <FEATURE extends Feature,SOURCE> AbstractFeatureReader<FEATURE,SOURCE> getFeatureReader(String featureResource, String indexResource, FeatureCodec<FEATURE, SOURCE> codec, boolean requireIndex, Function<SeekableByteChannel, throws TribbleExceptionSeekableByteChannel> wrapper, Function<SeekableByteChannel, SeekableByteChannel> indexWrapper) - Parameters:
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 aPathindexWrapper- a wrapper to apply to the byte stream from the indexResource, may be null, will only be applied if indexResource is a uri representing aPath- Throws:
TribbleException
-
getFeatureReader
public static <FEATURE extends Feature,SOURCE> AbstractFeatureReader<FEATURE,SOURCE> getFeatureReader(String featureResource, FeatureCodec<FEATURE, SOURCE> codec, Index index) throws TribbleExceptionReturn a reader with a supplied index.- Parameters:
featureResource- the path to the source file containing the featurescodec- used to decode the featuresindex- index of featureResource- Returns:
- a reader for this data
- Throws:
TribbleException
-
hasIndex
public boolean hasIndex()Whether the reader has an index or not Default implementation returns false- Returns:
- false
-
isQueryable
public boolean isQueryable()- Specified by:
isQueryablein interfaceFeatureReader<T extends Feature>- Returns:
- true if the reader has an index, which means that it can be queried.
-
setComponentMethods
-
hasBlockCompressedExtension
Deprecated. -
hasBlockCompressedExtension
Deprecated. -
hasBlockCompressedExtension
Deprecated. -
getHeader
get the header- Specified by:
getHeaderin interfaceFeatureReader<T extends Feature>- Returns:
- the header object we've read-in
-
isTabix
- Throws:
IOException
-
FileExtensions.BLOCK_COMPRESSEDinstead.