diff --git a/sceptre_paper/analysis_drivers/analysis_drivers_xie/run_monocle_nb_at_scale.R b/sceptre_paper/analysis_drivers/analysis_drivers_xie/run_monocle_nb_at_scale.R index 1895e3c..ff25be9 100644 --- a/sceptre_paper/analysis_drivers/analysis_drivers_xie/run_monocle_nb_at_scale.R +++ b/sceptre_paper/analysis_drivers/analysis_drivers_xie/run_monocle_nb_at_scale.R @@ -1,21 +1,22 @@ args <- commandArgs(trailingOnly = TRUE) +library(monocle) code_dir <- if (is.na(args[1])) "/Users/timbarry/research_code/sceptre-manuscript" else args[1] source(paste0(code_dir, "/sceptre_paper/analysis_drivers/analysis_drivers_xie/paths_to_dirs.R")) source(paste0(code_dir, "/sceptre_paper/analysis_drivers/analysis_drivers_xie/gasp_custom_functs.R")) cds <- readRDS(paste0(processed_dir, "/monocole_obj.rds")) pairs <- fst::read_fst(paste0(processed_dir, "/gRNA_gene_pairs.fst")) -pairs <- pairs[1:40,] +pairs <- pairs[1:100,] # set formula reduced_formula <- "~ log_n_umis + batch + log_n_gRNA_umis" -cds <- cds[as.character(pairs$gene_id),] # set up parallel -future::plan(future::multisession()) +# future::plan(future::multisession()) # Loop over all gRNAs and genes; subset by gene, and regress on the corresponding gRNA using Molly's function -res <- future.apply::future_lapply(X = seq(1, nrow(pairs)), FUN = function(i) { - print(i) +# res <- future.apply::future_lapply(X = seq(1, nrow(pairs)), FUN = function(i) { +res <- purrr::map_dfr(.x = seq(1, nrow(pairs)), .f = function(i) { + if (i %% 50 == 0) print (i) gRNA <- as.character(pairs$gRNA_id[i]) gene <- as.character(pairs$gene_id[i]) # subset cds