Exponential-linear tumour growth
A tumour that grows exponentially while small and linearly later.
- Class:
ExponentialLinearGrowthSystem - Import:
from skcomplex.systems.biology.oncology import ExponentialLinearGrowthSystem - Field:
biology/oncology - Topics:
tumour growth,ode,piecewise - References:
- Padmanabhan, Meskin, and Al Moustafa 2021
- Benzekry et al. 2014
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 ExponentialLinearGrowthSystem
trajectory = ExponentialLinearGrowthSystem().prepare().simulate()
Parameters
The model parameters take these defaults, and set_params changes them.
| Parameter | Default |
|---|---|
n |
2.0 |
r0 |
0.31 |
r |
67.8 |
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 ExponentialLinearGrowthSystem(BaseSystem):
"""A tumour that grows exponentially while small and linearly later.
The growth turns linear once it reaches a limiting rate.
The defaults are the fit to breast cancer volumes in mm³ and days, which switches near day 15. The system has the
volume `tumour.x`.
Args:
n:
The initial volume.
r0:
The exponential growth rate.
r:
The linear growth 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 ExponentialLinearGrowthSystem
>>> ExponentialLinearGrowthSystem().prepare().system_.interactions[0].r0
0.31
"""
field = 'biology/oncology'
topics = ('tumour growth', 'ode', 'piecewise')
references = GROWTH_REFERENCES
until = 40.0
dt = 0.2
def __init__(
self,
n: float = 2.0,
*,
r0: float = 0.31,
r: float = 67.8,
label: str = 'system',
solver: BaseSolver | str = 'auto',
backend: BaseBackend | str = 'auto',
) -> None:
super().__init__(label, solver=solver, backend=backend)
self.n = n
self.r0 = r0
self.r = r
def _prepare(self, context: Sequence[Observable] | None = None) -> None:
"""Set the system of a tumour.
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=[ExponentialLinearGrowthInteraction('growth', target='tumour', r0=self.r0, r=self.r)],
)
Components
The system uses these element and interaction classes, each with its nearest class of the core.
Elements:
PopulationElement, fromElement, through the shared recipeNonnegativeElement
Interactions:
ExponentialLinearGrowthInteraction, fromInteraction
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 ExponentialLinearGrowthInteraction(Interaction):
"""Growth that is exponential until it reaches a linear rate, and linear after.
The exponential growth is `dx/dt = r0 x`, and the linear rate is `r`.
The switch happens at `tau = log(r / (r0 n0)) / r0`, where the two rates meet, so the solution is continuously
differentiable.
Args:
label:
The label of the interaction.
target:
The path of the tumour.
r0:
The exponential growth rate.
r:
The linear growth rate.
Examples:
>>> from skcomplex.systems.biology.oncology import ExponentialLinearGrowthInteraction
>>> ExponentialLinearGrowthInteraction('growth', target='tumour', r=67.8).r
67.8
"""
law_classes = (RateLaw,)
def __init__(
self,
label: str,
*,
target: Role,
r0: Annotated[float, RealSet.open(0, oo)] = 0.31,
r: Annotated[float, RealSet.open(0, oo)] = 67.8,
) -> None:
super().__init__(label)
self.target = target
self.r0 = r0
self.r = r
def _prepare(self, context: SimpleNamespace) -> None:
"""Set the rate of the `x` of the target.
Args:
context:
The namespace of the bound elements, the time `t`, and the parameters.
"""
super()._prepare(context)
self.laws_ = [RateLaw(context.target.x, self._get_rate(context))]
def _get_rate(self, s: SimpleNamespace) -> Expression:
"""Return the rate `min(r0 x, r)`.
Args:
s:
The namespace of the symbols the laws can use.
Returns:
rate:
The rate of the size of the tumour.
"""
exponential = s.r0 * s.target.x
return minimum(exponential, s.r)
Equations
The equations are those that symbolic returns for the system with its default parameters.
tumour.x: diff(x_tumour(t), t) == where(r_growth < r0_growth*x_tumour(t), r_growth, r0_growth*x_tumour(t))