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 Modifier and Type Class Description static classAbstractFeatureReader.ComponentMethods
-
Field Summary
Fields Modifier and Type Field Description static Set<String>BLOCK_COMPRESSED_EXTENSIONSDeprecated.useIOUtil.BLOCK_COMPRESSED_EXTENSIONSinstead.protected FeatureCodec<T,SOURCE>codecprotected FeatureCodecHeaderheader
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractFeatureReader(String path, FeatureCodec<T,SOURCE> codec)protectedAbstractFeatureReader(String path, FeatureCodec<T,SOURCE> codec, Function<SeekableByteChannel,SeekableByteChannel> wrapper, Function<SeekableByteChannel,SeekableByteChannel> indexWrapper)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <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)ObjectgetHeader()get the headerstatic booleanhasBlockCompressedExtension(File file)Deprecated.static booleanhasBlockCompressedExtension(String fileName)Deprecated.static booleanhasBlockCompressedExtension(URI uri)Deprecated.booleanhasIndex()Whether the reader has an index or not Default implementation returns falsebooleanisQueryable()static booleanisTabix(String resourcePath, String indexPath)static voidsetComponentMethods(AbstractFeatureReader.ComponentMethods methods)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface htsjdk.tribble.FeatureReader
close, getSequenceNames, iterator, query, query
-
-
-
-
Field Detail
-
codec
protected final FeatureCodec<T extends Feature,SOURCE> codec
-
header
protected FeatureCodecHeader header
-
BLOCK_COMPRESSED_EXTENSIONS
@Deprecated public static final Set<String> BLOCK_COMPRESSED_EXTENSIONS
Deprecated.useIOUtil.BLOCK_COMPRESSED_EXTENSIONSinstead.
-
-
Constructor Detail
-
AbstractFeatureReader
protected AbstractFeatureReader(String path, FeatureCodec<T,SOURCE> codec)
-
AbstractFeatureReader
protected AbstractFeatureReader(String path, FeatureCodec<T,SOURCE> codec, Function<SeekableByteChannel,SeekableByteChannel> wrapper, Function<SeekableByteChannel,SeekableByteChannel> indexWrapper)
-
-
Method Detail
-
getFeatureReader
public static <FEATURE extends Feature,SOURCE> AbstractFeatureReader<FEATURE,SOURCE> getFeatureReader(String featureFile, FeatureCodec<FEATURE,SOURCE> codec) throws TribbleException
CallsgetFeatureReader(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 TribbleException
getFeatureReader(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 TribbleException
getFeatureReader(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,SeekableByteChannel> wrapper, Function<SeekableByteChannel,SeekableByteChannel> indexWrapper) throws TribbleException
- 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 TribbleException
Return 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
public static void setComponentMethods(AbstractFeatureReader.ComponentMethods methods)
-
hasBlockCompressedExtension
@Deprecated public static boolean hasBlockCompressedExtension(String fileName)
Deprecated.
-
hasBlockCompressedExtension
@Deprecated public static boolean hasBlockCompressedExtension(File file)
Deprecated.
-
hasBlockCompressedExtension
@Deprecated public static boolean hasBlockCompressedExtension(URI uri)
Deprecated.
-
getHeader
public Object getHeader()
get the header- Specified by:
getHeaderin interfaceFeatureReader<T extends Feature>- Returns:
- the header object we've read-in
-
isTabix
public static boolean isTabix(String resourcePath, String indexPath) throws IOException
- Throws:
IOException
-
-