Class LinearIndex.ChrIndex

java.lang.Object
htsjdk.tribble.index.linear.LinearIndex.ChrIndex
All Implemented Interfaces:
ChrIndex
Enclosing class:
LinearIndex

public static class LinearIndex.ChrIndex extends Object implements ChrIndex
Blocks are organized as a simple flat list:

Block 0 Block 1 Block 2

There's a constant bin width, so that each block corresponds to a specific interval over the genome based on its index, as in:

Block 0: (0 - binWidth] Block 1: (binWidth - 2 * binWidth] Block 2: (2 * binWidth - 3 * binWidth]

Note that covered regions are open on the left ( and closed on the right ].

In general, if block i is the ith block (starting from 0), then block i contains all records that have starting position > (i * binWidth) and <= ((i + 1) * binWidth))

  • Constructor Details

    • ChrIndex

      public ChrIndex()
      Default constructor needed for factory methods -- DO NOT REMOVE
  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface ChrIndex
    • getNBlocks

      public int getNBlocks()
    • getBlocks

      public List<Block> getBlocks()
      Specified by:
      getBlocks in interface ChrIndex
      Returns:
      all blocks in ChrIndex
    • getBlocks

      public List<Block> getBlocks(int start, int end)
      Specified by:
      getBlocks in interface ChrIndex
      Parameters:
      start - the start position, one based
      end - the end position, one based
      Returns:
      a list of blocks that include the region defined from start to stop. Can never return null
    • updateLongestFeature

      public void updateLongestFeature(int featureLength)
    • getNFeatures

      public int getNFeatures()
    • incrementFeatureCount

      public void incrementFeatureCount()
    • write

      public void write(LittleEndianOutputStream dos) throws IOException
      Specified by:
      write in interface ChrIndex
      Throws:
      IOException
    • read

      public void read(LittleEndianInputStream dis) throws IOException
      Specified by:
      read in interface ChrIndex
      Throws:
      IOException
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getTotalSize

      public long getTotalSize()
      Returns:
      Total size of all blocks
    • getAverageFeatureSize

      public double getAverageFeatureSize()
    • getFeaturesPerBlock

      public double getFeaturesPerBlock()
    • optimize

      public LinearIndex.ChrIndex optimize(double threshold)