Spencerfar / LatentVelo

MIT License
22 stars 4 forks source link

What gene is KO in the knockout_2batches dataset? #4

Closed ericli0419 closed 8 months ago

ericli0419 commented 8 months ago

Dear Spencer,

Thanks so much for sharing your great work. I have read your paper and i am wondering what gene-module was knockouted in the knockout_2batches dataset.

Thanks so much for your kind help!

Best, Yuzhe

Spencerfar commented 8 months ago

Module B3. The code for it looks like this

library(tidyverse)
library(dyngen)

set.seed(1)

backbone <- backbone_bifurcating()

config <-
  initialise_model(
    backbone = backbone,
    num_cells = 1000,
    num_tfs = nrow(backbone$module_info),
    num_targets = 25,
    num_hks = 25,
    verbose = interactive(),
    download_cache_dir = tools::R_user_dir("dyngen", "data"),
    simulation_params = simulation_default(
      census_interval = 1, 
      ssa_algorithm = ssa_etl(tau = 0.01),
      experiment_params = simulation_type_wild_type(num_simulations = 100),
      compute_rna_velocity=TRUE
    )
  )

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

model_wt <- model_common %>% 
  generate_kinetics()  %>%
  generate_gold_standard() %>%
  generate_cells()

model_ko <- model_common %>% 
  generate_kinetics()  %>%
  generate_gold_standard()

b3_genes <- model_ko$feature_info %>% filter(module_id == "B3") %>% pull(feature_id)

model_ko$simulation_params$experiment_params <- simulation_type_knockdown(
  num_simulations = 100L,
  timepoint = 0,
  genes = b3_genes,
  num_genes = length(b3_genes),
  multiplier = 0
)

model_ko <- model_ko %>%
  generate_cells()

model_comb <-
  combine_models(list(WT = model_wt, KO = model_ko)) %>% 
  generate_experiment()

library(anndata)
ad <- as_anndata(model_comb)
ad$write_h5ad("knockout_2batches.h5ad")
ericli0419 commented 8 months ago

Thank you so much! :)