Skip to content

Substance exchange between logistic cells in a closed contour

The exchange of signalling molecules between logistic cells.

  • Class: ClosedContourCellExchangeSystem
  • Import: from skcomplex.systems.biology.physiology import ClosedContourCellExchangeSystem
  • Field: biology/physiology
  • Topics: map, logistic, coupled maps, ring, synchronization, cell communication
  • References:
    • Mihailović et al. 2023

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.physiology import ClosedContourCellExchangeSystem

trajectory = ClosedContourCellExchangeSystem().prepare().simulate()

Parameters

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

Parameter Default
n_cells 8
r 2.5
c 0.1
p 0.5
random_state 0
solver 'auto'
backend 'auto'

Tags

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

Tag Values
Time discrete
Space none
Laws update
Randomness deterministic
Domains real
Structure fixed

Class

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

class ClosedContourCellExchangeSystem(BaseSystem):
    """The exchange of signalling molecules between logistic cells.

    The cells are arranged in a closed contour.

    Every cell runs the logistic map on its concentration and takes up a share `c_i` of its next state from the next
    cell through the power map `x_{i+1}^{p_i}`, `x_i <- (1 - c_i) r x_i (1 - x_i) + c_i x_{i+1}^{p_i}`. Mihailović et
    al. show that an equilibrium is asymptotically stable for every coupling when every `x_i` lies in `((r - 1) / 2r, (r
    + 1) / 2r)` and above `p_{i-1}^(1 / (1 - p_{i-1}))`. In this domain the cells synchronize to a common concentration,
    and a chaotic environment, `r` near 4, desynchronizes them. The system has the concentrations `cells.x`, cell `i +
    1` next to cell `i`.

    Args:
        n_cells:
            The number of cells of the contour.

        r:
            The logistic parameter of every cell.

        c:
            The coupling of every cell to the next, one value or one per cell.

        p:
            The affinity of every cell for the uptake, one value or one per cell.

        random_state:
            The seed or generator of the initial concentrations, uniform between 0.2 and 0.8.

        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.systems.biology.physiology import ClosedContourCellExchangeSystem
        >>> ClosedContourCellExchangeSystem(5).prepare().system_.elements[0].size
        5
    """

    field = 'biology/physiology'
    topics = ('map', 'logistic', 'coupled maps', 'ring', 'synchronization', 'cell communication')
    references = ('Mihailović et al. 2023',)
    until = 200
    dt = 1

    def __init__(
        self,
        n_cells: int = 8,
        *,
        r: float = 2.5,
        c: float | Sequence[float] = 0.1,
        p: float | Sequence[float] = 0.5,
        random_state: int | np.random.Generator | None = 0,
        label: str = 'system',
        solver: BaseSolver | str = 'auto',
        backend: BaseBackend | str = 'auto',
    ) -> None:
        super().__init__(label, solver=solver, backend=backend)
        self.n_cells = n_cells
        self.r = r
        self.c = c
        self.p = p
        self.random_state = random_state

    def _prepare(self, context: Sequence[Observable] | None = None) -> None:
        """Set the exchange of signalling molecules between logistic cells.

        Args:
            context:
                The observables to compile with the problem, or `None` for none.
        """
        super()._prepare(context)
        rng = np.random.default_rng(self.random_state)
        cells = ContourCellElement(
            'cells',
            x=rng.uniform(0.2, 0.8, self.n_cells),
            r=self.r,
            c=np.broadcast_to(np.asarray(self.c, dtype=float), self.n_cells).copy(),
            p=np.broadcast_to(np.asarray(self.p, dtype=float), self.n_cells).copy(),
            size=self.n_cells,
        )
        uptake = ContourUptakeInteraction('uptake', target='cells')
        self.system_ = System(self.label, elements=[cells], interactions=[uptake])

Components

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

Elements:

Interactions:

  • ContourUptakeInteraction, from Interaction
class ContourCellElement(Element):
    """Logistic cell of a closed contour that takes up molecules of the next cell.

    It takes up the signalling molecules of the next cell through a power map.

    `ContourUptakeInteraction` iterates `x_i <- (1 - c_i) r x_i (1 - x_i) + c_i x_{i+1}^{p_i}`, where the logistic map
    is the intracellular dynamics, `c_i` the share of the exchange with the environment between the cells, and `p_i`
    the affinity of the cell for the uptake. The last cell of the contour takes up from the first.

    Args:
        label:
            The label of the group of cells.

        x:
            The initial concentration of signalling molecules in the cell, between 0 and 1.

        r:
            The logistic parameter, the disposition of the environment to communication.

        c:
            The coupling of the cell to the next one.

        p:
            The affinity of the cell for the uptake of signalling molecules.

        size:
            The number of members, or `None` for one.

    Examples:
        >>> from skcomplex.systems.biology.physiology import ContourCellElement
        >>> ContourCellElement('cells').r
        2.5
    """

    def __init__(
        self,
        label: str,
        *,
        x: Annotated[float | Array, RealSet.closed_open(0, oo)] = 0.5,
        r: Annotated[float | Array, RealSet.closed_open(0, oo)] = 2.5,
        c: Annotated[float | Array, RealSet.closed_open(0, oo)] = 0.1,
        p: Annotated[float | Array, RealSet.closed_open(0, oo)] = 0.5,
        size: int | None = None,
    ) -> None:
        super().__init__(label, size=size)
        self.x = x
        self.r = r
        self.c = c
        self.p = p

class ContourUptakeInteraction(Interaction):
    """Uptake of every cell of a contour from the next cell.

    It is `x_i <- (1 - c_i) r x_i (1 - x_i) + c_i x_{i+1}^p_i`.

    It is the map form of coupling to the next member of the group, with the power `x_{i+1}^{p_i}` of the next cell
    combined with the logistic map of the cell. The last cell of the contour takes up from the first.

    Args:
        label:
            The label of the interaction, unique among the components of its system.

        target:
            The path of the group of cells.

    Examples:
        >>> import numpy as np
        >>> from skcomplex.core.systems import System
        >>> from skcomplex.systems.biology.physiology import ContourCellElement, ContourUptakeInteraction
        >>> cells = ContourCellElement('cells', x=np.array([0.25, 1.0]), c=0.5, size=2)
        >>> uptake = ContourUptakeInteraction('uptake', target='cells')
        >>> system = System(elements=[cells], interactions=[uptake]).prepare()
        >>> system.simulate(until=1).get_values('cells.x')[-1].round(4).tolist()
        [0.7344, 0.25]
    """

    law_classes = (UpdateLaw,)

    def __init__(self, label: str, *, target: Role) -> None:
        super().__init__(label)
        self.target = target

    def _prepare(self, context: SimpleNamespace) -> None:
        """Set the logistic map of every cell mixed with the power uptake from the next cell.

        Args:
            context:
                The namespace of the group of cells.
        """
        super()._prepare(context)
        member = context.target
        uptake = shift_member(member.x, 1) ** member.p * SR(1)
        mixed = (1 - member.c) * member.r * member.x * (1 - member.x) + member.c * uptake
        self.laws_: list[BaseLaw] = [UpdateLaw(member.x, mixed)]

Equations

The equations are those that symbolic returns for the system with its default parameters.

cells.x[i]: x_cells(t + 1) == (c_cells - 1)*r_cells*(x_cells(t) - 1)*x_cells(t) + c_cells*x_cells__shift0^p_cells