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 class`
`LinearIndex.ChrIndex`
Blocks 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 boolean`
`enableAdaptiveIndexing`
`static final int`
`INDEX_TYPE`
`static final double`
`MAX_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 parameters
`LinearIndex(Path featurePath)`
Initialize with default parameters
`LinearIndex(List<LinearIndex.ChrIndex> indices, File featureFile)`
Initialize using the specified `indices`
`LinearIndex(List<LinearIndex.ChrIndex> indices, Path featureFile)`
Initialize using the specified `indices`

## Method Summary

Modifier and Type
Method
Description
`Class`
`getChrIndexClass()`
returns the class for the index type
`List<String>`
`getSequenceNames()`
`protected int`
`getType()`
get the index type
`boolean`
`isCurrentVersion()`
check the current version against the version we read in
`Index`
`optimize()`
`Index`
`optimize(double threshold)`
Adapative optimization of the linear index
`protected final void`
`setTS(long ts)`
`void`
`writeTable(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`

## Field Details

### MAX_FEATURES_PER_BIN

public static final double MAX_FEATURES_PER_BIN

### INDEX_TYPE

public static final int INDEX_TYPE

### enableAdaptiveIndexing

public static boolean enableAdaptiveIndexing

## Constructor Details

### LinearIndex

public LinearIndex(List<LinearIndex.ChrIndex> indices, Path featureFile)
Initialize using the specified `indices`

Parameters:
  `indices` -
  `featureFile` -

### LinearIndex

public LinearIndex(List<LinearIndex.ChrIndex> indices, File featureFile)
Initialize using the specified `indices`

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 Details

### isCurrentVersion

public boolean isCurrentVersion()
Description copied from class: `AbstractIndex`
check the current version against the version we read in

Specified by:
  `isCurrentVersion` in interface `Index`
Overrides:
  `isCurrentVersion` in class `AbstractIndex`
Returns:
  true if we're up to date, false otherwise

### getType

protected int getType()
Description copied from class: `AbstractIndex`
get the index type

Specified by:
  `getType` in class `AbstractIndex`
Returns:
  The index type

### getSequenceNames

public List<String> getSequenceNames()

Specified by:
  `getSequenceNames` in interface `Index`
Overrides:
  `getSequenceNames` in class `AbstractIndex`
Returns:
  a list of the sequence names we've seen during indexing, in order

### getChrIndexClass

public Class getChrIndexClass()
Description copied from class: `AbstractIndex`
returns the class for the index type

Specified by:
  `getChrIndexClass` in class `AbstractIndex`
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 constituent `chrIndex`
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)