-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshiny.R
124 lines (105 loc) · 3.32 KB
/
shiny.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
## if you have some packages missing, use the following command
# setRepositories(ind = 1:4)
# install.packages(c("MultiAssayExperiment", "RaggedExperiment", "org.Hs.eg.db", "shiny", "shinydashboard",
# "GetoptLong", "DT", "devtools" "igvShiny", "gtrellis", "ComplexHeatmap", "InteractiveComplexHeatmap", "circlize"))
# devtools::install_github("paul-shannon/igvShiny")
#
setRepositories(ind = 1:4)
for(pkg in c("MultiAssayExperiment", "RaggedExperiment", "org.Hs.eg.db", "shiny", "shinydashboard",
"GetoptLong", "DT", "devtools", "gtrellis", "ComplexHeatmap", "InteractiveComplexHeatmap",
"circlize", "latex2exp")) {
if(!require(pkg, character.only = TRUE)) {
install.packages(pkg)
library(pkg)
}
}
if(!require(igvShiny)) {
devtools::install_github("paul-shannon/igvShiny")
}
library(igvShiny)
library(MultiAssayExperiment)
library(RaggedExperiment)
library(org.Hs.eg.db)
library(GetoptLong)
library(DT)
library(igvShiny)
library(gtrellis)
library(ComplexHeatmap)
library(InteractiveComplexHeatmap)
library(circlize)
library(latex2exp)
library(RColorBrewer)
library(jsonlite)
library(cola)
library(shiny)
library(shinydashboard)
library(dashboardthemes)
load("dataMASTER.RData")
load("gencode19_gns_lite.RData")
GENCODE = gencode19_gns_lite
source("src/config.R")
source("src/utils.R")
DB = dataMASTER
META = colData(DB)
EXPERIMENTS = experiments(DB)
EXPERIMENT_NAME = names(EXPERIMENTS)
EXPERIMENTS = lapply(EXPERIMENTS, function(obj) {
if(inherits(obj, c("RangedSummarizedExperiment", "RaggedExperiment"))) {
obj[as.vector(seqnames(rowRanges(obj)) %in% CHROMOSOME)]
} else {
obj
}
})
CD_LIST = lapply(EXPERIMENT_NAME, function(x) colData(DB[, , x]))
names(CD_LIST) = EXPERIMENT_NAME
CNV_NORMALIZED = readRDS("normalized_CNV.rds")
CNV_GERMLINE_NORMALIZED = readRDS("normalized_CNV_germline.rds")
COMPONENT = list()
foo = function() {
for(f in list.files(path = "src", pattern = "comp_", full.name = TRUE)) {
source(f)
}
ui = dashboardPage(
dashboardHeader(title = "dataMASTER browser"),
dashboardSidebar(
sidebarMenu(
id = "sidebar_menu",
menuItem("Overview", tabName = "overview"),
menuItem("Experiments", startExpanded = TRUE,
.list = lapply(EXPERIMENT_NAME, function(e) {
menuSubItem(e, tabName = e)
})
),
menuItem("Query regions", tabName = "region"),
menuItem("Patient", tabName = "patient"),
menuItem("Cohort", tabName = "cohort")
)
),
dashboardBody(
includeCSS("www/master.css"),
includeScript("www/master.js"),
shinyDashboardThemes(
theme = "onenote"
),
tabItems(
.list = lapply(names(COMPONENT), function(e) {
tabItem(tabName = e,
COMPONENT[[e]]$ui
)
})
),
style = "min-width:",
tags$script(HTML('
$("#sidebarItemExpanded").append("<hr><p style=\'color:black;padding:4px 15px;\'>Developed by <a style=\'color:#3c8dbc;\' href=\'https://github.com/jokergoo/\' target=\'_blank\'>Zuguang Gu</a>. Source code is available at <a style=\'color:#3c8dbc;\' href=\'https://github.com/CO-DKFZ/dataMASTER_browser\' target=\'_blank\'>GitHub</a>.</p>");
'))
),
tags$head(tags$script(src = "https://cdnjs.cloudflare.com/ajax/libs/bootstrap-3-typeahead/4.0.2/bootstrap3-typeahead.min.js"))
)
server = function(input, output, session) {
lapply(names(COMPONENT), function(e) {
COMPONENT[[e]]$server(input, output, session)
})
}
print(shinyApp(ui, server))
}
foo()