Class EnzymeService
java.lang.Object
de.ipk_gatersleben.ag_nw.graffiti.plugins.databases.sib_enzymes.EnzymeService
- All Implemented Interfaces:
FileDownloadStatusInformationProvider
,BackgroundTaskStatusProvider
,MemoryHog
,HelperClass
public class EnzymeService extends Object implements MemoryHog, BackgroundTaskStatusProvider, FileDownloadStatusInformationProvider, HelperClass
-
Field Summary
Fields inherited from interface org.graffiti.editor.MemoryHog
lastUsageTime
-
Method Summary
Modifier and Type Method Description static String
extractECId(String ecString)
void
finishedNewDownload()
void
freeMemory()
To release a data structure, just re-instantiate it, and GC would collect the now unreachable object some time in the future.String
getCurrentStatusMessage1()
Returns a status message on what is going on.String
getCurrentStatusMessage2()
Returns a status message on what is going on.int
getCurrentStatusValue()
Returns the completion status.double
getCurrentStatusValueFine()
Same asgetCurrentStatusValue()
, but this method should return a finer granted progress value.String
getDescription()
static List<String>
getEnzymeClasses(String ec_number_or_synonyme, boolean lazy)
Retuns all matches for the enzyme class.static EnzymeEntry
getEnzymeInformation(String ec_or_synonyme, boolean lazy)
Get a EnzymeEntry with the associated information.static File
getFile(String fileName)
static EnzymeService
getInstance()
static int
getNumberOfEnzymeNodes(Graph graph)
Get the number of nodes in this graph which could possible be valid EC numbers.static String
getReleaseVersionForEnzymeClasses()
static String
getReleaseVersionForEnzymeInformation()
JComponent
getStatusPane(boolean showEmpty)
boolean
isDatabaseAvailable(boolean checkInternal)
void
pleaseContinueRun()
This method is called as soon as the user indicates that he is comfortable to let the algorithm continue its work.void
pleaseStop()
If this method is called on the status provider, the linked work task should stop its execution as soon as possible.boolean
pluginWaitsForUser()
void
setCurrentStatusValue(int value)
Override this method and pass a implementor of this interface to any other service method.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.graffiti.editor.MemoryHog
doFreeMemory, enablePeriodicFreeMemory, noteRequest, registerMemoryHog
-
Method Details
-
getInstance
-
finishedNewDownload
public void finishedNewDownload()- Specified by:
finishedNewDownload
in interfaceFileDownloadStatusInformationProvider
-
isDatabaseAvailable
public boolean isDatabaseAvailable(boolean checkInternal) -
getReleaseVersionForEnzymeClasses
- Returns:
- The release information from the enzyme-classes file (enzclass.txt).
-
getEnzymeClasses
Retuns all matches for the enzyme class. Example: "1.1.5.2" "1. -. -.-" -> Oxidoreductases "1. 1. -.-" -> Acting on the CH-OH group of donors "1. 1. 5.-" -> With a quinone or similar compound as acceptor. ==> RETURN: { "Oxidoreductases", "Acting on the CH-OH group of donors", "With a quinone or similar compound as acceptor" }- Parameters:
ec_number_or_synonyme
- A EC Number in the form "EC1.2.3.4" or "1.2.3.4" or " 1. 2. 3 . 4" (space is ignored while matching) Also a synonym to a EC number can be used, in this case a lookup to the known synonyms is done to get the corresponding EC number.lazy
- If lazy is TRUE, then the service is inited in background, this method will return immeadeately, but might not return reliable results until the database is inited.- Returns:
- A string array of all matching categories or descriptions.
-
getEnzymeInformation
Get a EnzymeEntry with the associated information.- Parameters:
ec_or_synonyme
- A EC number (1.2.3.4) or known synonyme.- Returns:
- NULL, if no info is found or a corresponding entry.
-
extractECId
-
getReleaseVersionForEnzymeInformation
- Returns:
- The release information of the enzyme.dat file.
-
getNumberOfEnzymeNodes
Get the number of nodes in this graph which could possible be valid EC numbers. It is not checked if the EC number is existent, meaning a EC number like "6.6.6.666" which probably does not exist would increase the number count.- Parameters:
graph
- All nodes from this graph will be checked- Returns:
- The number of nodes which have a
QuadNumber
valid structure, meaning, a name of substance name like a.b.c.d, where abcd are either numbers or "-".
-
getCurrentStatusValue
public int getCurrentStatusValue()Description copied from interface:BackgroundTaskStatusProvider
Returns the completion status. WARNING: This method must be Thread-Safe!- Specified by:
getCurrentStatusValue
in interfaceBackgroundTaskStatusProvider
- Returns:
- A number from 0..100 which represents the completion status. If -1 is returned, the progress bar is set to "indeterminate", which means, that the progress bar will float from left to right and reverse. (Useful if status can not be determined) Other values let the progressbar disappear.
-
getCurrentStatusValueFine
public double getCurrentStatusValueFine()Description copied from interface:BackgroundTaskStatusProvider
Same asgetCurrentStatusValue()
, but this method should return a finer granted progress value. If this is not needed, the code forgetCurrentStatusValue()
could be reused by the client.- Specified by:
getCurrentStatusValueFine
in interfaceBackgroundTaskStatusProvider
- Returns:
- The current progress value (fine).
-
getCurrentStatusMessage1
Description copied from interface:BackgroundTaskStatusProvider
Returns a status message on what is going on. WARNING: This method must be Thread-Safe!- Specified by:
getCurrentStatusMessage1
in interfaceBackgroundTaskStatusProvider
- Returns:
- A status message, or null if not needed.
-
getCurrentStatusMessage2
Description copied from interface:BackgroundTaskStatusProvider
Returns a status message on what is going on. Is used the same likegetCurrentStatusMessage1
. This second message adds flexibility. If not needed, the first message should be used and this should return null if not needed. WARNING: This method must be Thread-Safe!- Specified by:
getCurrentStatusMessage2
in interfaceBackgroundTaskStatusProvider
- Returns:
- A status message, or null if not needed.
-
pleaseStop
public void pleaseStop()Description copied from interface:BackgroundTaskStatusProvider
If this method is called on the status provider, the linked work task should stop its execution as soon as possible.- Specified by:
pleaseStop
in interfaceBackgroundTaskStatusProvider
-
pluginWaitsForUser
public boolean pluginWaitsForUser()- Specified by:
pluginWaitsForUser
in interfaceBackgroundTaskStatusProvider
- Returns:
- Let this method return true in order to show a "Continue" button in
the GUI. When this buttons is clicked, the method
pleaseContinueRun
is called. Use these two methods to let the user interact with the GUI while the algorithm is waiting for the user to be ready for the continued work of the algorithm.
-
pleaseContinueRun
public void pleaseContinueRun()Description copied from interface:BackgroundTaskStatusProvider
This method is called as soon as the user indicates that he is comfortable to let the algorithm continue its work.- Specified by:
pleaseContinueRun
in interfaceBackgroundTaskStatusProvider
-
setCurrentStatusValue
public void setCurrentStatusValue(int value)Description copied from interface:BackgroundTaskStatusProvider
Override this method and pass a implementor of this interface to any other service method. This method can use this call to update the status value.- Specified by:
setCurrentStatusValue
in interfaceBackgroundTaskStatusProvider
-
getDescription
- Specified by:
getDescription
in interfaceFileDownloadStatusInformationProvider
-
getStatusPane
- Specified by:
getStatusPane
in interfaceFileDownloadStatusInformationProvider
-
getFile
-
freeMemory
public void freeMemory()Description copied from interface:MemoryHog
To release a data structure, just re-instantiate it, and GC would collect the now unreachable object some time in the future.
Apart for deallocation purposes, it can also be used to reset any other dependencies.- Specified by:
freeMemory
in interfaceMemoryHog
-