Skip to contents

This method chooses one cell among those of a mutant.

Arguments

mutant

The mutant of the cell to choose.

lower_corner

The lower corner of the rectangular selection (optional).

upper_corner

The upper corner of the rectangular selection (optional).

Value

A list reporting cell_id, mutant, epistate, position_x, and position_y of the choosen cell.

Details

It randomly chooses one of the cells of a mutant. Optionally, the lower and upper corners of a tissue rectangular selection can be provided to obtain one cell in the rectangle.

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.1, "-+" = 0.01),
               growth_rates = c("+" = 0.15, "-" = 0.4),
               death_rates = c("+" = 0.1, "-" = 0.01))
sim$place_cell("A+", 500, 500)
sim$death_activation_level <- 100
sim$schedule_mutation("A","B",20)
sim$run_up_to_size(species = "B-", num_of_cells = 50)
#> 
 [████████████████████████████████████████] 100% [00m:00s] Saving snapshot                                 


# Randomly choose one cell in "B" in the tissue
sim$choose_cell_in(mutant = "B")
#>   cell_id mutant epistate position_x position_y
#> 1     787      B        -        490        499