-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathserver.R
65 lines (54 loc) · 2.3 KB
/
server.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
server <- function(input, output, session) {
library(data.table)
# make reactiveValues and server-wide variables
reactiveVals <- reactiveValues()
reactiveVals$preprocessingShowed <- FALSE
spinner <- list(logo = list(a(icon('envelope'), " Contact", href = "https://github.com/biomedbigdata/cyanus/issues", target = "_blank", style='color: black'),
tags$br(), tags$br(),
spin_loaders(id = 5, color = "black")), color="rgb(146, 180, 242, .5)")
# read all server files
sapply(list.files("server", full.names = TRUE), source, environment())
sapply(list.files("functions", full.names = TRUE), source, environment())
# additional functions
#downloadPlotFunction <- function(name, ggplotObject, width = 7, height = 7){
# return(
# downloadHandler(
# filename = function(){
# paste0(name, ".pdf")
# },
# content = function(file){
# ggsave(file, plot = ggplotObject, width=width, height=height)
# }
# )
# )
#}
sortMarkerNames <- function(choices, classes, first = "type"){
classes[classes == first] <- paste0("a", first)
ret <- choices[order(factor(sprintf("%s %s", classes, choices)))]
return(ret)
}
output$dashboard <- renderUI({
req(reactiveVals$sce)
div(downloadButton("dashboardButton", "Download current SCE object"), style="height: 50px; display: flex; align-items: center;")
})
output$dashboardButton <- downloadHandler(
filename = function(){
paste("sce.rds")
},
content = function(file){
waiter_show(id = "app", html = tagList(spinner$logo,
HTML("<br>Downloading...")),
color=spinner$color)
saveRDS(object = reactiveVals$sce, file = file)
waiter_hide(id="app")
}
)
output$licenseTable <- renderTable({
deps_table <- sapply(unique(renv::dependencies()$Package), packageDescription, fields="License")
data.frame(Package = names(deps_table), License = deps_table)
})
shinyBS::updateButton(session, inputId = "previousTab", icon = icon("arrow-left"), style = "success")
shinyBS::updateButton(session, inputId = "nextTab", icon = icon("arrow-right"), style = "success", disabled = FALSE)
shinyjs::hide("loading")
waiter_hide()
}