This method builds a data frame containing forest nodes.
Value
A data frame representing, for each node
in the forest, the identified (column cell_id),
the node's depth (column depth),
whenever the node is not a root, the ancestor
identifier (column ancestor), whenever the
node was sampled, i.e., it is one of the forest
leaves, the name of the sample containing the
node, (column sample), the mutant (column
mutant), the epistate (column epistate),
and the birth time (column birth_time).
Examples
# set the seed of the random number generator
set.seed(0)
# create a simulation
sim <- TissueSimulation()
sim$add_mutant(name = "A",
growth_rate = 0.2,
death_rate = 0.01)
sim$place_cell("A", 500, 500)
sim$death_activation_level <- 100
sim$run_up_to_size(species = "A", num_of_cells = 50000)
#>
[███████████████████████████████████████-] 95% [00m:00s] Cells: 47829
[████████████████████████████████████████] 100% [00m:00s] Saving snapshot
# sample the region [450,500]x[475,550]
sim$sample_cells("S1", lower_corner=c(450,475), upper_corner=c(500,550))
# build the sample forest
forest <- sim$get_sample_forest()
nodes <- forest$get_nodes()
head(nodes, 5)
#> cell_id ancestor depth mutant epistate sample birth_time
#> 1 0 NA 0 A <NA> 0.000000
#> 2 1 0 1 A <NA> 2.870718
#> 3 2 0 1 A <NA> 2.870718
#> 4 3 1 2 A <NA> 4.272592
#> 5 4 1 2 A <NA> 4.272592
