continue_driver_process_sim: Restarts a multiple driver scenario

View source: R/wrapped_sims.R

continue_driver_process_simR Documentation

Restarts a multiple driver scenario

Description

The user specifies the rate at which drivers are introduced and the distribution the selective coefficients are drawn from. Note that unlike in run_selection_sim the drivers are allowed to stochastically die out. The drivers at the specified rate with the gap between successive introductions exponentially distributed.

Usage

continue_driver_process_sim(insim, nyears, fitnessGen)

Arguments

insim
  • Result of previous sim

nyears
  • Total number of years to run the simulation

final_division_rate
  • Rate of symmetric cell division once population equilibrium is reached.

target_pop_size
  • Size of target population

drivers_per_year
  • The expected number of drivers per year

bForceReseed
  • Whether to reseed.

offset
  • time offset for choosing seed.

Value

simpop object.

Examples

fitnessGen=function(){
 trials=rexp(100,rate=30)
 idx=which(trials>0.05)
 if(length(idx)==0){
  fitnessGen()
 }else{
  trials[idx[1]]
 }
}
dps=run_driver_process_sim(0.1,1/(2*190),target_pop_size = 1e5,nyears = 30,fitness=fitnessGen,drivers_per_year = 5)
## Do stuff - subsample, plot trees etc and the restart to simulate the next 10 years:
dps2=continue_driver_process_sim(dps,40,fitnessGen = fitnessGen)
## Do stuff and simulation the next 10 years
dps2=continue_driver_process_sim(dps2,50,fitnessGen = fitnessGen)

NickWilliamsSanger/rsimpop documentation built on Sept. 6, 2024, 12:42 a.m.