Skip to content

Elementary flux modes and extreme pathways

The toy network of Raman whose steady-state cone elementary_modes enumerates.

  • Class: ElementaryFluxModesSystem
  • Import: from skcomplex.systems.biology.systems_biology import ElementaryFluxModesSystem
  • Field: biology/systems_biology
  • Topics: elementary flux modes, extreme pathways, linear program, metabolism, static
  • References:
    • Raman 2021
    • Schuster and Hilgetag 1994
    • Schilling et al. 2000
    • Gagneur and Klamt 2004

Use this system

The block imports the class and simulates the system with its default parameters and its tuned run settings.

from skcomplex.systems.biology.systems_biology import ElementaryFluxModesSystem

trajectory = ElementaryFluxModesSystem().prepare().simulate()

Parameters

The model parameters take these defaults, and set_params changes them.

Parameter Default
knockouts ()
solver 'auto'
backend 'auto'

Tags

The system with its default parameters has these capability tags, which solvers and analyses check.

Tag Values
Time continuous, discrete, static
Space none
Laws equation
Randomness unknown
Domains real
Structure fixed

Class

The source of the class shows how it builds its components from its model parameters.

class ElementaryFluxModesSystem(BaseSystem):
    """The toy network of Raman whose steady-state cone `elementary_modes` enumerates.

    Every steady-state flux of the network is a non-negative combination of the elementary modes of its cone (Raman
    2021, Section 9.8). The toy network has two modes, through `v1` and through `v2` and `v3`, both with growth yield
    `1/12` on `A`, so the bound 1000 on `v6` limits the growth to 50 whichever route carries the flux.

    Args:
        knockouts:
            The reactions to fix at zero.

        label:
            The label of the system, which names it when it is nested in another one.

        solver:
            The solver of the problem, or `'auto'` for the one the system chooses.

        backend:
            The backend that evaluates the compiled functions, or `'auto'` for the one the system chooses.

    Examples:
        >>> from skcomplex.core.analysis import elementary_modes
        >>> from skcomplex.systems.biology.systems_biology import ElementaryFluxModesSystem
        >>> analysis = elementary_modes(ElementaryFluxModesSystem().prepare().system_, normalize='cell.v_b1')
        >>> analysis.modes.shape[0]
        2
    """

    field = 'biology/systems_biology'
    topics = ('elementary flux modes', 'extreme pathways', 'linear program', 'metabolism', 'static')
    references = ('Raman 2021', 'Schuster and Hilgetag 1994', 'Schilling et al. 2000', 'Gagneur and Klamt 2004')
    until = 0.0

    def __init__(
        self,
        knockouts: Sequence[str] = (),
        *,
        label: str = 'system',
        solver: BaseSolver | str = 'auto',
        backend: BaseBackend | str = 'auto',
    ) -> None:
        super().__init__(label, solver=solver, backend=backend)
        self.knockouts = knockouts

    def _prepare(self, context: Sequence[Observable] | None = None) -> None:
        """Set the system of the toy network of Raman.

        Args:
            context:
                The observables to compile with the problem, or `None` for none.
        """
        super()._prepare(context)
        closed = {f'{bound}_{name}': 0.0 for name in self.knockouts for bound in ('lower', 'upper')}
        network = ToyFluxBalanceInteraction('fba')
        cell = MetabolicCellElement('cell', values=network.get_values() | closed)
        self.system_ = System(self.label, elements=[cell], interactions=[network])

Components

The system uses these element and interaction classes, each with its nearest class of the core.

Elements:

  • MetabolicCellElement, from Element

Interactions:

  • ToyFluxBalanceInteraction, from Interaction
class MetabolicCellElement(Element):
    """Cell whose values hold the fluxes, the bounds, and the gene switches of a metabolic network.

    It is drawn as the linear program of its network, and `FluxBalanceInteraction.get_values` gives its values.

    Examples:
        >>> from skcomplex.systems.biology.common.metabolism import FluxBalanceInteraction, MetabolicCellElement
        >>> from skcomplex.systems.biology.common.metabolism import ReactionSpec
        >>> network = FluxBalanceInteraction('fba', reactions={'r': ReactionSpec({'A': -1.0})})
        >>> MetabolicCellElement('cell', values=network.get_values()).values['upper_r']
        1000.0
    """

    visual = VisualSpec('linear_program')

class ToyFluxBalanceInteraction(FluxBalanceInteraction):
    """Flux balance of the toy network of Table 8.2 of Raman (2021), which grows on A alone.

    Args:
        label:
            The label of the interaction.

        cell:
            The path of the cell whose values hold the fluxes, the bounds, and the switches.

        reactions:
            The reactions by name.

        objective:
            The coefficient of every reaction in the objective.

        parsimonious:
            Whether to minimise the total absolute flux after the objective.

        infeasible:
            What a run does when the balances and bounds cannot all hold.

        name:
            The name of the network.

    Examples:
        >>> from skcomplex.systems.biology.common.metabolism import ToyFluxBalanceInteraction
        >>> ToyFluxBalanceInteraction('fba').get_values()['upper_v1']
        1000.0
    """

    def __init__(
        self,
        label: str = 'fba',
        *,
        cell: Role = 'cell',
        reactions: Mapping[str, ReactionSpec] = TOY_REACTIONS,
        objective: Mapping[str, float] = TOY_OBJECTIVE,
        parsimonious: bool = False,
        infeasible: str = 'raise',
        name: str | None = 'ToyNetwork',
    ) -> None:
        super().__init__(
            label,
            cell=cell,
            reactions=reactions,
            objective=objective,
            parsimonious=parsimonious,
            infeasible=infeasible,
            name=name,
        )