caravagnalab / rRACES

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

strange error : "Wrong cell file format" #83

Closed riccardobergamin closed 6 months ago

riccardobergamin commented 7 months ago

I get occasionally this strange error when i run rRACES on Linux

Screenshot 2024-02-27 alle 15 25 41
albertocasagrande commented 7 months ago

@riccardobergamin, can you submit the script that raised the issue?

albertocasagrande commented 7 months ago

The cause of the problem is unknown: I have never experienced the above message. It may be due to an issue in the binary cell logger handler or multiple access to the same simulation directory.

Commit 9c1dedaf855b387959e449f816716f5ce5fc967f fixes an issue in cell file handling (which, however, may be unrelated to the problem) and changes the temporary directory name scheme. So, the bug may have already been fixed.

In any case, I am closing this issue because of the lack of feedback.

riccardobergamin commented 6 months ago

Sorry for the delay @albertocasagrande. This is an example:

library(rRACES)
library(ggplot2)
library(dplyr)

sim <- new(Simulation,
           seed = 4,
           save_snapshot = F)

sim$duplicate_internal_cells <- T

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

sim$add_mutant(name = "AML",
                     growth_rates = 3,
                     death_rates = 0)

sim$place_cell("AML", 1e3, 1e3)

sim$run_up_to_time(t = 3.5)

sim$update_rates("AML", c(death = 4, growth=3))

sim$add_mutant(name = "AML_dorm",growth_rates = c(0),death_rates = c(0))
sim$mutate_progeny(sim$choose_cell_in("AML"), "AML_dorm")
sim$run_up_to_time(sim$get_clock() + 2)

bbox = tibble(lower_corner = c(1000,1000),upper_corner = c(1030,1030))
sim$sample_cells("PRE", bbox$lower_corner, bbox$upper_corner)
fpre <- sim$get_samples_forest()

pre_forest = plot_forest(fpre) %>%
  annotate_forest(fpre)

sim$update_rates("AML", c(death = 0, growth=3))
sim$update_rates("AML_dorm", c(death = 0, growth=3))

sim$run_up_to_time(sim$get_clock() + 1)

sim$update_rates("AML", c(death = 6, growth=3))
sim$run_up_to_time(sim$get_clock() + 1.5)

sim$add_mutant(name = "HLA",
                     growth_rates = 3,
                     death_rates = 0)

sim$update_rates("AML_dorm", c(death = 6, growth=3))
sim$mutate_progeny(sim$choose_cell_in("AML_dorm"), "HLA")
sim$run_up_to_time(sim$get_clock() + 4)

sim

n_w <- n_h <- 50
ncells <- 0.8*n_w*n_h
bbox <- sim$search_sample(c("HLA" = ncells), n_w, n_h)

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

frel <- sim$get_samples_forest()

The error i get is : "Aiming cell id 1195955 read Cell{id: 1195956, parent_id: 968139, birth_time: 12.0003, species_id: 2} Errore: Wrong cell file format"

albertocasagrande commented 6 months ago

On which kind of system are you getting the issue?

riccardobergamin commented 6 months ago

I got the error from the above code on mac