Get subset of forest nodes corresponding to phylogenetic branches containing relevant biological events (drivers)
Value
A dataframe reporting all the forest nodes corresponding to phylogenetic branches containing relevant biological events (drivers).
Examples
# set the seed of the random number generator
set.seed(0)
sim <- SpatialSimulation()
sim$add_mutant(name = "A",
growth_rates = 1,
death_rates = 0)
sim$place_cell("A", 500, 500)
sim$run_up_to_size("A",1e4)
#>
[████████████████████████████████████████] 100% [00m:00s] Saving snapshot
sim$add_mutant(name = "B",
growth_rates = 3.5,
death_rates = 0)
sim$mutate_progeny(sim$choose_cell_in("A"), "B")
sim$run_up_to_size("B",1e4)
#>
[████████████████████████████████████████] 100% [00m:00s] Saving snapshot
bbox <- sim$search_sample(c("A" = 100,"B" = 100), 50, 50)
sim$sample_cells("Sampling", bbox$lower_corner, bbox$upper_corner)
forest = sim$get_samples_forest()
get_relevant_branches(forest)
#> # A tibble: 4,345 × 7
#> cell_id ancestor mutant epistate sample birth_time label
#> <dbl> <int> <chr> <chr> <chr> <dbl> <chr>
#> 1 0 NA A "" NA 0 Truncal
#> 2 1 0 A "" NA 0.574 Subclonal
#> 3 2 0 A "" NA 0.574 B
#> 4 3 1 A "" NA 0.855 Subclonal
#> 5 6 2 A "" NA 1.36 B
#> 6 7 3 A "" NA 1.41 Subclonal
#> 7 11 7 A "" NA 1.83 Subclonal
#> 8 20 6 A "" NA 2.59 B
#> 9 22 11 A "" NA 2.70 Subclonal
#> 10 25 20 A "" NA 2.84 B
#> # ℹ 4,335 more rows