Skip to contents

This method returns the lineage graph of the simulation.

Value

A dataframe reporting ancestor, progeny, and first_occurrence of each species-to-species transition.

Details

At the beginning of the computation only the species of the added cells are present in the tissue. As the simulation proceeds new species arise as a consequence of either mutant mutations or epigenetic switches. The lineage graph stores these species evolutions and it reports the first occurrence time of any species-to-species transition.

Examples

# 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))
sim$add_mutant(name = "B",
               epigenetic_rates = c("+-" = 0.02, "-+" = 0.01),
               growth_rates = c("+" = 0.3, "-" = 0.1),
               death_rates = c("+" = 0.1, "-" = 0.01))
sim$schedule_mutation(src = "A", dst = "B", time = 20)
sim$run_up_to_time(50)
#> 
 [█---------------------------------------] 0% [00m:00s] Saving snapshot                                          

 [█---------------------------------------] 0% [00m:00s] Cells: 0                                                 

 [█---------------------------------------] 0% [00m:00s] Cells: 0                                                 

 [█---------------------------------------] 0% [00m:00s] Cells: 0                                                 


sim$get_lineage_graph()
#> [1] ancestor    progeny     first_cross
#> <0 rows> (or 0-length row.names)