Skip to contents

The objects of this class describes properties of the simulation status.

A formula is:

  • a relation among two expressions (operators <, <=, ==, !=, >=, >);

  • the conjunction of two formulas (operator &);

  • the disjunction of two formulas (operator |).

See also

Variable, Simulation$var(), vignette("tissue_simulation")

Examples

# build a simulation and add two species to it
# set the seed of the random number generator
set.seed(0)

# create a simulation
sim <- SpatialSimulation()
sim$add_mutant(name = "A",
               epigenetic_rates = c("+-" = 0.01, "-+" = 0.01),
               growth_rates = c("+" = 0.2, "-" = 0.08),
               death_rates = c("+" = 0.1, "-" = 0.01))

# get a formula that holds when the cardinality of the mutant A
# is greater than 1000
f1 <- sim$var("A+") + sim$var("A-") > 1000

# get a formula that holds when the simulated time is 10 at least
f2 <- sim$var("Time") >= 40

# get a formula that holds when the number of duplications doubles
# the switch from A+
f3 <- sim$var("A+.duplications") > 2 * sim$var("A+.switches")

# combine above formulas by using Boolean operators `&` and `|`
f1 & (f2 | f3)
#> |A+|+|A-|>1000 and (Time>=40 or |A+.duplications|>2*|A+.switches|)