-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.R
executable file
·51 lines (40 loc) · 1.26 KB
/
run.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
#!/usr/local/bin/Rscript
task <- dyncli::main()
library(dyncli, warn.conflicts = FALSE)
library(dplyr, warn.conflicts = FALSE)
library(purrr, warn.conflicts = FALSE)
library(dyndimred, warn.conflicts = FALSE)
library(dynwrap, warn.conflicts = FALSE)
#####################################
### LOAD DATA ###
#####################################
parameters <- task$parameters
expression <- task$expression
# TIMING: done with preproc
timings <- list(method_afterpreproc = Sys.time())
#####################################
### INFER TRAJECTORY ###
#####################################
# perform PCA dimred
dimred <- dyndimred::dimred(expression, method = parameters$dimred, ndim = parameters$ndim)
# transform to pseudotime using atan2
pseudotime <- dimred[,parameters$component] %>% set_names(rownames(expression))
# TIMING: done with method
timings$method_aftermethod <- Sys.time()
#####################################
### SAVE OUTPUT TRAJECTORY ###
#####################################
output <-
wrap_data(
cell_ids = rownames(expression)
) %>%
add_linear_trajectory(
pseudotime = pseudotime
) %>%
add_dimred(
dimred = dimred
) %>%
add_timings(
timings = timings
)
dyncli::write_output(output, task$output)