## org.biojava.bio.program.ssaha
Class CompactedDataStoreFactory

    java.lang.Object
      org.biojava.bio.program.ssaha.CompactedDataStoreFactory

All Implemented Interfaces:
  DataStoreFactory

    public class CompactedDataStoreFactory

extends Object
implements DataStoreFactory

Builder for a data store that is backed by a java.nio.MappedByteBuffer. This has a limitation that the total size of the mapped buffer and therefore the hash table can not exceed 2 gigs.

The data store file has the following structure.

     file: header, hash table, nameArray, nameTable, hitTable

     header:
       int hashTablePos, // byte offset in file
       int hitTablePos,  // byte offset in file
       int nameArrayPos, // byte offset in file
       int nameTablePos, // byte offset in file
       int wordLength,
       int serializedPackingLength,
       byte[] serializedPacking

       hash table:
         int hashTableLength,
         int[hashTableLength] hits // index into hitTable

      nameArray:
        int nameArrayLength,
        int[nameArrayLength] nameRecord // byte offset into nameTable

      nameRecord:
        int nameTableOffset
        int sequenceStartOffset

      nameTable:
        int nameTableSize, // size in bytes
        (short nameLength, char[nameLength] name)[nameTableSize] names

      hitTable:
        int hitTableSize, // size in bytes
        hitTableRecord[hitTableSize] hits

      hitTableRecord:
        int hitCount,
        hitRecord[hitCount] hit

      hit:
        int offset    // offset into the sequence

Author:
  Matthew Pocock, Thomas Down

Constructor Summary
`CompactedDataStoreFactory()`

Method Summary
`DataStore` `buildDataStore(File storeFile, SequenceDB seqDB, Packing packing, int wordLength, int threshold)` Build a new DataStore.
`DataStore` `buildDataStore(File storeFile, SequenceStreamer streamer, Packing packing, int wordLength, int stepSize, int threshold)`
`DataStore` `getDataStore(File storeFile)` Get a pre-built data store associated with a file.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CompactedDataStoreFactory

    public CompactedDataStoreFactory()

Method Detail

### getDataStore

    public DataStore getDataStore(File storeFile)
                           throws IOException

  Description copied from interface: `DataStoreFactory`
  Get a pre-built data store associated with a file.

  Specified by:
    `getDataStore` in interface `DataStoreFactory`
  Parameters:
    `storeFile` - the File to map in as a data store
  Returns:
    the DataStore made by mapping the file
  Throws:
    `IOException` - if the file could not be mapped

### buildDataStore

    public DataStore buildDataStore(File storeFile,
                                    SequenceDB seqDB,
                                    Packing packing,
                                    int wordLength,
                                    int threshold)
                             throws IllegalAlphabetException,
                                    IOException,
                                    BioException

  Description copied from interface: `DataStoreFactory`
  Build a new DataStore.

  Specified by:
    `buildDataStore` in interface `DataStoreFactory`
  Parameters:
    `storeFile` - the file to store the data store
    `seqDB` - the SequenceDB to store in the data store
    `packing` - the Packing used to bit-encode the sequences
    `wordLength` - the number of symbols per word
    `threshold` - the number of times a word must appear to be ignored
  Throws:
    `IllegalAlphabetException` - if the packing does not agree with the sequences
    `BioException` - if there is a problem building the data store
    `IOException`

### buildDataStore

    public DataStore buildDataStore(File storeFile,
                                    SequenceStreamer streamer,
                                    Packing packing,
                                    int wordLength,
                                    int stepSize,
                                    int threshold)
                             throws IllegalAlphabetException,
                                    IOException,
                                    BioException

  Throws:
    `IllegalAlphabetException`
    `IOException`
    `BioException`