org.biojava3.core.sequence.storage
Class FourBitSequenceReader.FourBitArrayWorker<C extends Compound>

java.lang.Object
  extended by org.biojava3.core.sequence.storage.BitSequenceReader.BitArrayWorker<C>
      extended by org.biojava3.core.sequence.storage.FourBitSequenceReader.FourBitArrayWorker<C>
Type Parameters:
C - Must extend NucleotideCompound
Enclosing class:
FourBitSequenceReader<C extends Compound>

public static class FourBitSequenceReader.FourBitArrayWorker<C extends Compound>
extends BitSequenceReader.BitArrayWorker<C>

A four bit per compound implementation of the bit array worker code. This version can handle upto 16 compounds but this does mean that its ability to compress a normal sequence is halved (compared to the 1/4 performance seen with the 2bit workers).


Field Summary
 
Fields inherited from class org.biojava3.core.sequence.storage.BitSequenceReader.BitArrayWorker
BYTES_PER_INT
 
Constructor Summary
FourBitSequenceReader.FourBitArrayWorker(CompoundSet<C> compoundSet, int length)
           
FourBitSequenceReader.FourBitArrayWorker(CompoundSet<C> compoundSet, int[] sequence)
           
FourBitSequenceReader.FourBitArrayWorker(Sequence<C> sequence)
           
FourBitSequenceReader.FourBitArrayWorker(String sequence, CompoundSet<C> compoundSet)
           
 
Method Summary
protected  byte bitMask()
          This method should return the bit mask to be used to extract the bytes you are interested in working with.
protected  int compoundsPerDatatype()
          Should return the maximum amount of compounds we can encode per int
protected  Map<C,Integer> generateCompoundsToIndex()
          Returns a Map which encodes the contents of CompoundSet.
protected  List<C> generateIndexToCompounds()
          Returns a List which reverse encodes the Compound, Integer map
 
Methods inherited from class org.biojava3.core.sequence.storage.BitSequenceReader.BitArrayWorker
bitsPerCompound, equals, getCompoundAt, getCompoundSet, getCompoundsToIndexLookup, getIndexToCompoundsLookup, getLength, hashCode, populate, populate, processUnknownCompound, seqArraySize, setCompoundAt, setCompoundAt
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FourBitSequenceReader.FourBitArrayWorker

public FourBitSequenceReader.FourBitArrayWorker(CompoundSet<C> compoundSet,
                                                int length)

FourBitSequenceReader.FourBitArrayWorker

public FourBitSequenceReader.FourBitArrayWorker(CompoundSet<C> compoundSet,
                                                int[] sequence)

FourBitSequenceReader.FourBitArrayWorker

public FourBitSequenceReader.FourBitArrayWorker(Sequence<C> sequence)

FourBitSequenceReader.FourBitArrayWorker

public FourBitSequenceReader.FourBitArrayWorker(String sequence,
                                                CompoundSet<C> compoundSet)
Method Detail

bitMask

protected byte bitMask()
Description copied from class: BitSequenceReader.BitArrayWorker
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

Specified by:
bitMask in class BitSequenceReader.BitArrayWorker<C extends Compound>

compoundsPerDatatype

protected int compoundsPerDatatype()
Description copied from class: BitSequenceReader.BitArrayWorker
Should return the maximum amount of compounds we can encode per int

Specified by:
compoundsPerDatatype in class BitSequenceReader.BitArrayWorker<C extends Compound>

generateCompoundsToIndex

protected Map<C,Integer> generateCompoundsToIndex()
Returns a Map which encodes the contents of CompoundSet. This version is case-insensitive i.e. C and c both encode for the same position. We sort lexigraphically so if the compound set has not changed then neither will this.

Specified by:
generateCompoundsToIndex in class BitSequenceReader.BitArrayWorker<C extends Compound>

generateIndexToCompounds

protected List<C> generateIndexToCompounds()
Returns a List which reverse encodes the Compound, Integer map

Specified by:
generateIndexToCompounds in class BitSequenceReader.BitArrayWorker<C extends Compound>