public class MappedDataStoreFactory extends java.lang.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] nameArray // byte offset into nameTable 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 seqIndex, // index into nameArray int offset // offset into the sequence
Constructor and Description |
---|
MappedDataStoreFactory() |
Modifier and Type | Method and Description |
---|---|
DataStore |
buildDataStore(java.io.File storeFile,
SequenceDB seqDB,
Packing packing,
int wordLength,
int threshold)
Build a new DataStore.
|
DataStore |
getDataStore(java.io.File storeFile)
Get a pre-built data store associated with a file.
|
public DataStore getDataStore(java.io.File storeFile) throws java.io.IOException
DataStoreFactory
getDataStore
in interface DataStoreFactory
storeFile
- the File to map in as a data storejava.io.IOException
- if the file could not be mappedpublic DataStore buildDataStore(java.io.File storeFile, SequenceDB seqDB, Packing packing, int wordLength, int threshold) throws IllegalAlphabetException, java.io.IOException, BioException
DataStoreFactory
buildDataStore
in interface DataStoreFactory
storeFile
- the file to store the data storeseqDB
- the SequenceDB to store in the data storepacking
- the Packing used to bit-encode the sequenceswordLength
- the number of symbols per wordthreshold
- the number of times a word must appear to be ignoredIllegalAlphabetException
- if the packing does not agree with
the sequencesBioException
- if there is a problem building the data storejava.io.IOException