-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathhotfix_datasets.R
More file actions
58 lines (49 loc) · 2.01 KB
/
hotfix_datasets.R
File metadata and controls
58 lines (49 loc) · 2.01 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
51
52
53
54
55
56
57
58
library(dynbenchmark)
library(tidyverse)
library(dynplot)
dataset_ids <- list_datasets() %>% pull(id)
for (i in seq_along(dataset_ids)) {
id <- dataset_ids[[i]]
cat(i, "/", length(dataset_ids), ": ", id, "\n", sep = "")
dataset <- load_dataset(id)
# dataset <- dataset %>% add_cell_waypoints()
# dataset$dataset_source <- NULL
# dataset$source <- gsub("/[^/]*$", "", dataset$id)
# # fix count and expression functions
for (col in c("expression", "counts")) {
env <- new.env(baseenv())
assign("id", id, env)
assign("col", col, env)
dataset[[col]] <- function() {
readr::read_rds(dynbenchmark::dataset_file(paste0(col, ".rds"), id = id))
}
environment(dataset[[col]]) <- env
}
# dataset <- dataset %>% dynwrap::add_prior_information()
# # rewrap dataset
# dataset <- with(
# dataset,
# wrap_data(
# id = id,
# cell_ids = cell_ids,
# cell_info = cell_info,
# source = source,
# cell_grouping = cell_grouping,
# normalisation_info = normalisation_info,
# creation_date = creation_date
# ) %>% add_trajectory(
# milestone_ids = milestone_ids,
# milestone_network = milestone_network,
# divergence_regions = divergence_regions,
# progressions = progressions
# ) %>% add_expression(
# counts = counts,
# expression = expression,
# feature_info = feature_info
# ) %>% dynwrap::add_prior_information()
# )
# dataset$trajectory_type <- dynwrap::classify_milestone_network(dataset$milestone_network)$network_type
# dataset$prior_information <- dynwrap::generate_prior_information(dataset$milestone_ids, dataset$milestone_network, dataset$progressions, dataset$milestone_percentages, dataset$counts, dataset$feature_info, dataset$cell_info)
# dataset$progressions <- with(dataset, dynutils::convert_milestone_percentages_to_progressions(cell_ids, milestone_ids, milestone_network, milestone_percentages))
write_rds(dataset, dataset_file(id = id, filename = "dataset.rds"), compress = "xz")
}