Class BitSequenceReader.BitArrayWorker<C extends Compound>

    • Method Detail

      • bitMask

        protected abstract byte bitMask()
        This method should return the bit mask to be used to extract the bytes you are interested in working with. See solid implementations on how to create these
      • compoundsPerDatatype

        protected abstract int compoundsPerDatatype()
        Should return the maximum amount of compounds we can encode per int
      • generateCompoundsToIndex

        protected abstract Map<C,​IntegergenerateCompoundsToIndex()
        Returns what the value of a compound is in the backing bit storage i.e. in 2bit storage the value 0 is encoded as 00 (in binary).
      • bitsPerCompound

        protected int bitsPerCompound()
        Returns how many bits are used to represent a compound e.g. 2 if using 2bit encoding.
      • setCompoundAt

        public void setCompoundAt​(char base,
                                  int position)
        Converts from char to Compound and sets it at the given biological index
      • setCompoundAt

        public void setCompoundAt​(C compound,
                                  int position)
        Sets the compound at the specified biological index
      • getCompoundAt

        public C getCompoundAt​(int position)
        Returns the compound at the specified biological index
      • processUnknownCompound

        protected byte processUnknownCompound​(C compound,
                                              int position)
                                       throws IllegalStateException
        Since bit encoding only supports a finite number of bases it is more than likely when processing sequence you will encounter a compound which is not covered by the encoding e.g. N in a 2bit sequence. You can override this to convert the unknown base into one you can process or store locations of unknown bases for a level of post processing in your subclass.
        compound - Compound process
        Byte representation of the compound
        IllegalStateException - Done whenever this method is invoked
      • getIndexToCompoundsLookup

        protected List<CgetIndexToCompoundsLookup()
        Returns a list of compounds the index position of which is used to translate from the byte representation into a compound.