Home
RMA kinetics is a library providing models for simulating synthetic serum marker dynamics in various context, including constitutive and drug induced expression.
Currently, there are three main models:
A basic web application is available for simple testing. Please see the web app guide for more information.
Installation
A python package is available on PyPI and can be installed with uv, pip, and possibly other pip compatible alternatives.
To get started with uv, create a new project with uv init in a clean working
directory, or use uv add directly. For example,
uv
The same can be done with standard pip,
pip
Source
To install the package from source, make sure git is installed on your system and follow the workflow detailed below.
- Clone the repository
- Create a new virtual environment. Below is an example using UV to sync dependencies (Linux/Macos).
- Install the rma-kinetics package (
uv pip install -e .).
You can then import the package in scripts or make modifications to source for testing.
Quick Start
from rma_kinetics.models import ConstitutiveRMA
import matplotlib.pyplot as plt
# initialize constitutive RMA model
model = ConstitutiveRMA(
rma_prod_rate=7e-3,
rma_rt_rate=1,
rma_deg_rate=7e-3
)
# simulate model and plot plasma RMA
solution = model.simulate(t0=0, t1=72, y0=(0,0))
print(f"Plasma RMA at final timepoint: {solution.plasma_rma[-1]}")
print(f"Brain RMA at final timepoint: {solution.brain_rma[-1]}")
solution.plot_plasma_rma()
plt.gcf()
All RMA models can be run by calling the simulate method detailed below.
simulate
Simulates model within the given time interval.
Wraps diffrax.diffeqsolve with specific defaults for RMA model simulation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t0
|
float
|
Start time of integration. |
required |
t1
|
float
|
Stop time of integration. |
required |
y0
|
PyTree[float]
|
Tuple of initial conditions. |
required |
dt0
|
float | None`
|
Initial step size if using adaptive step sizes, or size of all steps if using constant stepsize. |
None
|
sampling_rate
|
float
|
Sampling rate for saving solution. |
1
|
stepsize_controller
|
AbstractStepSizeController`
|
Determines how to change step size during integration. |
PIDController(rtol=1e-05, atol=1e-05)
|
max_steps
|
int
|
Max number of steps before stopping. |
4096
|
solver
|
AbstractSolver
|
Differential equation solver. |
Kvaerno3()
|
adjoint
|
AbstractAdjoint
|
How to differentiate. |
RecursiveCheckpointAdjoint()
|
throw
|
bool
|
Raise an exception if integration fails. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
solution |
Solution
|
A solution object (parent of diffrax.Solution) with added plotting methods. |
Simulations return a Solution object which can be used to inspect the results.
Please see the API reference or examples for more details.
Citation
Will be updated shortly.