Interface Packing

  • All Known Implementing Classes:
    DNAAmbPack, DNANoAmbPack

    public interface Packing

    An encapsulation of the way symbols map to bit-patterns.

    A packing will encapsulate the process of converting between symbols and bit-patterns. For example, in DNA you could use 00, 01, 10 and 11 to represent the four bases (a, g, c, t). Many applications may require a specific packing. You may need to store full ambiguity information, or perhaps you can discard this capability to reduce stoorage space. You may care about the bit-pattern produced because you need interoperability or an algorithm needs to be fed correctly, or you may not care about the packing at all. This interface is here to allow you to chose the most appropreate packing for your task.

    Matthew Pocock
    • Method Detail

      • getAlphabet

        FiniteAlphabet getAlphabet()
        The FiniteAlphabet this packing is for.
        the FiniteAlphabet that we can pack
      • pack

        byte pack​(Symbol sym)
           throws IllegalSymbolException

        Return a byte representing the packing of a symbol. The bits will be from 1 >> 0 through to 1 >> (wordSize - 1).

        sym - the Symbol to pack
        a byte containing the packed symbol
        IllegalSymbolException - if sym is not in getAlphabet().
      • wordSize

        byte wordSize()

        The number of bits required to pack a symbol.

        the word size as a byte
      • handlesAmbiguity

        boolean handlesAmbiguity()

        Flag to state if ambiguities are stored.

        Packings are free to either store ambiguity information or to discard it (presumably converting all ambiguities to a standard AtomicSymbol and then packing that). You can check wether ambiguities are handled by calling this method.

        true if ambiguities are stored, false otherwise