-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutils.R
78 lines (69 loc) · 1.83 KB
/
utils.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# setwd("/home/[USER]/scMultiSim")
# devtools::load_all(".")
library("scMultiSim")
# Dataset M helpers
configs1 <- expand.grid(
tree = c(1),
ngenes = c(110, 200, 500),
ncells = c(500, 800),
sigma = c(0.1, 0.5),
seed = 1:4
) %>% split(., seq(nrow(.)))
configs3 <- expand.grid(
tree = c(3),
ngenes = c(110, 200, 500),
ncells = c(500, 800),
sigma = c(0.1, 0.5),
seed = 1:4
) %>% split(., seq(nrow(.)))
configs5 <- expand.grid(
tree = c(5),
ngenes = c(110, 200, 500),
ncells = c(500, 800),
sigma = c(0.1, 0.5),
seed = 1:4
) %>% split(., seq(nrow(.)))
configs_all <- c(configs1, configs3, configs5)
.conf_path <- function(conf, fn = NULL, grn = F) {
ROOT_DIR <- "/home/[USER]/scMultiSim/bench/unif/0"
GRN_DIR <- "/home/[USER]/scMultiSim/bench/unif"
fd <- sprintf("tree%g_%g_cells%g_genes_sigma%g_%g",
conf$tree, conf$ncells, conf$ngenes, conf$sigma, conf$seed)
fd <- if (grn) {
file.path(GRN_DIR, "grn_all", fd)
} else {
file.path(ROOT_DIR, fd)
}
if (is.null(fn)) {
return(fd)
} else {
return(file.path(fd, fn))
}
}
read_res <- function(conf) {
readRDS(.conf_path(conf, "res.rds"))
}
# Dataset A helpers
af_list <- c(0.2, 0.5, 0.9)
configs_a <- expand.grid(
velo = F,
tree = 5,
af = af_list,
intr = c(0.3, 1),
diff = c(0.8, 0.2),
dis = c(T, F),
sigma = c(0.1, 0.5, 1),
seed = 1:2
) %>% split(., seq(nrow(.)))
.ds_A_name <- function(conf, fn = NULL) {
dis_str <- if (conf$dis) "dis_" else "cnt_"
out_dir <- sprintf("%stree_%d_velo_%g_af_%g_diff_%g_intr_%g_sig_%g_seed_%d",
dis_str, conf$tree, conf$velo, conf$af, conf$diff, conf$intr, conf$sigma, conf$seed)
path <- file.path("/home/[USER]/scMultiSim/bench/a", out_dir)
dir.create(path, showWarnings = F, recursive = T)
if (is.null(fn)) {
path
} else {
file.path(path, fn)
}
}