Package org.biojava.bio.program.indexdb
Class BioStoreFactory
java.lang.Object
org.biojava.bio.program.indexdb.BioStoreFactory
BioStoreFactory
creates BioStore
instances. These are directory and file structures which index flat
files according to the OBDA specification.- Author:
- Matthew Pocock, Keith James, Greg Cox
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
KEYS
is the key used to identify the secondary namespaces in the OBDA config.dat files.static final AnnotationType
AnnotationType that all meta-data files should fit.static final String
PRIMARY_KEY_NAME
is the key used to identify the primary namespace in the OBDA config.dat files.static final String
SEQUENCE_FORMAT
is the key used to identify the format of the indexed sequence files represented by the store in the OBDA config.dat files.static final String
STORE_NAME
is the key used to identify the arbitrary name of the store in the OBDA config.dat files. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addKey
adds a new identifier namespace.static int
calculatePrimRecLen
(int idLen) calculatePrimRecLen
calculates the byte length of primary namespace records.static int
calculateSecRecLen
(int idLen, String primaryKey, Map keys) calculateSecRecLen
calculates the byte length of secondary namespace records.createBioStore
creates aBioStore
reflecting the current state of the factory and returns a reference to it.getKeys()
getPrimaryKey
returns the primary identifier namespace.getSequenceFormat
returns the current sequence format name.getStoreLocation
returns the directory of the bew index.getStoreName
returns the name to be given to the new index.static File
makeConfigFile
(File storeLoc) makeConfigFile
returns a file which represents an OBDA "config.dat" in the specified index directory.static File
makePrimaryKeyFile
(File storeLoc, String key) makePrimaryKeyFile
returns a file which represents an OBDA "key_<primary namespace>.key" primary key file on the specified index directory.static File
makeSecondaryFile
(File storeLoc, String key) makeSecondaryFile
returns a file which represents an OBDA "id_<secondary namespace>.index" secondary key file on the specified.void
removeKey
removes the specified key.void
setPrimaryKey
(String primaryKey) setPrimaryKey
sets the primary identifier namespace.void
setSequenceFormat
sets the sequence format name which will be indicated in the index.void
setStoreLocation
(File storeLoc) setStoreLocation
sets the directory of the new index.void
setStoreName
(String name) setStoreName
sets the name to be given to the new index.
-
Field Details
-
STORE_NAME
STORE_NAME
is the key used to identify the arbitrary name of the store in the OBDA config.dat files.- See Also:
-
SEQUENCE_FORMAT
SEQUENCE_FORMAT
is the key used to identify the format of the indexed sequence files represented by the store in the OBDA config.dat files.- See Also:
-
PRIMARY_KEY_NAME
PRIMARY_KEY_NAME
is the key used to identify the primary namespace in the OBDA config.dat files.- See Also:
-
KEYS
KEYS
is the key used to identify the secondary namespaces in the OBDA config.dat files.- See Also:
-
META_DATA_TYPE
AnnotationType that all meta-data files should fit.
-
-
Constructor Details
-
BioStoreFactory
public BioStoreFactory()Creates a newBioStoreFactory
.
-
-
Method Details
-
setStoreName
setStoreName
sets the name to be given to the new index.- Parameters:
name
- aString
.
-
getStoreName
getStoreName
returns the name to be given to the new index.- Returns:
- a
String
.
-
setStoreLocation
setStoreLocation
sets the directory of the new index.- Parameters:
storeLoc
- aFile
.
-
getStoreLocation
getStoreLocation
returns the directory of the bew index.- Returns:
- a
File
.
-
setSequenceFormat
setSequenceFormat
sets the sequence format name which will be indicated in the index.- Parameters:
format
- aLifeScienceIdentifier
which must be one of those mandated by the OBDA flatfile indexing specification.
-
getSequenceFormat
getSequenceFormat
returns the current sequence format name.- Returns:
- a
LifeScienceIdentifier
.
-
setPrimaryKey
setPrimaryKey
sets the primary identifier namespace.- Parameters:
primaryKey
- aString
.
-
getPrimaryKey
getPrimaryKey
returns the primary identifier namespace.- Returns:
- a
String
.
-
addKey
addKey
adds a new identifier namespace.- Parameters:
keyName
- aString
.length
- anint
indicating the byte length of the key records.
-
getKeys
-
removeKey
removeKey
removes the specified key.- Parameters:
keyName
- aString
.
-
createBioStore
createBioStore
creates aBioStore
reflecting the current state of the factory and returns a reference to it.- Returns:
- a
BioStore
. - Throws:
BioException
- if an error occurs.
-
makeConfigFile
makeConfigFile
returns a file which represents an OBDA "config.dat" in the specified index directory.- Parameters:
storeLoc
- aFile
indicating the index directory.- Returns:
- a
File
representing "config.dat". - Throws:
IOException
- if an error occurs.
-
makePrimaryKeyFile
makePrimaryKeyFile
returns a file which represents an OBDA "key_<primary namespace>.key" primary key file on the specified index directory.- Parameters:
storeLoc
- aFile
indicating the parent path.key
- aString
primary key namespace.- Returns:
- a
File
representing a "key_<primary namespace>.key". - Throws:
IOException
- if an error occurs.
-
makeSecondaryFile
makeSecondaryFile
returns a file which represents an OBDA "id_<secondary namespace>.index" secondary key file on the specified.- Parameters:
storeLoc
- aFile
indicating the parent path.key
- aString
secondary key namespace.- Returns:
- a
File
representing an "id_<secondary namespace>.index" file. - Throws:
IOException
- if an error occurs.
-
calculatePrimRecLen
calculatePrimRecLen
calculates the byte length of primary namespace records.- Parameters:
idLen
- anint
the number of bytes required to hold the primary namespace ID.- Returns:
- an
int
record length in bytes.
-
calculateSecRecLen
calculateSecRecLen
calculates the byte length of secondary namespace records.- Parameters:
idLen
- anint
the number of bytes required to hold the secondary namespace ID.primaryKey
- aString
the primary namespace ID.keys
- aMap
of secondary keys to their byte lengths.- Returns:
- an
int
record length in bytes.
-