Class EnzymeFactory
java.lang.Object
com.compomics.util.experiment.biology.enzymes.EnzymeFactory
This factory will load enzymes from a JSON file and provide them on demand as
a standard class.
- Author:
- Marc Vaudel, Harald Barsnes
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an enzyme in the factory.booleanenzymeLoaded(String enzyme) Indicates whether an enzyme is loaded in the factory.Returns the enzyme corresponding to the given name.Get the imported enzymes.static EnzymeFactoryStatic method to get an instance of the factory.static StringReturns the folder where to save the factory.Get the sorted list of enzyme names.getUtilitiesEnzyme(String cvTermAccession) Returns the enzyme associated to the given cvTerm.static EnzymeFactoryloadFromFile(File file) Loads an enzyme factory from a file.voidremoveEnzyme(String enzymeName) Removes an enzyme from the mapping.voidSaves the factory in the user folder.static voidsaveToFile(EnzymeFactory enzymeFactory, File file) Saves en enzyme factory to a file.static voidSets the instance to only contain the default enzymes.static voidsetSerializationFolder(String serializationFilePath) Sets the folder where to save the factory.
-
Method Details
-
getInstance
Static method to get an instance of the factory. Attempts to load the factory from the file set in the path preferences. If any exception occurs it is ignored silently and defaults are used.- Returns:
- the factory instance
-
saveFactory
Saves the factory in the user folder.- Throws:
IOException- exception thrown whenever an error occurred while saving the modificationFactory
-
setDefaultEnzymes
public static void setDefaultEnzymes()Sets the instance to only contain the default enzymes. -
loadFromFile
Loads an enzyme factory from a file. The file must be an export of the factory in the json format.- Parameters:
file- the file to load- Returns:
- the enzyme factory saved in file
- Throws:
IOException- exception thrown whenever an error occurred while loading the file
-
saveToFile
Saves en enzyme factory to a file.- Parameters:
enzymeFactory- the enzyme factory to savefile- the file where to save- Throws:
IOException- exception thrown whenever an error occurred while saving the file
-
getSerializationFolder
Returns the folder where to save the factory.- Returns:
- the folder where to save the factory
-
setSerializationFolder
Sets the folder where to save the factory. Warning: this overwrites SERIALIZATION_FILE_FOLDER.- Parameters:
serializationFilePath- the folder where to save the factory
-
getEnzymes
Get the imported enzymes.- Returns:
- The enzymes as ArrayList
-
getSortedEnzymeNames
Get the sorted list of enzyme names.- Returns:
- the enzyme names as a sorted ArrayList
-
getEnzyme
Returns the enzyme corresponding to the given name. Null if not found.- Parameters:
enzymeName- the name of the desired enzyme- Returns:
- the corresponding enzyme
-
addEnzyme
Adds an enzyme in the factory.- Parameters:
enzyme- the new enzyme to add
-
removeEnzyme
Removes an enzyme from the mapping.- Parameters:
enzymeName- the name of the enzyme to remove.
-
enzymeLoaded
Indicates whether an enzyme is loaded in the factory.- Parameters:
enzyme- the name of the enzyme- Returns:
- a boolean indicating whether an enzyme is loaded in the factory
-
getUtilitiesEnzyme
Returns the enzyme associated to the given cvTerm. Null if not found.- Parameters:
cvTermAccession- the accession of the cv term- Returns:
- the associated enzyme.
-