Parallel Single Cell Simulations

See code in GitLab.
Author: Moritz Linder moritz.linder@kit.edu

Overview

cd ${TUTORIALS}/01_EP_single_cell/12_parallel_single_cell

This example demonstrates how to run single-cell simulations in parallel. Specifically, it showcases a Population of Models (PoMs) approach where multiple parameters are varied using Latin Hypercube Sampling (LHS) as a potential application. The calibration of this PoM to experimental data is not covered in this example.

Problem Definition

Experimental uncertainties and biological variability are often substantial in physiological studies, with values of key parameters varying widely between individuals due to physiological and genetic diversity 1 . Furthermore, large standard deviations are typically observed in experiments on cardiac myocytes of one and the same individual. As a result, sampling parameters and constructing computational Populations of Models (PoMs) provide a valuable complementary strategy for calibrating models, and investigating the underlying pathomechanisms of various cardiovascular diseases. When many parameters are specified and varied across broad ranges, the number of required simulations increases substantially. In such cases, running multiple single-cell simulations in parallel across different cores becomes a practical and efficient solution.

As with random sampling methods, there is a risk of missing out on significant regions of the parameter space. To address this, Latin Hypercube Sampling (LHS) was chosen for this example 2 . LHS is a statistical method designed to generate near-random samples of parameter values from multidimensional distributions in a more structured way. When sampling a function of n variables, the range of each variable is divided into d equally probable intervals. Then, d sample points are selected such that the Latin hypercube criterion is met - ensuring that each interval for every variable is sampled exactly once. This approach requires the number of intervals d to be the same across all variables 3 .

Experimental Setup

To define the LHS, we need to create a sampler based on the LatinHypercube class of pythons scipy_stats package. This is done in the LHS sampling options section of the run.py script.

sampler = qmc.LatinHypercube(d=10)    # 10 different parameters should be sampled
sample = sampler.random(n=200)    # a maximum of 200 models is fixed

sample_scaled = qmc.scale(sample, [0.5] * 10, [2.0] * 10)    # define lower and upper bounds to multiply by each parameter
sample_scaled = np.round(sample_scaled, 4)

The parameters are added to the argument --imp-par by iterating over a list containing all specified parameters. In this example the sampling is performed for the conductance values of all membrane currents of the sinoatrial node cell model by Severi et al. (2012) 4 :

imp_par = f''
param_names = ['P_CaL', 'P_CaT', 'K_NaCa', 'INaK_max', 'Gf_Na_max', 'Gf_K_max', 'GKs_max', 'GKr_max', 'Gto_max', 'GNa_max']

# add parameters from the current sample
for idx, value in enumerate(sample):
    imp_par += f',{param_names[idx]}*{value}'

The bench command is finalised by assigning it a multiprocessing pool, which allows the simulations (i.e., individual processes) to be executed in parallel. In the final step, the list of parameter sets is mapped onto the simulation runs, ensuring that each run receives a distinct set of parameters.

with multiprocessing.Pool(processes=6) as pool:
    pool.map(run, args_list)

In this example, LHS is enabled as a default. The script can be executed with the command python3 run.py. Further experiment-specific options can be configured as needed:

--imp
            IMP to use  (default=`DrouhardRoberge')
--duration
            duration of simulation [ms]    (default=`5000.0')
--dt
            time step [ms]  (default=`.01')
--dt-out
            temporal output granularity [ms]  (default=`1.0')
--start-out
            start time of output [ms]  (default=`0.0')
--imp-par
            comma-seperated string of parameters to modify IMP  (default=`')
--stim-curr
            stimulation current [pA/pF]=[uA/cm^2]  (default=`60.0')

It is important to note that the names of currents, pumps, or exchangers may differ across models. Therefore, the parameters used to scale values such as maximal conductance values should be carefully checked and adjusted accordingly. Moreover, before launching a large number of simulations in parallel, it is recommended to verify the maximum number of available CPU cores and remaining storage capacity on the system to avoid overloading the hardware.

References


  1. Lawson, B. A. J. et al., Unlocking data sets by calibrating populations of models to data density: A study in atrial electrophysiology, Sci. Adv. 4, e1701676, 2018. [ePrint]↩︎

  2. Renardy, M. et al., To Sobol or not to Sobol? The effects of sampling schemes in systems biology applications, Mathematical Biosciences 337, DOI: https://doi.org/10.1016/j.mbs.2021.108593, 2021. [ePrint]↩︎

  3. Wikipedia Contributors, Latin Hypercube Sampling, Wikipedia, The Free Encyclopedia, Mar. 31, 2025. [Online]. [ePrint]↩︎

  4. Severi, S. et al., An updated computational model of rabbit sinoatrial action potential to investigate the mechanisms of heart rate modulation, J. Physiol. 590(18), 4483-99, DOI: 10.1113/jphysiol.2012.229435. [ePrint]↩︎

Recent questions tagged limpet, experiments, examples, bench, single_cell, parameters

There are tagged with limpet, experiments, examples, bench, single_cell, parameters.

Here we display the 5 most recent questions. You can click on each tag to show alle questions for this tag.

You can also ask a new question.

© Copyright 2020 openCARP project    Supported by DFG and EuroHPC    Contact    Imprint and data protection