Package org.biojava.bio.seq.db
Class BioIndex
java.lang.Object
org.biojava.bio.seq.db.BioIndex
- All Implemented Interfaces:
IndexStore
The original object for indexing sequence files.
This class may not be thread-safe.
- Author:
- Matthew Pocock, Thomas Down
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcommit()Commit the stored indices to permanent storage.Fetch an Index based upon an ID.getFiles()Retrieve the Set of files that are currently indexed.Retrieve the format of the index file.getIDs()Retrieve the set of all current IDs.getName()Retrieve the name of this store.Retrieve the SequenceBuilderFactory used to build Sequence instances.Retrieve the symbol parser used to turn the sequence characters into Symobl objects.intguessRecLen(RandomAccessFile file) voidrollback()Discard all uncommited changes.voidAdd the Index to the store.
-
Constructor Details
-
BioIndex
public BioIndex(File indexDirectory, String namespace, int idLength) throws IOException, BioException - Throws:
IOExceptionBioException
-
BioIndex
Load an existing index file. If indexDirectory does not exist, or is not a bioindex stoore, this will barf.- Throws:
IOExceptionBioException
-
-
Method Details
-
getName
Description copied from interface:IndexStoreRetrieve the name of this store. This will be reflected as the name of the IndexedSequenceDB.- Specified by:
getNamein interfaceIndexStore- Returns:
- the String name of the index
-
guessRecLen
- Throws:
IOException
-
fetch
Description copied from interface:IndexStoreFetch an Index based upon an ID.- Specified by:
fetchin interfaceIndexStore- Parameters:
id- The ID of the sequence Index to retrieve- Throws:
IllegalIDException- if the ID couldn't be foundBioException- if the fetch fails in the underlying storage mechanism
-
store
Description copied from interface:IndexStoreAdd the Index to the store.This method should be transactional. If the store fails, the IndexStore should be left in its original state.
If the file of the Index is not known yet, it is the responsibility of the IndexStore to add it to the set returned by getFiles.
- Specified by:
storein interfaceIndexStore- Parameters:
indx- the Index to add
-
commit
Description copied from interface:IndexStoreCommit the stored indices to permanent storage.- Specified by:
commitin interfaceIndexStore- Throws:
BioException- if for any reason the commit fails
-
rollback
Description copied from interface:IndexStoreDiscard all uncommited changes.- Specified by:
rollbackin interfaceIndexStore
-
getIDs
Description copied from interface:IndexStoreRetrieve the set of all current IDs.This set should either be immutable, or modifiable totally separately from the IndexStore.
- Specified by:
getIDsin interfaceIndexStore- Returns:
- a Set of all legal IDs
-
getFiles
Description copied from interface:IndexStoreRetrieve the Set of files that are currently indexed.- Specified by:
getFilesin interfaceIndexStore
-
getFormat
Description copied from interface:IndexStoreRetrieve the format of the index file.This set should either be immutable, or modifiable totally separately from the IndexStore.
- Specified by:
getFormatin interfaceIndexStore- Returns:
- a Set of all indexed files
-
getSBFactory
Description copied from interface:IndexStoreRetrieve the SequenceBuilderFactory used to build Sequence instances.- Specified by:
getSBFactoryin interfaceIndexStore- Returns:
- the associated SequenceBuilderFactory
-
getSymbolParser
Description copied from interface:IndexStoreRetrieve the symbol parser used to turn the sequence characters into Symobl objects.- Specified by:
getSymbolParserin interfaceIndexStore- Returns:
- the associated SymbolParser
-