-
Notifications
You must be signed in to change notification settings - Fork 12
Cell Lineage Simulation Original Documentation
This section details the deprecated Cell Lineage Simulation Functionality. For documentation on the newer bioscrape.lineages package, see lineage package documentation.
To do simulations with volume, you must specify growth and division dynamics for the cells.
With volume simulations, you must specify the cell's growth and division dynamics. There are two cell growth models available. One is called the StochasticTimeThresholdVolume and can be initialized as followed.
v = StochasticTimeThresholdVolume(cell_division_time,division_volume,noise)
junk = np.zeros(10,)
v.py_initialize(junk, junk, 0.0, 1.0)
Here, the object is initialized with a desired cell division time and a volume at which to divide. The volume must be initialized with the current time and volume. The two junk arguments correspond to the current state and parameters. This volume object however does not depend on the state/parameters and so we can just pass in a junk argument into the initialize function. In this volume model, the cell grows exponentially at a rate set by the cell division time and then divides when it reached the division_volume with some noise specified by the noise parameter. A normal value of the noise parameter is 0.05.
The general volume growth model allows the growth rate to depend on the state.
growth_rate = '0.1 * (1 - toxin / _scaling_parameter)'
v = StateDependentVolume(2.0, 0.05, growth_rate ,m)
v.py_initialize(junk, junk, 0.0, 1.0)
This creates a volume model where the cell's growth rate decreases as the amount of toxin increases. Again, the 2.0 is the division volume, and 0.05 is a noise parameter that makes it so the division volume is not always exactly 2.0. The growth_rate is a string that contains the algebraic expression for the growth rate, and m is a Model object that contains the species toxin and parameter scaling_parameter. Again, this volume object does not depend on the state/parameters for initialization, so we can pass in junk to initialize. Once this volume has been created, simulations can be performed as normal for the Model m with a growth rate that varies as a function of the state.
There are two models for partitioning at cell division. The first one is simpler. It is called the PerfectBinomialVolumeSplitter and can be created as follows.
from bioscrape.simulator import PerfectBinomialVolumeSplitter
p = PerfectBinomialVolumeSplitter()
When the cell divides, this partitioning method will simply split the cell's volume exactly in half and split all the species with probability 0.5.
The second is the GeneralVolumeSplitter.
from bioscrape.simulator import GeneralVolumeSplitter
vsplit = GeneralVolumeSplitter()
vsplit.py_set_partitioning({"perfect": ['mRNA'],"duplicate": ['genome_DNA']},m)
The third line here tells the splitter that mRNA should be divided perfectly between the daughter cells, while the genome_DNA should be duplicated and each daughter cell should receive a copy. Any species not explicitly mentioned will be partitioned binomially.
When you are doing a simulation with growth/division and delay, you must use a different simulator as well as a different partitioning model because now the cell state is both the current species count as well as the queued up future reactions. Thus, you need a partitioning method that can split both the future reactions as well as the current state.
p = PerfectBinomialDelayVolumeSplitter()
This will create a partitioner that will split the volume in half, partition all the species binomially with p=0.5, and then also partition all the queued up reactions binomially with p=0.5 as well.
Warning: If the queued up reactions are degradation reactions, this could lead to negative species counts, so be careful with this. It is really only a good idea if the delayed reactions are reactions that produce things but don't degrade things.