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

  • 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)