Index
, MutableIndex
IntervalTreeIndex
, LinearIndex
public abstract class AbstractIndex extends Object implements MutableIndex
Modifier and Type | Class | Description |
---|---|---|
protected static class |
AbstractIndex.BlockStats |
|
static class |
AbstractIndex.IndexType |
Modifier and Type | Field | Description |
---|---|---|
protected LinkedHashMap<String,ChrIndex> |
chrIndices |
the map of our chromosome bins
|
protected int |
flags |
|
protected String |
indexedFileMD5 |
|
protected long |
indexedFileSize |
|
protected long |
indexedFileTS |
|
protected Path |
indexedPath |
|
protected Log |
logger |
|
static int |
MAGIC_NUMBER |
|
protected int |
version |
|
static int |
VERSION |
Constructor | Description |
---|---|
AbstractIndex() |
create an abstract index, with defaults for the version value, and empty properties and chromosome lists
|
AbstractIndex(AbstractIndex parent) |
|
AbstractIndex(File featureFile) |
|
AbstractIndex(String featureFile) |
create an index file from the target feature file
|
AbstractIndex(Path featurePath) |
Modifier and Type | Method | Description |
---|---|---|
void |
addProperties(Map<String,String> properties) |
|
void |
addProperty(String key,
String value) |
|
boolean |
containsChromosome(String chr) |
|
boolean |
equalsIgnoreProperties(Object obj) |
Returns true if this and obj are 'effectively' equivalent indices.
|
void |
finalizeIndex() |
|
List<Block> |
getBlocks(String chr) |
|
List<Block> |
getBlocks(String chr,
int start,
int end) |
Query the index.
|
protected AbstractIndex.BlockStats |
getBlockStats(boolean logDetails) |
|
abstract Class |
getChrIndexClass() |
returns the class for the index type
|
int |
getFlags() |
|
File |
getIndexedFile() |
Deprecated.
on 03/2017.
|
String |
getIndexedFileMD5() |
|
long |
getIndexedFileSize() |
|
long |
getIndexedFileTS() |
|
Path |
getIndexedPath() |
|
Map<String,String> |
getProperties() |
return a mapping of name to property value
|
List<String> |
getSequenceNames() |
|
protected abstract int |
getType() |
get the index type
|
int |
getVersion() |
|
boolean |
hasFileSize() |
|
boolean |
hasMD5() |
|
boolean |
hasTimestamp() |
|
boolean |
isCurrentVersion() |
check the current version against the version we read in
|
protected void |
printIndexInfo() |
|
void |
read(LittleEndianInputStream dis) |
|
void |
setMD5(String md5) |
|
protected String |
statsSummary() |
|
protected void |
validateIndexHeader(int indexType,
LittleEndianInputStream dis) |
|
void |
write(LittleEndianOutputStream stream) |
all indexes are writable to disk
|
void |
write(Path idxPath) |
Writes the index into a path.
|
void |
writeBasedOnFeaturePath(Path featurePath) |
Write an appropriately named and located Index file based on the name and location of the featureFile.
|
write, writeBasedOnFeatureFile
public static final int VERSION
public static final int MAGIC_NUMBER
protected int version
protected Path indexedPath
protected long indexedFileSize
protected long indexedFileTS
protected String indexedFileMD5
protected int flags
protected final Log logger
protected LinkedHashMap<String,ChrIndex> chrIndices
public AbstractIndex()
public AbstractIndex(String featureFile)
featureFile
- the feature file to create an index frompublic AbstractIndex(File featureFile)
public AbstractIndex(Path featurePath)
public AbstractIndex(AbstractIndex parent)
public boolean hasFileSize()
public boolean hasTimestamp()
public boolean hasMD5()
public boolean equalsIgnoreProperties(Object obj)
Index
equalsIgnoreProperties
in interface Index
obj
- protected void validateIndexHeader(int indexType, LittleEndianInputStream dis) throws IOException
IOException
public boolean isCurrentVersion()
isCurrentVersion
in interface Index
@Deprecated public File getIndexedFile()
getIndexedPath()
instead.UnsupportedOperationException
- if the path cannot be represented as a file.public Path getIndexedPath()
public long getIndexedFileSize()
public long getIndexedFileTS()
public String getIndexedFileMD5()
public int getFlags()
public int getVersion()
public void setMD5(String md5)
public boolean containsChromosome(String chr)
containsChromosome
in interface Index
chr
- the chromosome (or contig) namepublic void finalizeIndex()
public List<String> getSequenceNames()
getSequenceNames
in interface Index
public List<Block> getBlocks(String chr, int start, int end)
Index
public void write(LittleEndianOutputStream stream) throws IOException
Index
write
in interface Index
stream
- the stream to write the index to. Caller must close after invocation.IOException
- if the index is unable to write to the specified locationpublic void write(Path idxPath) throws IOException
Index
write
in interface Index
idxPath
- Where to write the index.IOException
- if the index is unable to write to the specified path.public void writeBasedOnFeaturePath(Path featurePath) throws IOException
Index
writeBasedOnFeaturePath
in interface Index
IOException
- if featureFile is not a normal file.public void read(LittleEndianInputStream dis) throws IOException
IOException
protected void printIndexInfo()
protected AbstractIndex.BlockStats getBlockStats(boolean logDetails)
protected String statsSummary()
public void addProperty(String key, String value)
addProperty
in interface MutableIndex
public void addProperties(Map<String,String> properties)
addProperties
in interface MutableIndex
public Map<String,String> getProperties()
getProperties
in interface Index
protected abstract int getType()
public abstract Class getChrIndexClass()