Skipper-Schabel-Wilcox log-kill
The log-kill system of an exponentially growing tumour.
- Class:
SkipperLogKillSystem - Import:
from skcomplex.systems.biology.oncology import SkipperLogKillSystem - Field:
biology/oncology - Topics:
chemotherapy,ode,log kill,dosing - References:
- Padmanabhan, Meskin, and Al Moustafa 2021
- Skipper, Schabel, and Wilcox 1964
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 SkipperLogKillSystem
trajectory = SkipperLogKillSystem().prepare().simulate()
Parameters
The model parameters take these defaults, and set_params changes them.
| Parameter | Default |
|---|---|
n |
1000000.0 |
r |
0.223 |
a |
2.0 |
dose |
1.0 |
period |
7.0 |
width |
1.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 SkipperLogKillSystem(BaseSystem):
"""The log-kill system of an exponentially growing tumour.
Every dose kills a fixed fraction of the tumour.
The tumour follows `dn/dt = r n - a n U(t)`, where the exposure `U` is `dose` for `width` days every `period` days.
Every dose lowers `log n` by `a dose width`, whatever the size, and the tumour regrows between doses. The growth
rate is the exponential fit to breast cancer, per day. The system has the cells `tumour.x`.
Args:
n:
The initial number of cells.
r:
The growth rate.
a:
The kill rate per unit of exposure.
dose:
The exposure during a dose.
period:
The time between the starts of doses.
width:
The duration of a dose.
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 SkipperLogKillSystem
>>> SkipperLogKillSystem(period=21.0).prepare().system_.interactions[1].period
21.0
"""
field = 'biology/oncology'
topics = ('chemotherapy', 'ode', 'log kill', 'dosing')
references = ('Padmanabhan, Meskin, and Al Moustafa 2021', 'Skipper, Schabel, and Wilcox 1964')
until = 42.0
dt = 0.1
def __init__(
self,
n: float = 1e6,
*,
r: float = 0.223,
a: float = 2.0,
dose: float = 1.0,
period: float = 7.0,
width: float = 1.0,
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.a = a
self.dose = dose
self.period = period
self.width = width
def _prepare(self, context: Sequence[Observable] | None = None) -> None:
"""Set the system of the log-kill system.
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=[
ExponentialGrowthInteraction('growth', target='tumour', r=self.r),
LogKillInteraction(
'kill',
target='tumour',
a=self.a,
dose=self.dose,
period=self.period,
width=self.width,
),
],
)
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:
ExponentialGrowthInteraction, fromInteractionLogKillInteraction, 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 ExponentialGrowthInteraction(GrowthInteraction):
"""Growth at a constant per capita rate, `dx/dt = r x`.
It is the exponential form of a growth without harvest.
Args:
label:
The label of the interaction.
target:
The path of the element or group whose population grows.
r:
The per capita growth rate, negative for decay.
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 ExponentialGrowthInteraction
>>> system = System(
... elements=[CompartmentElement('rabbits', x=1.0)],
... interactions=[ExponentialGrowthInteraction('growth', target='rabbits', r=0.5)],
... )
>>> trajectory = system.prepare().simulate(until=2.0, dt=0.01)
>>> round(float(trajectory.get_values('rabbits.x')[-1]), 3)
2.718
"""
def __init__(
self,
label: str,
*,
target: Role,
r: float = 1.0,
state: str = 'x',
) -> None:
super().__init__(label, target=target, r=r, form='exponential', state=state)
def _get_rate(self, namespace: SimpleNamespace) -> Expression:
"""Return the growth `r x`, 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 LogKillInteraction(Interaction):
"""Cell kill proportional to the tumour and to a drug exposure.
The exposure is given in a train of rectangular doses.
The kill is `dx/dt = -a x U(t)`, where the exposure `U` is `dose` for `width` time units every `period`, from
`start` on. Without growth, every dose lowers `log x` by `a dose width`.
Args:
label:
The label of the interaction.
target:
The path of the tumour.
a:
The kill rate per unit of exposure.
dose:
The exposure during a dose.
period:
The time between the starts of doses.
width:
The duration of a dose.
start:
The time of the first dose.
Examples:
>>> from skcomplex.systems.biology.oncology import LogKillInteraction
>>> LogKillInteraction('kill', target='tumour', period=21.0).period
21.0
"""
law_classes = (RateLaw,)
def __init__(
self,
label: str,
*,
target: Role,
a: Annotated[float, RealSet.closed_open(0, oo)] = 0.5,
dose: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
period: float = 7.0,
width: float = 1.0,
start: float = 0.0,
) -> None:
super().__init__(label)
self.target = target
self.a = a
self.dose = dose
self.period = period
self.width = width
self.start = start
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 `-a x U(t)`.
Args:
s:
The namespace of the symbols the laws can use.
Returns:
rate:
The rate of the size of the tumour.
"""
exposure = pulse_train(s.t, self.period, self.width, start=self.start)
return -s.a * s.dose * exposure * s.target.x
Equations
The equations are those that symbolic returns for the system with its default parameters.
tumour.x: diff(x_tumour(t), t) == -a_kill*dose_kill*where(both(t >= 0.0, mod(t, 7.0) < 1.0), 1.0, 0)*x_tumour(t) + r_growth*x_tumour(t)