Skip to content

Three-way fate decision on the compactified elliptic umbilic

Cells that choose among three fates on a compactified elliptic umbilic.

  • Class: ThreeWayFateDecisionSystem
  • Import: from skcomplex.systems.biology.systems_biology import ThreeWayFateDecisionSystem
  • Field: biology/systems_biology
  • Topics: cell fate, morse-smale, elliptic umbilic, landscape, ode
  • References:
    • Rand et al. 2021

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 ThreeWayFateDecisionSystem

trajectory = ThreeWayFateDecisionSystem().prepare().simulate()

Parameters

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

Parameter Default
cells 30
a -0.2
theta1 0.0
theta2 0.0
v1 0.0
v2 0.0
spread 0.6
seed 0
solver 'auto'
backend 'auto'

Tags

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

Tag Values
Time continuous
Space none
Laws rate
Randomness deterministic
Domains real
Structure fixed

Class

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

class ThreeWayFateDecisionSystem(BaseSystem):
    """Cells that choose among three fates on a compactified elliptic umbilic.

    The landscape is the one of Rand et al.

    Every cell descends the potential `x^4 + y^4 + x^3 - 2 x y^2 + a (x^2 + y^2) + theta1 x + theta2 y`. With `a < 0`
    and no signal the centre is a repellor and three attractors, the fates, lie around it, separated by three saddles,
    so cells that start near the centre split among the three fates. Signals that drift at the rates `v1` and `v2` move
    the system across the fold curves of its parameter space, where a fate disappears and its cells switch to another.
    The system has the states `cells.x` and `cells.y`.

    Args:
        cells:
            The number of cells.

        a:
            The curvature of the potential at the centre.

        theta1:
            The first signal at the start.

        theta2:
            The second signal at the start.

        v1:
            The rate of change of the first signal.

        v2:
            The rate of change of the second signal.

        spread:
            The half-width of the uniform initial states around the centre.

        seed:
            The seed of the initial states.

        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.systems_biology import ThreeWayFateDecisionSystem
        >>> ThreeWayFateDecisionSystem(5).prepare().system_.elements[0].size
        5
    """

    field = 'biology/systems_biology'
    topics = ('cell fate', 'morse-smale', 'elliptic umbilic', 'landscape', 'ode')
    references = ('Rand et al. 2021',)
    until = 40.0
    dt = 0.2

    def __init__(
        self,
        cells: int = 30,
        *,
        a: float = -0.2,
        theta1: float = 0.0,
        theta2: float = 0.0,
        v1: float = 0.0,
        v2: float = 0.0,
        spread: float = 0.6,
        seed: int | None = 0,
        label: str = 'system',
        solver: BaseSolver | str = 'auto',
        backend: BaseBackend | str = 'auto',
    ) -> None:
        super().__init__(label, solver=solver, backend=backend)
        self.cells = cells
        self.a = a
        self.theta1 = theta1
        self.theta2 = theta2
        self.v1 = v1
        self.v2 = v2
        self.spread = spread
        self.seed = seed

    def _prepare(self, context: Sequence[Observable] | None = None) -> None:
        """Set cells that choose among three fates on a compactified elliptic umbilic.

        Args:
            context:
                The observables to compile with the problem, or `None` for none.
        """
        super()._prepare(context)
        rng = np.random.default_rng(self.seed)
        start = rng.uniform(-self.spread, self.spread, (2, self.cells))
        self.system_ = System(
            self.label,
            elements=[
                FateLandscapeElement(
                    'cells',
                    x=start[0],
                    y=start[1],
                    a=self.a,
                    theta1=self.theta1,
                    theta2=self.theta2,
                    v1=self.v1,
                    v2=self.v2,
                    size=self.cells,
                ),
            ],
            interactions=[EllipticUmbilicInteraction('descent', target='cells')],
        )

Components

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

Elements:

  • FateLandscapeElement, from Element

Interactions:

  • EllipticUmbilicInteraction, from Interaction
class FateLandscapeElement(Element):
    """Cells with a state `(x, y)` on a landscape of three fates, and the signals that tilt it.

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

        x:
            The initial first coordinate.

        y:
            The initial second coordinate.

        a:
            The curvature of the potential at the centre.

        theta1:
            The first signal at the start.

        theta2:
            The second signal at the start.

        v1:
            The rate of change of the first signal.

        v2:
            The rate of change of the second signal.

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

    Examples:
        >>> from skcomplex.systems.biology.systems_biology import FateLandscapeElement
        >>> FateLandscapeElement('cell', a=-0.2).a
        -0.2
    """

    def __init__(
        self,
        label: str,
        *,
        x: float | Array = 0.0,
        y: float | Array = 0.0,
        a: float | Array = -0.2,
        theta1: float | Array = 0.0,
        theta2: float | Array = 0.0,
        v1: float | Array = 0.0,
        v2: float | Array = 0.0,
        size: int | None = None,
    ) -> None:
        super().__init__(label, size=size)
        self.x = x
        self.y = y
        self.a = a
        self.theta1 = theta1
        self.theta2 = theta2
        self.v1 = v1
        self.v2 = v2

class EllipticUmbilicInteraction(Interaction):
    """Gradient descent of cells on the compactified elliptic umbilic, a landscape of three fates.

    It is the minimal landscape of a decision among three fates.
    The state `(x, y)` descends the potential `f = x^4 + y^4 + x^3 - 2 x y^2 + a (x^2 + y^2) + theta1 x + theta2 y` of
    Rand et al. (2021, figure 5D), `dx/dt = -df/dx` and `dy/dt = -df/dy`. The signals `theta1` and `theta2` change
    in time at the rates `v1` and `v2`, and the sign of `a` makes the central rest point an attractor or a repellor.

    Args:
        label:
            The label of the interaction.

        target:
            The path of the cells, whose values are `x`, `y`, `a`, `theta1`, `theta2`, `v1`, and `v2`.

    Examples:
        >>> from skcomplex.systems.biology.systems_biology import EllipticUmbilicInteraction
        >>> EllipticUmbilicInteraction('descent', target='cells').target
        'cells'
    """

    law_classes = (RateLaw,)

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

    def _prepare(self, context: SimpleNamespace) -> None:
        """Set the gradient descent of the potential under the drifting signals.

        Args:
            context:
                The namespace of the target, the time `t`, and the parameters.
        """
        super()._prepare(context)
        s = context.target
        theta1, theta2 = s.theta1 + s.v1 * context.t, s.theta2 + s.v2 * context.t
        self.laws_ = [
            RateLaw(s.x, -(4 * s.x**3 + 3 * s.x**2 - 2 * s.y**2 + 2 * s.a * s.x + theta1)),
            RateLaw(s.y, -(4 * s.y**3 - 4 * s.x * s.y + 2 * s.a * s.y + theta2)),
        ]

Equations

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

cells.x[i]: diff(x_cells(t), t) == -4*x_cells(t)^3 - t*v1_cells - 2*a_cells*x_cells(t) - 3*x_cells(t)^2 + 2*y_cells(t)^2 - theta1_cells
cells.y[i]: diff(y_cells(t), t) == -4*y_cells(t)^3 - t*v2_cells - 2*a_cells*y_cells(t) + 4*x_cells(t)*y_cells(t) - theta2_cells