Package htsjdk.tribble.index
Interface Index
-
- All Known Subinterfaces:
MutableIndex
- All Known Implementing Classes:
AbstractIndex
,IntervalTreeIndex
,LinearIndex
,TabixIndex
public interface Index
Interface for all index implementations. An index file is used for efficient lookup of features from a feature file; and Index represents that index file.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
containsChromosome(String chr)
boolean
equalsIgnoreProperties(Object obj)
Returns true if this and obj are 'effectively' equivalent indices.List<Block>
getBlocks(String chr, int start, int end)
Query the index.Map<String,String>
getProperties()
List<String>
getSequenceNames()
boolean
isCurrentVersion()
void
write(LittleEndianOutputStream stream)
all indexes are writable to diskdefault void
write(File idxFile)
Writes the index into a file.void
write(Path indexPath)
Writes the index into a path.default void
writeBasedOnFeatureFile(File featureFile)
Write an appropriately named and located Index file based on the name and location of the featureFile.void
writeBasedOnFeaturePath(Path featurePath)
Write an appropriately named and located Index file based on the name and location of the featureFile.
-
-
-
Method Detail
-
getBlocks
List<Block> getBlocks(String chr, int start, int end)
Query the index.- Parameters:
chr
- the chromosomestart
- the start positionend
- the end position- Returns:
- a list of blocks that contain the specified interval. Can never return null
- Throws:
IllegalArgumentException
- of chr isn't part of this index
-
isCurrentVersion
boolean isCurrentVersion()
- Returns:
- true if the index is up to date, false otherwise
-
getSequenceNames
List<String> getSequenceNames()
- Returns:
- a list of the sequence names we've seen during indexing, in order
-
containsChromosome
boolean containsChromosome(String chr)
- Parameters:
chr
- the chromosome (or contig) name- Returns:
- true if we have an entry; false otherwise
-
write
void write(LittleEndianOutputStream stream) throws IOException
all indexes are writable to disk- Parameters:
stream
- the stream to write the index to. Caller must close after invocation.- Throws:
IOException
- if the index is unable to write to the specified location
-
write
default void write(File idxFile) throws IOException
Writes the index into a file. Default implementation delegates towrite(Path)
- Parameters:
idxFile
- Where to write the index.- Throws:
IOException
- if the index is unable to write to the specified file
-
write
void write(Path indexPath) throws IOException
Writes the index into a path.- Parameters:
indexPath
- Where to write the index.- Throws:
IOException
- if the index is unable to write to the specified path.
-
writeBasedOnFeatureFile
default void writeBasedOnFeatureFile(File featureFile) throws IOException
Write an appropriately named and located Index file based on the name and location of the featureFile. Default implementation delegates towriteBasedOnFeaturePath(Path)
- Parameters:
featureFile
-- Throws:
IOException
- if featureFile is not a normal file.
-
writeBasedOnFeaturePath
void writeBasedOnFeaturePath(Path featurePath) throws IOException
Write an appropriately named and located Index file based on the name and location of the featureFile. If featureFile is not a normal file, the index will silently not be written.- Parameters:
featurePath
-- Throws:
IOException
- if featureFile is not a normal file.
-
getProperties
Map<String,String> getProperties()
- Returns:
- get the list of properties for this index. Returns null if no properties.
-
equalsIgnoreProperties
boolean equalsIgnoreProperties(Object obj)
Returns true if this and obj are 'effectively' equivalent indices. Ignores the time stamp on the file, as this may not be the same for even identical indices- Parameters:
obj
-- Returns:
-
-