3.1. kda.core

3.1.1. KDA Core Objects

The core module contains code to build the core KineticModel object which contains all system information for a kinetic model.

class KineticModel(K=None, G=None)[source]

The KDA KineticModel contains all the information describing the system.

Includes methods to construct the kinetic diagram, generate the intermediate graphs, and build the algebraic expressions for steady-state probabilities and fluxes.

Variables:
  • cycles (list of lists of int) – All cycles in the kinetic diagram. This attribute becomes available after running the build_cycles() method.

  • partial_diagrams (ndarray of Networkx.Graph) – The set of partial diagrams (i.e. spanning trees) for the kinetic diagram. This attribute becomes available after running the build_partial_diagrams() method.

  • directional_diagrams (ndarray of Networkx.MultiDiGraph) – The set of directional diagrams for the kinetic diagram. This attribute becomes available after running the build_directional_diagrams() method.

  • flux_diagrams (list of lists of Networkx.MultiDiGraph) – The set of flux diagrams for each cycle in the kinetic diagram. This attribute becomes available after running the build_flux_diagrams() method.

  • probabilities (array of floats or list of SymPy expressions) – The steady-state probabilities for all states in the kinetic diagram. Probabilities are either an array of numeric values or the algebraic expressions. This attribute becomes available after running the build_state_probabilities() method.

build_cycles()[source]

Builds all cycles from the kinetic diagram using find_all_unique_cycles().

build_directional_diagrams()[source]

Builds the directional diagrams for the kinetic diagram using generate_directional_diagrams().

build_flux_diagrams()[source]

Builds the flux diagrams for the kinetic diagram using generate_all_flux_diagrams().

build_partial_diagrams()[source]

Builds the partial diagrams for the kinetic diagram using generate_partial_diagrams().

build_state_probabilities(symbolic=True)[source]

Builds the state probabilities for the kinetic diagram using calc_state_probs(). Probabilities can be stored as raw values or symbolic algebraic expressions.

Parameters:

symbolic (bool, optional) – Used to determine whether raw values or symbolic expressions will be stored. Default is True.

get_directional_diagram_count()[source]

Returns the number of directional diagrams that will be created from the kinetic diagram. If directional diagrams have already been generated with build_directional_diagrams() the count will simply be returned. Otherwise get_partial_diagram_count() is used (there are N directional diagrams per partial diagram for a kinetic diagram with N states).

Return type:

The integer number of directional diagrams.

get_flux_diagrams(cycle)[source]

Retrieves the flux diagrams for a specific cycle using generate_flux_diagrams().

Parameters:

cycle (list of int) – List of node indices for cycle of interest, index zero. Order of node indices does not matter.

Return type:

The flux diagrams associated with the input cycle.

get_partial_diagram_count()[source]

Returns the number of partial diagrams that will be created from the kinetic diagram. If partial diagrams have already been generated with build_partial_diagrams() the count will simply be returned. Otherwise enumerate_partial_diagrams() is used.

Return type:

The integer number of partial diagrams.

get_transition_flux(state_i, state_j, net=True, symbolic=True)[source]

Generates the expressions for the one-way or net transition fluxes between two states.

Parameters:
  • state_i (integer) – The index (index 1) of the initial state.

  • state_j (integer) – The index (index 1) of the final state.

  • net (bool, optional) – Used to determine whether one-way transition fluxes or net transition fluxes will be returned. Default is True.

  • symbolic (bool, optional) – Used to determine whether raw values or symbolic expressions will be returned. Default is True.

Return type:

The transition flux (one-way or net) from state i to state j.

Raises:
  • ValueError – If the input states are the same (i.e. i==j).

  • TypeError – If the stored state probability type (symbolic or numeric) is a differnt type than the requested transition flux type.

Notes

The expressions generated here quantify the one-way or net probability flows between two states. The net transition flux between two states is defined [1],

\[J_{ij} = j_{ij} - j_{ji},\]

where \(j_{ij} = k_{ij} p_{i}\) and \(j_{ji} = k_{ji} p_{j}\) are the one-way transition fluxes. For the one-way fluxes, \(k_{ij}\) is the kinetic rate from state \(i\) to state \(j\) and \(p_{i}\) is the state probability for state \(i\).

References

Classes

KineticModel([K, G])

The KDA KineticModel contains all the information describing the system.