Package htsjdk.tribble.index.linear
Class LinearIndex
- java.lang.Object
-
- htsjdk.tribble.index.AbstractIndex
-
- htsjdk.tribble.index.linear.LinearIndex
-
- All Implemented Interfaces:
Index,MutableIndex
public class LinearIndex extends AbstractIndex
Index defined by dividing the genome by chromosome, then each chromosome into bins of fixed width (in genomic coordinates). Features are allocated to bins by start position. The longest feature in each recorded and used to adjust the start position of a query to include all bins that might have a feature that overlaps the query interval. This works well for feature sets of approximately homogeneous length, or whose longest feature is on the order of the bin width or less. magicNumber integer type integer version integer filename null terminated character array filesize long lastModified long md5 String flags integer ------ LINEAR INDEX nChromosomes integer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLinearIndex.ChrIndexBlocks are organized as a simple flat list:-
Nested classes/interfaces inherited from class htsjdk.tribble.index.AbstractIndex
AbstractIndex.BlockStats, AbstractIndex.IndexType
-
-
Field Summary
Fields Modifier and Type Field Description static booleanenableAdaptiveIndexingstatic intINDEX_TYPEstatic doubleMAX_FEATURES_PER_BIN-
Fields inherited from class htsjdk.tribble.index.AbstractIndex
chrIndices, flags, indexedFileMD5, indexedFileSize, indexedFileTS, indexedPath, logger, MAGIC_NUMBER, version, VERSION
-
-
Constructor Summary
Constructors Constructor Description LinearIndex(InputStream inputStream)Load from file.LinearIndex(String featureFile)Initialize with default parametersLinearIndex(Path featurePath)Initialize with default parametersLinearIndex(List<LinearIndex.ChrIndex> indices, File featureFile)Initialize using the specifiedindicesLinearIndex(List<LinearIndex.ChrIndex> indices, Path featureFile)Initialize using the specifiedindices
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClassgetChrIndexClass()returns the class for the index typeList<String>getSequenceNames()protected intgetType()get the index typebooleanisCurrentVersion()check the current version against the version we read inIndexoptimize()Indexoptimize(double threshold)Adapative optimization of the linear indexprotected voidsetTS(long ts)voidwriteTable(PrintStream out)Code to convert linear index to a text table for analysis-
Methods inherited from class htsjdk.tribble.index.AbstractIndex
addProperties, addProperty, containsChromosome, equalsIgnoreProperties, finalizeIndex, getBlocks, getBlocks, getBlockStats, getFlags, getIndexedFile, getIndexedFileMD5, getIndexedFileSize, getIndexedFileTS, getIndexedPath, getProperties, getVersion, hasFileSize, hasMD5, hasTimestamp, printIndexInfo, read, setMD5, statsSummary, validateIndexHeader, write, write, writeBasedOnFeaturePath
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface htsjdk.tribble.index.Index
write, writeBasedOnFeatureFile
-
-
-
-
Constructor Detail
-
LinearIndex
public LinearIndex(List<LinearIndex.ChrIndex> indices, Path featureFile)
Initialize using the specifiedindices- Parameters:
indices-featureFile-
-
LinearIndex
public LinearIndex(List<LinearIndex.ChrIndex> indices, File featureFile)
Initialize using the specifiedindices- Parameters:
indices-featureFile-
-
LinearIndex
public LinearIndex(String featureFile)
Initialize with default parameters- Parameters:
featureFile- File for which this is an index
-
LinearIndex
public LinearIndex(Path featurePath)
Initialize with default parameters- Parameters:
featurePath- Path for which this is an index
-
LinearIndex
public LinearIndex(InputStream inputStream) throws IOException
Load from file.- Parameters:
inputStream- This method assumes that the input stream is already buffered as appropriate.- Throws:
IOException
-
-
Method Detail
-
isCurrentVersion
public boolean isCurrentVersion()
Description copied from class:AbstractIndexcheck the current version against the version we read in- Specified by:
isCurrentVersionin interfaceIndex- Overrides:
isCurrentVersionin classAbstractIndex- Returns:
- true if we're up to date, false otherwise
-
getType
protected int getType()
Description copied from class:AbstractIndexget the index type- Specified by:
getTypein classAbstractIndex- Returns:
- The index type
-
getSequenceNames
public List<String> getSequenceNames()
- Specified by:
getSequenceNamesin interfaceIndex- Overrides:
getSequenceNamesin classAbstractIndex- Returns:
- a list of the sequence names we've seen during indexing, in order
-
getChrIndexClass
public Class getChrIndexClass()
Description copied from class:AbstractIndexreturns the class for the index type- Specified by:
getChrIndexClassin classAbstractIndex- Returns:
- a Class, from which a new instance can be created
-
optimize
public Index optimize(double threshold)
Adapative optimization of the linear index- Parameters:
threshold- threshold to use for optimizing each constituentchrIndex- Returns:
- The new optimized index
-
optimize
public Index optimize()
-
writeTable
public void writeTable(PrintStream out)
Code to convert linear index to a text table for analysis- Parameters:
out- Stream to which to write out table to
-
setTS
protected final void setTS(long ts)
-
-