Package htsjdk.tribble.index
Class AbstractIndex
java.lang.Object
htsjdk.tribble.index.AbstractIndex
- All Implemented Interfaces:
Index,MutableIndex
- Direct Known Subclasses:
IntervalTreeIndex,LinearIndex
An abstract implementation of the index class. This class takes care of the basics that are common
to all of the current indexing classes; including the version information, common header properties,
and reading and writing the header to disk.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classstatic enum -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptioncreate an abstract index, with defaults for the version value, and empty properties and chromosome listsAbstractIndex(AbstractIndex parent) AbstractIndex(File featureFile) AbstractIndex(String featureFile) create an index file from the target feature fileAbstractIndex(Path featurePath) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddProperties(Map<String, String> properties) voidaddProperty(String key, String value) booleancontainsChromosome(String chr) booleanReturns true if this and obj are 'effectively' equivalent indices.voidQuery the index.protected AbstractIndex.BlockStatsgetBlockStats(boolean logDetails) abstract Classreturns the class for the index typeintgetFlags()Deprecated.on 03/2017.longlongreturn a mapping of name to property valueprotected abstract intgetType()get the index typeintbooleanbooleanhasMD5()booleanbooleancheck the current version against the version we read inprotected voidvoidvoidprotected Stringprotected voidvalidateIndexHeader(int indexType, LittleEndianInputStream dis) voidwrite(LittleEndianOutputStream stream) all indexes are writable to diskvoidWrites the index into a path.voidwriteBasedOnFeaturePath(Path featurePath) Write an appropriately named and located Index file based on the name and location of the featureFile.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface htsjdk.tribble.index.Index
write, writeBasedOnFeatureFile
-
Field Details
-
VERSION
public static final int VERSION- See Also:
-
MAGIC_NUMBER
public static final int MAGIC_NUMBER- See Also:
-
version
protected int version -
indexedPath
-
indexedFileSize
protected long indexedFileSize -
indexedFileTS
protected long indexedFileTS -
indexedFileMD5
-
flags
protected int flags -
logger
-
chrIndices
the map of our chromosome bins
-
-
Constructor Details
-
AbstractIndex
public AbstractIndex()create an abstract index, with defaults for the version value, and empty properties and chromosome lists -
AbstractIndex
create an index file from the target feature file- Parameters:
featureFile- the feature file to create an index from
-
AbstractIndex
-
AbstractIndex
-
AbstractIndex
-
-
Method Details
-
hasFileSize
public boolean hasFileSize() -
hasTimestamp
public boolean hasTimestamp() -
hasMD5
public boolean hasMD5() -
equalsIgnoreProperties
Description copied from interface:IndexReturns 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- Specified by:
equalsIgnorePropertiesin interfaceIndex- Parameters:
obj-- Returns:
- true if this and obj are 'effectively' equivalent data structures.
-
validateIndexHeader
- Throws:
IOException
-
isCurrentVersion
public boolean isCurrentVersion()check the current version against the version we read in- Specified by:
isCurrentVersionin interfaceIndex- Returns:
- true if we're up to date, false otherwise
-
getIndexedFile
Deprecated.on 03/2017. UsegetIndexedPath()instead.Gets the indexed file.- Throws:
UnsupportedOperationException- if the path cannot be represented as a file.
-
getIndexedPath
-
getIndexedFileSize
public long getIndexedFileSize() -
getIndexedFileTS
public long getIndexedFileTS() -
getIndexedFileMD5
-
getFlags
public int getFlags() -
getVersion
public int getVersion() -
setMD5
-
containsChromosome
- Specified by:
containsChromosomein interfaceIndex- Parameters:
chr- the chromosome (or contig) name- Returns:
- true if we have an entry; false otherwise
-
finalizeIndex
public void finalizeIndex() -
getSequenceNames
- Specified by:
getSequenceNamesin interfaceIndex- Returns:
- a list of the sequence names we've seen during indexing, in order
-
getBlocks
Description copied from interface:IndexQuery the index. -
getBlocks
-
write
Description copied from interface:Indexall indexes are writable to disk- Specified by:
writein interfaceIndex- 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
Description copied from interface:IndexWrites the index into a path.- Specified by:
writein interfaceIndex- Parameters:
idxPath- Where to write the index.- Throws:
IOException- if the index is unable to write to the specified path.
-
writeBasedOnFeaturePath
Description copied from interface:IndexWrite 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.- Specified by:
writeBasedOnFeaturePathin interfaceIndex- Throws:
IOException- if featureFile is not a normal file.
-
read
- Throws:
IOException
-
printIndexInfo
protected void printIndexInfo() -
getBlockStats
-
statsSummary
-
addProperty
- Specified by:
addPropertyin interfaceMutableIndex
-
addProperties
- Specified by:
addPropertiesin interfaceMutableIndex
-
getProperties
return a mapping of name to property value- Specified by:
getPropertiesin interfaceIndex- Returns:
- the mapping of values as an unmodifiable map
-
getType
protected abstract int getType()get the index type- Returns:
- The index type
-
getChrIndexClass
returns the class for the index type- Returns:
- a Class, from which a new instance can be created
-