Skip to content

Linear-quadratic cell survival and biologically effective dose

The linear-quadratic survival of cells after a total dose.

  • Class: LQCellSurvivalSystem
  • Import: from skcomplex.systems.biology.oncology import LQCellSurvivalSystem
  • Field: biology/oncology
  • Topics: radiotherapy, static, dose response
  • References:
    • Padmanabhan, Meskin, and Al Moustafa 2021
    • Fowler 1989

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 LQCellSurvivalSystem

trajectory = LQCellSurvivalSystem().prepare().simulate()

Parameters

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

Parameter Default
dose 2.0
fractions 1.0
alpha 0.3
beta 0.03
repair_rate 0.46
delivery_time 0.001
solver 'auto'
backend 'auto'

Tags

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

Tag Values
Time continuous, static
Space none
Laws equation
Randomness deterministic
Domains real
Structure fixed

Class

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

class LQCellSurvivalSystem(BaseSystem):
    """The linear-quadratic survival of cells after a total dose.

    It comes with its biologically effective dose.

    The survival is `exp(-alpha D - beta G D^2)` (Padmanabhan et al. 2021 Eqs. 6.6-6.8), and the Lea-Catcheside factor
    `G` holds the repair between and during fractions. A `sweep` of the dose gives the survival
    curve, and 30 fractions of 2 Gy at `alpha / beta = 10` give the biologically effective dose of 72 Gy. The system has
    the states `cells.survival`, `cells.protraction`, and `cells.effective_dose`.

    Args:
        dose:
            The total dose, in Gy.

        fractions:
            The number of fractions.

        alpha:
            The linear coefficient, per Gy.

        beta:
            The quadratic coefficient, per Gy squared.

        repair_rate:
            The rate of repair of sublethal damage, per hour.

        delivery_time:
            The time to deliver one fraction, in hours.

        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 LQCellSurvivalSystem
        >>> trajectory = LQCellSurvivalSystem(60.0, fractions=30.0).prepare().simulate(until=1.0)
        >>> round(float(trajectory.get_values('cells.effective_dose')[0]), 1)
        72.0
    """

    field = 'biology/oncology'
    topics = ('radiotherapy', 'static', 'dose response')
    references = ('Padmanabhan, Meskin, and Al Moustafa 2021', 'Fowler 1989')

    def __init__(
        self,
        dose: float = 2.0,
        *,
        fractions: float = 1.0,
        alpha: float = 0.3,
        beta: float = 0.03,
        repair_rate: float = 0.46,
        delivery_time: float = 1e-3,
        label: str = 'system',
        solver: BaseSolver | str = 'auto',
        backend: BaseBackend | str = 'auto',
    ) -> None:
        super().__init__(label, solver=solver, backend=backend)
        self.dose = dose
        self.fractions = fractions
        self.alpha = alpha
        self.beta = beta
        self.repair_rate = repair_rate
        self.delivery_time = delivery_time

    def _prepare(self, context: Sequence[Observable] | None = None) -> None:
        """Set the system of the linear-quadratic survival of cells after a total dose.

        Args:
            context:
                The observables to compile with the problem, or `None` for none.
        """
        super()._prepare(context)
        cells = LinearQuadraticSurvivalElement(
            'cells',
            alpha=self.alpha,
            beta=self.beta,
            dose=self.dose,
            fractions=self.fractions,
            repair_rate=self.repair_rate,
            delivery_time=self.delivery_time,
        )
        self.system_ = System(
            self.label,
            elements=[cells],
            interactions=[LinearQuadraticSurvivalInteraction('survival', target='cells')],
        )

Components

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

Elements:

  • LinearQuadraticSurvivalElement, from Element

Interactions:

  • LinearQuadraticSurvivalInteraction, from Interaction
class LinearQuadraticSurvivalElement(Element):
    """Irradiated cells, with their surviving fraction, Lea-Catcheside factor, effective dose, and dose.

    Args:
        label:
            The label of the cells.

        survival:
            The initial guess of the surviving fraction, which the equations replace.

        protraction:
            The initial guess of the Lea-Catcheside factor, which the equations replace.

        effective_dose:
            The initial guess of the biologically effective dose, which the equations replace.

        alpha:
            The linear coefficient, per Gy.

        beta:
            The quadratic coefficient, per Gy squared.

        dose:
            The total dose, in Gy.

        fractions:
            The number of fractions.

        repair_rate:
            The rate of repair of sublethal damage, per hour.

        delivery_time:
            The time to deliver one fraction, in hours.

    Examples:
        >>> from skcomplex.systems.biology.oncology import LinearQuadraticSurvivalElement
        >>> LinearQuadraticSurvivalElement('cells', dose=60.0, fractions=30.0).fractions
        30.0
    """

    def __init__(
        self,
        label: str,
        *,
        survival: float = 1.0,
        protraction: float = 1.0,
        effective_dose: float = 0.0,
        alpha: Annotated[float, RealSet.open(0, oo)] = 0.3,
        beta: Annotated[float, RealSet.open(0, oo)] = 0.03,
        dose: Annotated[float, RealSet.closed_open(0, oo)] = 2.0,
        fractions: Annotated[float, RealSet.closed_open(1, oo)] = 1.0,
        repair_rate: Annotated[float, RealSet.open(0, oo)] = 0.46,
        delivery_time: Annotated[float, RealSet.open(0, oo)] = 1e-3,
    ) -> None:
        super().__init__(label)
        self.survival = survival
        self.protraction = protraction
        self.effective_dose = effective_dose
        self.alpha = alpha
        self.beta = beta
        self.dose = dose
        self.fractions = fractions
        self.repair_rate = repair_rate
        self.delivery_time = delivery_time

class LinearQuadraticSurvivalInteraction(Interaction):
    """Linear-quadratic survival, Lea-Catcheside factor, and effective dose of irradiated cells.

    The survival is `S = exp(-alpha D - beta G D^2)`, where `D` is the total dose. The Lea-Catcheside factor of `n`
    fractions, each delivered at a constant rate in a time `T` with repair at the rate `mu`, far enough apart to repair
    between them, is `G = 2 (mu T - 1 + exp(-mu T)) / (n (mu T)^2)`, which tends to `1 / n` as `T` tends to 0. The
    biologically effective dose is `BED = D (1 + G D beta / alpha)`.

    Args:
        label:
            The label of the interaction.

        target:
            The path of the cells, whose values are `survival`, `protraction`, `effective_dose`, `alpha`, `beta`,
            `dose`, `fractions`, `repair_rate`, and `delivery_time`.

    Examples:
        >>> from skcomplex.systems.biology.oncology import LinearQuadraticSurvivalInteraction
        >>> LinearQuadraticSurvivalInteraction('survival', target='cells').target
        'cells'
    """

    law_classes = (ConstraintLaw,)

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

    def _prepare(self, context: SimpleNamespace) -> None:
        """Set the equations of the Lea-Catcheside factor, the survival, and the biologically effective dose.

        Args:
            context:
                The namespace of the target, the time `t`, and the parameters.
        """
        super()._prepare(context)
        s = context.target
        repaired = s.repair_rate * s.delivery_time
        protraction = 2 * (repaired - 1 + exp(-repaired)) / (s.fractions * repaired**2)
        self.laws_ = [
            ConstraintLaw(s.protraction == protraction, target=s.protraction),
            ConstraintLaw(
                s.survival == exp(-s.alpha * s.dose - s.beta * protraction * s.dose**2),
                target=s.survival,
            ),
            ConstraintLaw(
                s.effective_dose == s.dose * (1 + protraction * s.dose * s.beta / s.alpha),
                target=s.effective_dose,
            ),
        ]