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 StringKEYSis the key used to identify the secondary namespaces in the OBDA config.dat files.static final AnnotationTypeAnnotationType that all meta-data files should fit.static final StringPRIMARY_KEY_NAMEis the key used to identify the primary namespace in the OBDA config.dat files.static final StringSEQUENCE_FORMATis the key used to identify the format of the indexed sequence files represented by the store in the OBDA config.dat files.static final StringSTORE_NAMEis the key used to identify the arbitrary name of the store in the OBDA config.dat files. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddKeyadds a new identifier namespace.static intcalculatePrimRecLen(int idLen) calculatePrimRecLencalculates the byte length of primary namespace records.static intcalculateSecRecLen(int idLen, String primaryKey, Map keys) calculateSecRecLencalculates the byte length of secondary namespace records.createBioStorecreates aBioStorereflecting the current state of the factory and returns a reference to it.getKeys()getPrimaryKeyreturns the primary identifier namespace.getSequenceFormatreturns the current sequence format name.getStoreLocationreturns the directory of the bew index.getStoreNamereturns the name to be given to the new index.static FilemakeConfigFile(File storeLoc) makeConfigFilereturns a file which represents an OBDA "config.dat" in the specified index directory.static FilemakePrimaryKeyFile(File storeLoc, String key) makePrimaryKeyFilereturns a file which represents an OBDA "key_<primary namespace>.key" primary key file on the specified index directory.static FilemakeSecondaryFile(File storeLoc, String key) makeSecondaryFilereturns a file which represents an OBDA "id_<secondary namespace>.index" secondary key file on the specified.voidremoveKeyremoves the specified key.voidsetPrimaryKey(String primaryKey) setPrimaryKeysets the primary identifier namespace.voidsetSequenceFormatsets the sequence format name which will be indicated in the index.voidsetStoreLocation(File storeLoc) setStoreLocationsets the directory of the new index.voidsetStoreName(String name) setStoreNamesets the name to be given to the new index.
-
Field Details
-
STORE_NAME
STORE_NAMEis the key used to identify the arbitrary name of the store in the OBDA config.dat files.- See Also:
-
SEQUENCE_FORMAT
SEQUENCE_FORMATis 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_NAMEis the key used to identify the primary namespace in the OBDA config.dat files.- See Also:
-
KEYS
KEYSis 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
setStoreNamesets the name to be given to the new index.- Parameters:
name- aString.
-
getStoreName
getStoreNamereturns the name to be given to the new index.- Returns:
- a
String.
-
setStoreLocation
setStoreLocationsets the directory of the new index.- Parameters:
storeLoc- aFile.
-
getStoreLocation
getStoreLocationreturns the directory of the bew index.- Returns:
- a
File.
-
setSequenceFormat
setSequenceFormatsets the sequence format name which will be indicated in the index.- Parameters:
format- aLifeScienceIdentifierwhich must be one of those mandated by the OBDA flatfile indexing specification.
-
getSequenceFormat
getSequenceFormatreturns the current sequence format name.- Returns:
- a
LifeScienceIdentifier.
-
setPrimaryKey
setPrimaryKeysets the primary identifier namespace.- Parameters:
primaryKey- aString.
-
getPrimaryKey
getPrimaryKeyreturns the primary identifier namespace.- Returns:
- a
String.
-
addKey
addKeyadds a new identifier namespace.- Parameters:
keyName- aString.length- anintindicating the byte length of the key records.
-
getKeys
-
removeKey
removeKeyremoves the specified key.- Parameters:
keyName- aString.
-
createBioStore
createBioStorecreates aBioStorereflecting the current state of the factory and returns a reference to it.- Returns:
- a
BioStore. - Throws:
BioException- if an error occurs.
-
makeConfigFile
makeConfigFilereturns a file which represents an OBDA "config.dat" in the specified index directory.- Parameters:
storeLoc- aFileindicating the index directory.- Returns:
- a
Filerepresenting "config.dat". - Throws:
IOException- if an error occurs.
-
makePrimaryKeyFile
makePrimaryKeyFilereturns a file which represents an OBDA "key_<primary namespace>.key" primary key file on the specified index directory.- Parameters:
storeLoc- aFileindicating the parent path.key- aStringprimary key namespace.- Returns:
- a
Filerepresenting a "key_<primary namespace>.key". - Throws:
IOException- if an error occurs.
-
makeSecondaryFile
makeSecondaryFilereturns a file which represents an OBDA "id_<secondary namespace>.index" secondary key file on the specified.- Parameters:
storeLoc- aFileindicating the parent path.key- aStringsecondary key namespace.- Returns:
- a
Filerepresenting an "id_<secondary namespace>.index" file. - Throws:
IOException- if an error occurs.
-
calculatePrimRecLen
calculatePrimRecLencalculates the byte length of primary namespace records.- Parameters:
idLen- anintthe number of bytes required to hold the primary namespace ID.- Returns:
- an
intrecord length in bytes.
-
calculateSecRecLen
calculateSecRecLencalculates the byte length of secondary namespace records.- Parameters:
idLen- anintthe number of bytes required to hold the secondary namespace ID.primaryKey- aStringthe primary namespace ID.keys- aMapof secondary keys to their byte lengths.- Returns:
- an
intrecord length in bytes.
-