dynverse / dyngen

Simulating single-cell data using gene regulatory networks 📠
https://dyngen.dynverse.org
Other
72 stars 6 forks source link

Incompatible Tibble sizes when generating knockdown model #56

Open YinoZ opened 11 months ago

YinoZ commented 11 months ago

Hi, Thank you for amazing works. I'm encountering an issue while attempting to generate a knockdown model and would appreciate some help. I have successfully followed the tutorial to generate model_common. However, I am facing the following error when trying to generate model_ko:

Error in `tibble()`:
! Tibble columns must have compatible sizes.
• Size 500: Existing data.
• Size 100: Column at position 6.
ℹ Only values of size one are recycled.

I suspect the issue may arise from generating a more complex tf_network where I did not use the default nrow(backbone$module_info). Here is the code I used to generate model_common:

set.seed(42)

backbone <- backbone_bifurcating()

config <-
  initialise_model(
    backbone = backbone,
    num_cells = 5000,
    num_tfs = 100,
    num_targets = 500,
    num_hks = 100,
    verbose = FALSE,
    download_cache_dir = tools::R_user_dir("dyngen", "data"),
    simulation_params = simulation_default(
      total_time = 1000,
      census_interval = 2, 
      ssa_algorithm = ssa_etl(tau = 300/3600),
      experiment_params = simulation_type_wild_type(num_simulations = 100)
    )
  )

model_common <-
  config %>%
  generate_tf_network() %>%
  generate_feature_network() %>% 
  generate_kinetics() %>%
  generate_gold_standard()

Then, the code to generate model_ko is as follows:

plot_backbone_modulenet(model_common)
b3_genes <- model_common$feature_info %>% filter(module_id == "B3") %>% pull(feature_id)
model_ko <- model_common
model_ko$simulation_params$experiment_params <- simulation_type_knockdown(
  num_simulations = 100L,
  timepoint = 0.2, 
  genes = b3_genes,
  num_genes = length(b3_genes),
  multiplier = 0
)

I suspect the issue may be related to not using the default number of rows when generating tf_network. Is there a way to resolve this issue, or how should I correctly generate a more complex tf_network?

Thank you!