Repository navigation
Expand file tree
/
Copy pathgenerate_displays.R
More file actions
50 lines (41 loc) · 1.6 KB
/
Copy pathgenerate_displays.R
File metadata and controls
50 lines (41 loc) · 1.6 KB
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
library(parallel)
library(magrittr)
args = commandArgs(trailingOnly = TRUE)
if(length(args) != 1) {
stop("the generate_displays.R script requires exactly one argument: run_name ... thank you. goodbye.")
}
source(args[1])
run_name = gsub(".R", "", args[1])
files = list.files(file.path(data_base_dir,
"cleaned_for_display")) %>%
gsub(".csv","", .)
template = readLines("include/display_template.py")
source("utilities/helpers.R")
dir.create(file.path(results_base_dir,
run_name,
"dashboard",
"displays"),
recursive = TRUE)
mclapply(files,
function(f) {
#print(get_pretty_name_simple(f, fetch_col = "color") %>% hex_to_rgba(1))
#stop()
print("f is........")
print(f)
gsub('TRACK_LABEL', f, template) %>%
gsub('TITLE', get_pretty_name_simple(f), .) %>%
gsub('TRACK_COLOR', get_pretty_name_simple(f, fetch_col = "color") %>% hex_to_rgba(1), .) %>%
gsub('DATA_BASE_DIR',
file.path(data_base_dir,
"cleaned_for_display"), .) %>%
cat(file = paste0(f, ".py"),
fill = 2)
system(paste0("python3 mk_display.py ",
f,
".py ",
file.path(results_base_dir,
run_name,
"dashboard",
"displays")))
#file.remove(paste0(f, ".py"))
}, mc.cores = mc.cores_parent)