caravagnalab / rRACES

R wrapper for the RACES package
GNU General Public License v3.0
2 stars 1 forks source link

aborting session with this example #114

Closed riccardobergamin closed 5 months ago

riccardobergamin commented 6 months ago

R studio aborts at the last command when i run the following simulation example:

library(rRACES)
library(dplyr)

sim <- new(Simulation, "SPN07",
           seed = 7,
           save_snapshot = F)

sim$duplicate_internal_cells <- F

sim$update_tissue("Liver", 2e3, 2e3)

sim$add_mutant(name = "1",
               growth_rates = 0.3,
               death_rates = 0)

sim$place_cell("1", 1000, 1000)

sim$run_up_to_size("1",100)

sim$add_mutant(name = "2",
               growth_rates = 0.3*(1+0.5),
               death_rates = 0)

sim$mutate_progeny(as.data.frame((sim$get_cells()  %>% 
                                    filter(mutant == '1') %>% arrange(position_x))[1,]), "2")

sim$run_up_to_size("2",100)

print(sim)

sim$add_mutant(name = "3",
               growth_rates = 0.3*(1+0.7),
               death_rates = 0)

sim$mutate_progeny(as.data.frame((sim$get_cells()  %>% 
                                    filter(mutant == '2') %>% arrange(position_x))[1,]), "3")

sim$run_up_to_size("3",100)

print(sim)

sim$add_mutant(name = "4",
               growth_rates = 0.3*(1+0.9),
               death_rates = 0)

sim$mutate_progeny(as.data.frame((sim$get_cells()  %>% 
                                    filter(mutant == '2') %>% arrange(position_x))[1,]), "4")

sim$duplicate_internal_cells <- T

sim$update_rates("1", c(death = 1))
sim$update_rates("2", c(death = 0.1))
sim$update_rates("3", c(death = 0.1))
sim$run_up_to_size("4",1e2)

sim$duplicate_internal_cells <- F

sim$run_up_to_size("4",1e4)

print(sim)

tissue_pre = plot_tissue(sim,num_of_bins  = 200)

bbox = sim$search_sample(c("3" = 500,"2" = 1900),nw = 50,nh = 50)

sim$sample_cells("A", bbox$lower_corner, bbox$upper_corner)

forest <- sim$get_samples_forest()
albertocasagrande commented 6 months ago

The above code works as expected on my machine. What kind of machine are you using? Can you save your script in the file test_116.R and post a complete log of the following commands?

neofetch
Rscript test_116.R
albertocasagrande commented 5 months ago

Closed by commit e8cce348a200176b9ad037074c704227d46e2e39