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.
  • Constructor Details

  • 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