forked from ajxa/GBMDeconvoluteR
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathglobal.R
executable file
·151 lines (120 loc) · 4.25 KB
/
global.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#' global.R for GBMDeconvoluteR
#
# GBMDeconvoluteR is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published by
# the Free SoftwareFoundation; either version 3 of the License, or (at your option) any later
# version.
#
# GBMDeconvoluteR is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses/>.
# PACKAGES ----
library(shiny)
library(shinyBS)
library(shinyjs)
library(shinyWidgets)
library(shinycssloaders)
library(tidyverse)
library(markdown)
library(DT)
library(MCPcounter)
library(tinyscalop)
library(openxlsx)
# GLOABAL OPTIONS ----
# Disable graphical rendering by the Cairo package, if it is installed
options(shiny.usecairo = TRUE)
# Sets the maximum file upload size to 200Mb
options(shiny.maxRequestSize= 50*1024^2)
# DT options
options(
DT.options = list(lengthMenu = list(c(50, 100, -1),
c('50','100','All')
),
buttons = list('copy',
list(extend = 'collection',
buttons = c('csv', 'excel', 'pdf'),
text = 'Download')
),
serverSide = FALSE,
pagingType = "full",
dom = 'lfBrtip',
width = "100%",
height = "100%",
scrollX = TRUE,
scrollY = "475px",
scrollCollapse = TRUE,
orderClasses = TRUE,
autoWidth = FALSE,
search = list(regex = TRUE)
)
)
# LOAD MULTIPLE DATASETS FUNCTION ----
# Function which reads in multiple datasets at once
# load_datasets <- function(x){
#
# tryCatch( # Applying tryCatch
#
# expr = { # Specifying expression
#
# assign(x = tools::file_path_sans_ext(basename(x)),
# value = readRDS(x),
# envir = .GlobalEnv)
#
#
# message(
#
# crayon::green("Loaded", tools::file_path_sans_ext(basename(x))),
#
# appendLF = TRUE
#
# )
#
# },
#
# error = function(e){ # Specifying error message
#
# message(
#
# crayon::red(tools::file_path_sans_ext(basename(x)),
# "Could Not Be Loaded!"),
#
# appendLF = TRUE
#
# )
# },
#
# warning = function(w){ # Specifying warning message
# message("There was a warning message.")
# }
# )
#
# }
# load_datasets usage
# plyr::l_ply(indata, load_datasets)
# LOAD DATASETS ----
gene_markers <- list()
# Neoplastic cell-state markers
gene_markers$neftel2019_neoplastic <- readRDS("data/Neftel_et_al_2019_four_state_neoplastic_markers.rds")
gene_markers$moreno2022_neoplastic <- readRDS("data/Moreno_et_al_2022_lvl3_neoplastic_markers.rds")
# Immune cell markers
gene_markers$ajaib2022_immune <- readRDS("data/Ajaib_et_al_2022_GBM_Immune_markers.rds")
gene_markers$moreno2022_immune <- readRDS("data/Moreno_et_al_2022_lvl3_immune_markers.rds")
# Tumour intrinsic markers
gene_markers$wang2017_tumor_intrinsic <- readRDS("data/Wang_et_al_2017_GBM_TI_markers.rds")
# example data
example_data <- readRDS("data/TGCA_GBM_example.rds")
# Plot colors
plot_cols <- readRDS("data/plot_colors.rds")
# Plot order
plot_order <- readRDS("data/plot_order.rds")
# PANEL DIVS ----
# Generates the panels found on the home and about tabs
panel_div <-function(class_type, panel_title, content) {
HTML(paste0("<div class='panel panel-", class_type,
"'> <div class='panel-heading'><h3 class='panel-title'>", panel_title,
"</h3></div><div class='panel-body'>", content, "</div></div>", sep=""))
}
# END ----