cobra.core.configuration#

Provide a global configuration object.

Classes#

Configuration

Define a global configuration object.

Module Contents#

class cobra.core.configuration.Configuration(**kwargs)[source]#

Define a global configuration object.

The attributes of this singleton object are used as default values by cobra functions.

solver#

The default solver for new models. The solver choices are the ones provided by optlang and depend on solvers installed in your environment.

Type:

{“glpk”, “cplex”, “gurobi”, “glpk_exact”}

tolerance#

The default tolerance for the solver being used (default 1E-07).

Type:

float, optional

lower_bound#

The standard lower bound for reversible reactions (default -1000).

Type:

float, optional

upper_bound#

The standard upper bound for all reactions (default 1000).

Type:

float, optional

bounds#

The default reaction bounds for newly created reactions. The bounds are in the form of lower_bound, upper_bound (default -1000.0, 1000.0).

Type:

tuple of floats

processes#

A default number of processes to use where multiprocessing is possible. The default number corresponds to the number of available cores (hyperthreads) minus one.

Type:

int > 0

cache_directory#

A path where the model cache should reside if caching is desired. The default directory depends on the operating system.

Type:

pathlib.Path or str, optional

max_cache_size#

The allowed maximum size of the model cache in bytes (default 1 GB).

Type:

int, optional

cache_expiration#

The expiration time in seconds for the model cache if any (default None).

Type:

int, optional

_solver = None#
tolerance = 1e-07#
lower_bound = None#
upper_bound = None#
processes = None#
_cache_directory = None#
max_cache_size = 104857600#
cache_expiration = None#
property bounds: Tuple[numbers.Number | None, numbers.Number | None]#

Return the lower, upper reaction bound pair.

Returns:

The lower and upper bounds for new reactions.

Return type:

tuple of number and number or None and None

_set_default_solver() None[source]#

Set the default solver from a preferred order.

_set_default_processes() None[source]#

Set the default number of processes.

_set_default_cache_directory() None[source]#

Set the platform-dependent default cache directory.

property solver: types.ModuleType#

Return the optlang solver interface.

property cache_directory: pathlib.Path#

Return the model cache directory.

__repr__() str[source]#

Return a string representation of the current configuration values.

_repr_html_() str[source]#

Return a rich HTML representation of the current configuration values.

Notes

This special method is used automatically in Jupyter notebooks to display a result from a cell.