Selects a clone type on which an event (birth, death, etc.) will occur based on the population size and action rate of each clone type.
pick_action_cell(population, action_rate)A character string representing the name of the selected clone type
This function implements the clone type selection step in the Gillespie algorithm. The probability of selecting a particular clone type is proportional to its population multiplied by its action rate. This ensures that more abundant clones and clones with higher rates are more likely to be selected.
# Example usage:
population <- c(Clone1 = 10, Clone2 = 5)
action_rate <- c(Clone1 = 0.1, Clone2 = 0.05)
selected_clone <- pick_action_cell(population, action_rate)
#> Warning: restarting interrupted promise evaluation
#> Warning: internal error -3 in R_decompress1
#> Error: lazy-load database '/Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library/cancerSimCraft/R/cancerSimCraft.rdb' is corrupt
print(selected_clone) # Possible output: "Clone1"
#> Error: object 'selected_clone' not found