Skip to content

Von Bertalanffy growth

A tumour that grows by the balance of anabolism and catabolism.

  • Class: VonBertalanffySystem
  • Import: from skcomplex.systems.biology.oncology import VonBertalanffySystem
  • Field: biology/oncology
  • Topics: tumour growth, ode, allometry
  • References:
    • Padmanabhan, Meskin, and Al Moustafa 2021
    • Benzekry et al. 2014
    • von Bertalanffy 1957

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.oncology import VonBertalanffySystem

trajectory = VonBertalanffySystem().prepare().simulate()

Parameters

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

Parameter Default
n 1.0
r 2.32
p 0.918
d 0.808
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 VonBertalanffySystem(BaseSystem):
    """A tumour that grows by the balance of anabolism and catabolism.

    The growth is `dn/dt = r n^p - d n`.

    The volume tends to `(r / d)^(1/(1-p))`. The defaults are the fit to breast cancer volumes in mm³ and days. The
    system has the volume `tumour.x`.

    Args:
        n:
            The initial volume.

        r:
            The growth rate.

        p:
            The exponent of the growth, below 1.

        d:
            The loss rate.

        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.oncology import VonBertalanffySystem
        >>> VonBertalanffySystem().prepare().system_.interactions[1].d
        0.808
    """

    field = 'biology/oncology'
    topics = ('tumour growth', 'ode', 'allometry')
    references = (*GROWTH_REFERENCES, 'von Bertalanffy 1957')
    until = 80.0
    dt = 0.4

    def __init__(
        self,
        n: float = 1.0,
        *,
        r: float = 2.32,
        p: float = 0.918,
        d: float = 0.808,
        label: str = 'system',
        solver: BaseSolver | str = 'auto',
        backend: BaseBackend | str = 'auto',
    ) -> None:
        super().__init__(label, solver=solver, backend=backend)
        self.n = n
        self.r = r
        self.p = p
        self.d = d

    def _prepare(self, context: Sequence[Observable] | None = None) -> None:
        """Set the system of a tumour that grows by the balance of anabolism and catabolism.

        The growth is `dn/dt = r n^p - d n`.

        Args:
            context:
                The observables to compile with the problem, or `None` for none.
        """
        super()._prepare(context)
        self.system_ = System(
            self.label,
            elements=[PopulationElement('tumour', x=self.n)],
            interactions=[
                PowerLawGrowthInteraction('growth', target='tumour', r=self.r, p=self.p),
                MortalityInteraction('loss', target='tumour', d=self.d),
            ],
        )

Components

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

Elements:

Interactions:

  • PowerLawGrowthInteraction, from Interaction
  • MortalityInteraction, from Interaction
class PopulationElement(CompartmentElement):
    """Population of one species, a compartment whose state `x` holds its size.

    Args:
        label:
            The label of the population.

        x:
            The initial size.

    Examples:
        >>> from skcomplex.systems.biology.common.populations import PopulationElement
        >>> PopulationElement('rabbits', x=40).x
        40
    """

    def __init__(
        self,
        label: str,
        *,
        x: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
    ) -> None:
        super().__init__(label, x=x)

class PowerLawGrowthInteraction(GrowthInteraction):
    """Growth that scales as a power of the size, `dx/dt = r x ** p`, without harvest.

    Args:
        label:
            The label of the interaction.

        target:
            The path of the element or group whose population grows.

        r:
            The growth rate.

        p:
            The exponent, `2/3` for a growing rim and 1 for exponential growth.

        state:
            The name of the state of the target that holds the population.

    Examples:
        >>> from skcomplex.systems.biology.common.kinetics import CompartmentElement
        >>> from skcomplex.core.systems import System
        >>> from skcomplex.systems.biology.oncology import PowerLawGrowthInteraction
        >>> system = System(
        ...     elements=[CompartmentElement('tumour', x=1.0)],
        ...     interactions=[PowerLawGrowthInteraction('growth', target='tumour', r=1.0, p=0.5)],
        ... )
        >>> trajectory = system.prepare().simulate(until=2.0, dt=0.01)
        >>> round(float(trajectory.get_values('tumour.x')[-1]), 3)
        4.0
    """

    def __init__(
        self,
        label: str,
        *,
        target: Role,
        r: Annotated[float, RealSet.open(0, oo)] = 1.32,
        p: Annotated[float, RealSet.open(0, oo)] = 0.58,
        state: str = 'x',
    ) -> None:
        super().__init__(label, target=target, r=r, p=p, form='power', state=state)

    def _get_rate(self, namespace: SimpleNamespace) -> Expression:
        """Return the power-law growth, with no harvest.

        Args:
            namespace:
                The namespace of the symbols the rate can use, with the namespace of the target.

        Returns:
            rate:
                The rate of the population.
        """
        return self._get_growth(namespace)

class MortalityInteraction(Interaction):
    """Death or loss at a constant per capita rate, `dx/dt = -d x`.

    Args:
        label:
            The label of the interaction.

        target:
            The path of the element or group whose population dies.

        d:
            The per capita death rate.

        state:
            The name of the state of the target that holds the population.

    Examples:
        >>> from skcomplex.systems.biology.common.kinetics import CompartmentElement
        >>> from skcomplex.core.systems import System
        >>> from skcomplex.systems.biology.common.populations import MortalityInteraction
        >>> system = System(
        ...     elements=[CompartmentElement('foxes', x=8.0)],
        ...     interactions=[MortalityInteraction('death', target='foxes', d=0.5)],
        ... )
        >>> trajectory = system.prepare().simulate(until=2.0, dt=0.01)
        >>> round(float(trajectory.get_values('foxes.x')[-1]), 3)
        2.943
    """

    law_classes = (RateLaw,)

    def __init__(
        self,
        label: str,
        *,
        target: Role,
        d: Annotated[float, RealSet.closed_open(0, oo)] = 0.1,
        state: str = 'x',
    ) -> None:
        super().__init__(label)
        self.target = target
        self.d = d
        self.state = state

    def _prepare(self, context: SimpleNamespace) -> None:
        """Set the rate of the population.

        Args:
            context:
                The namespace of the target, the time `t`, and the parameters.
        """
        super()._prepare(context)
        self.laws_ = [RateLaw(getattr(context.target, self.state), self._get_rate(context))]

    def _get_rate(self, namespace: SimpleNamespace) -> Expression:
        """Return the loss `-d x`.

        Args:
            namespace:
                The namespace of the symbols the rate can use, with the namespace of the target.

        Returns:
            rate:
                The rate of the population.
        """
        loss: Expression = -namespace.d * getattr(namespace.target, self.state)
        return loss

Equations

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

tumour.x: diff(x_tumour(t), t) == r_growth*x_tumour(t)^p_growth - d_loss*x_tumour(t)