Package htsjdk.tribble.index

# Class DynamicIndexCreator

java.lang.Object
htsjdk.tribble.index.TribbleIndexCreator
htsjdk.tribble.index.DynamicIndexCreator

All Implemented Interfaces:
  `IndexCreator`

public class DynamicIndexCreator extends TribbleIndexCreator
A DynamicIndexCreator creates the proper index based on an `IndexFactory.IndexBalanceApproach` and the characteristics of the file. Ultimately this is either a LinearIndex or an IntervalTreeIndex, with index parameters based on whether seek time or file size is to be minimized.

## Field Summary

### Fields inherited from class htsjdk.tribble.index.TribbleIndexCreator

`properties`

## Constructor Summary

Constructors
Constructor
Description
`DynamicIndexCreator(File inputFile, IndexFactory.IndexBalanceApproach iba)`
`DynamicIndexCreator(Path inputPath, IndexFactory.IndexBalanceApproach iba)`

## Method Summary

Modifier and Type
Method
Description
`void`
`addFeature(Feature f, long filePosition)`
Add a feature to the index
`void`
`addProperty(String key, String value)`
`Index`
`finalizeIndex(long finalFilePosition)`
Create the index, given the stream of features passed in to this point
`protected static LinkedHashMap<Double,TribbleIndexCreator>`
`scoreIndexes(double densityOfFeatures, Map<IndexFactory.IndexType,TribbleIndexCreator> indexes, int longestFeature, IndexFactory.IndexBalanceApproach iba)`
score the available indexes for the specified density and feature lengths The scoring method is trying to determine how many features would be returned for a sample one base query; or: (features/seek).

### Methods inherited from class htsjdk.tribble.index.TribbleIndexCreator

`setIndexSequenceDictionary`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### DynamicIndexCreator

public DynamicIndexCreator(Path inputPath, IndexFactory.IndexBalanceApproach iba)

### DynamicIndexCreator

public DynamicIndexCreator(File inputFile, IndexFactory.IndexBalanceApproach iba)

## Method Details

### finalizeIndex

public Index finalizeIndex(long finalFilePosition)
Description copied from interface: `IndexCreator`
Create the index, given the stream of features passed in to this point

Parameters:
  `finalFilePosition` - the final file position, for indexes that have to close out with the final position
Returns:
  an index object

### addFeature

public void addFeature(Feature f, long filePosition)
Description copied from interface: `IndexCreator`
Add a feature to the index

Parameters:
  `f` - the feature, of which start, end, and contig must be filled in
  `filePosition` - the current file position, at the beginning of the specified feature

### scoreIndexes

protected static LinkedHashMap<Double,TribbleIndexCreator> scoreIndexes(double densityOfFeatures, Map<IndexFactory.IndexType,TribbleIndexCreator> indexes, int longestFeature, IndexFactory.IndexBalanceApproach iba)
score the available indexes for the specified density and feature lengths The scoring method is trying to determine how many features would be returned for a sample one base query; or: (features/seek). For the interval index this is clear: it's the bin size (interval is binned by feature count). for Linear indexes it's the density of features X the number of bins we need to retrieve (which is determined by the bin size X the longest feature).

Parameters:
  `densityOfFeatures` - the density of features (features/base)
  `indexes` - Map from IndexType -> IndexCreator
  `longestFeature` - the longest feature we've found
  `iba` - the index balancing approach
Returns:
  the best index available for the target indexes

### addProperty

public void addProperty(String key, String value)

Overrides:
  `addProperty` in class `TribbleIndexCreator`