Application
#
- class biotite.application.Application[source]#
Bases:
object
This class is a wrapper around an external piece of runnable software in any sense. Subclasses of this abstract base class specify the respective kind of software and the way of interacting with it.
Every
Application
runs through a different app states (instances of enumAppState
) from its creation until its termination.Directly after its instantiation the app is in the CREATED state. In this state further parameters can be set for the application run. After the user calls the
start()
method, the app state is set to RUNNING and theApplication
type specificrun()
method is called. When the application finishes the AppState changes to FINISHED. This is checked via theApplication
type specificis_finished()
method. The user can now call thejoin()
method, concluding the application in the JOINED state and making the results of the application accessible by executing theApplication
type specificevaluate()
method. Furthermore this executes theApplication
type specificclean_up()
method.join()
can even be called in the RUNNING state: This will constantly checkis_finished()
and will directly go into the JOINED state as soon as the application reaches the FINISHED state. Calling thecancel()
method while the application is RUNNING or FINISHED leaves the application in the CANCELLED state. This triggers theclean_up()
method, too, but there are no accessible results. If a method is called in an unsuitable app state, anAppStateError
is called.The application run behaves like an additional thread: Between the call of
start()
andjoin()
other Python code can be executed, while the application runs in the background.- cancel()#
Cancel the application when in RUNNING or FINISHED state.
- clean_up()#
Do clean up work after the application terminates.
PROTECTED: Optionally override when inheriting.
- abstract evaluate()#
Evaluate application results. Called in
join()
.PROTECTED: Override when inheriting.
- get_app_state()#
Get the current app state.
- Returns:
- app_stateAppState
The current app state.
- abstract is_finished()#
Check if the application has finished.
PROTECTED: Override when inheriting.
- Returns:
- finishedbool
True of the application has finished, false otherwise
- join(timeout=None)#
Conclude the application run and set its state to JOINED. This can only be done from the RUNNING or FINISHED state.
If the application is FINISHED the joining process happens immediately, if otherwise the application is RUNNING, this method waits until the application is FINISHED.
- Parameters:
- timeoutfloat, optional
If this parameter is specified, the
Application
only waits for finishing until this value (in seconds) runs out. After this time is exceeded aTimeoutError
is raised and the application is cancelled.
- Raises:
- TimeoutError
If the joining process exceeds the timeout value.
- abstract run()#
Commence the application run. Called in
start()
.PROTECTED: Override when inheriting.
- start()#
Start the application run and set its state to RUNNING. This can only be done from the CREATED state.
- abstract wait_interval()#
The time interval of
is_finished()
calls in the joining process.PROTECTED: Override when inheriting.
- Returns:
- intervalfloat
Time (in seconds) between calls of
is_finished()
injoin()
Gallery#
Finding homologs of a gene in a genome
Homology search and multiple sequence alignment
Mutual information as measure for coevolution of residues
Quantifying gene expression from RNA-seq data
Quality control of sequencing data
Docking a ligand to a receptor
Secondary structure during an MD simulation