java.lang.Object
com.compomics.util.experiment.identification.protein_inference.fm_index.WaveletTree
All Implemented Interfaces:
Serializable

public class WaveletTree
extends Object
implements Serializable
Wavelet tree.
Author:
Dominik Kopczynski
See Also:
Serialized Form
  • Constructor Details

    • WaveletTree

      public WaveletTree()
      Empty default constructor.
    • WaveletTree

      public WaveletTree​(byte[] text, long[] aAlphabet, WaitingHandler waitingHandler)
      Constructor.
      Parameters:
      text - the text
      aAlphabet - the alphabet
      waitingHandler - the waiting handler
    • WaveletTree

      public WaveletTree​(byte[] text, WaitingHandler waitingHandler, WaveletTree.HuffmanNode root)
      Constructor.
      Parameters:
      text - the text
      waitingHandler - the waiting handler
      root - the root
  • Method Details

    • getLength

      public int getLength()
    • createWaveletTreeHuffman

      public void createWaveletTreeHuffman​(byte[] text, WaitingHandler waitingHandler, WaveletTree.HuffmanNode root)
      Create wavelet tree huffman.
      Parameters:
      text - the text
      waitingHandler - the waiting handler
      root - the root
    • createLessTable

      public int[] createLessTable()
      Create the less table.
      Returns:
      the less table
    • getRank

      public int getRank​(int index, int character)
      Returns the number of occurrences of a given character until position index.
      Parameters:
      index - the index
      character - the character
      Returns:
      the rank
    • getRankRecursive

      public int getRankRecursive​(int index, int character)
      Returns the number of occurrences of a given character until position index.
      Parameters:
      index - the index
      character - the character
      Returns:
      the rank
    • getCharacterInfo

      public int[] getCharacterInfo​(int index)
      Returns the character and rank at a given index.
      Parameters:
      index - the index
      Returns:
      the character and rank
    • getAllocatedBytes

      public int getAllocatedBytes()
      Returns the number of bytes for the allocated arrays.
      Returns:
      number of allocated bytes
    • rangeQuery

      public ArrayList<int[]> rangeQuery​(int leftIndex, int rightIndex)
      Returns a list of character and new left/right index for a given range.
      Parameters:
      leftIndex - left index boundary
      rightIndex - right index boundary
      Returns:
      list of counted characters
    • rangeQuery

      public void rangeQuery​(int leftIndex, int rightIndex, ArrayList<int[]> setCharacter)
      Fills a list of character and new left/right index for a given range.
      Parameters:
      leftIndex - left index boundary
      rightIndex - right index boundary
      setCharacter - list of counted characters
    • rangeQueryOneValue

      public void rangeQueryOneValue​(int index, ArrayList<int[]> setCharacter)
      Fills a list of character and new left/right index for a given index.
      Parameters:
      index - index boundary
      setCharacter - list of counted characters
    • singleRangeQuery

      public int[] singleRangeQuery​(int leftIndex, int rightIndex, int character)
      Returns a new left/right index range for a given character recursively.
      Parameters:
      leftIndex - left index boundary
      rightIndex - right index boundary
      character - character to check
      Returns:
      a list of character and new left/right index for a given range
    • select

      public int select​(int occurrence, int character)
      Inverse function to the rank function: given the i'th occurrence of a character in the tree, it provides its position
      Parameters:
      occurrence - the i'th occurrence
      character - the character to check
      Returns:
      the position of the i'th occurrence of the character