Skip to content

Commit

Permalink
run monocle nb in serial
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim committed Jul 20, 2021
1 parent 1fc80b5 commit bc95424
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit bc95424

Please sign in to comment.