This repository has been archived by the owner on Feb 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.R
175 lines (145 loc) · 6.23 KB
/
app.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#ui.r
library(shinydashboard)
library(shiny)
library(tidyverse)
library(plotly)
library(ggplot2)
source("working_loadat.R")
source("variant_time.R")
source("seqs_metrics.R")
#source("region_data.R")
ui <- dashboardPage(
dashboardHeader(title = "SARS-CoV-2 Dashboard"),
dashboardSidebar(
sidebarMenu(
menuItem("Home", tabName = "home", icon = icon("home")),
menuItem("Variant Metrics", tabName = "variants", icon = icon("wave-square")),
menuItem("Sequencing Metrics", tabName = "seq", icon = icon("dna")),
menuItem("Region Metrics", tabName = "region", icon = icon("compass"))
)
),
dashboardBody(
tabItems(
tabItem(tabName = "home",
h2("SARS-CoV-2 Dashboard for DCLS use"),
p("This dashboard was developed to aid in the visualization of SARS-CoV-2 data produced both by DCLS,
and other state agencies. All of the data used to produce the visulizations within this dashboard were pulled from
GISAID. This data may be different than other state and federal agencies due to the frequency of updates
and the source in which the data has been pulled from.")
),
tabItem(tabName = "variants",
tabsetPanel(
tabPanel("All Virginia Data",
fluidRow(
column(width = 12, plotlyOutput("allvtimeplot"))),
column(width = 3,selectInput("time", label = h5("Select Time Period"),
choices = c("Weekly", "Monthly", "Quarterly"))),
column(width = 3,selectInput("vars", label = h5("Select Data Type"),
choices = c("WHO Variant", "Pango Lineage")))),
tabPanel("DCLS Data",
fluidRow(
column(width = 12, plotlyOutput("dclstimeplot"))),
column(width = 3, selectInput("time2", label = h5("Select Time Period"),
choices = c("Weekly", "Monthly", "Quarterly"))),
column(width = 3, selectInput("vars2", label = h5("Select Data Type"),
choices = c("WHO Variant", "Pango Lineage"))))
)),
tabItem(tabName = "seq",
tabsetPanel(
tabPanel(
"Cumulative Sequences",
fluidRow(
column(width = 12, plotlyOutput("seqs")),
selectInput("type", label = h5("Select Data Source"),
choices = c("All Data", "DCLS")))
),
tabPanel(
"Variants of Concern",
fluidRow(
column(width = 12, plotlyOutput("vocs")),
selectInput("type2", label = h5("Select Data Source"),
choices = c("All Data", "DCLS")))
),
tabPanel(
"Variants of Interest",
fluidRow(
column(width = 12, plotlyOutput("vois")),
selectInput("type3", label = h5("Select Data Source"),
choices = c("All Data", "DCLS"))))
)
),
tabItem(tabName = "region",
tabsetPanel(
tabPanel(
"Variants per region",
fluidRow(
column(width = 12, plotlyOutput("regs")),
selectInput("region", label = h5("Select Data Source"),
choices = c("Health District", "Health Region"))))
))
)
)
)
#server.r#
server <- function(input,output){
##Variants Panel##
alltimeplot = reactive({
if ("Weekly" %in% input$time && "Pango Lineage" %in% input$vars) return(g_weekfig_lin)
if ("Monthly" %in% input$time && "Pango Lineage" %in% input$vars) return(g_monthfig_lin)
if ("Quarterly" %in% input$time && "Pango Lineage" %in% input$vars) return(g_quartfig_lin)
if ("Weekly" %in% input$time && "WHO Variant" %in% input$vars) return(g_weekfig_var)
if ("Monthly" %in% input$time && "WHO Variant" %in% input$vars) return(g_monthfig_var)
if ("Quarterly" %in% input$time && "WHO Variant" %in% input$vars) return(g_quartfig_var)
})
output$allvtimeplot <- renderPlotly({
dataplots = alltimeplot()
print(dataplots)
})
dclstimeplot = reactive({
if ("Weekly" %in% input$time2 && "Pango Lineage" %in% input$vars2) return(d_weekfig_lin)
if ("Monthly" %in% input$time2 && "Pango Lineage" %in% input$vars2) return (d_monthfig_lin)
if ("Quarterly" %in% input$time2 && "Pango Lineage" %in% input$vars2) return (d_quartfig_lin)
if ("Weekly" %in% input$time2 && "WHO Variant" %in% input$vars2) return(d_weekfig_var)
if ("Monthly" %in% input$time2 && "WHO Variant" %in% input$vars2) return(d_monthfig_var)
if ("Quarterly" %in% input$time2 && "WHO Variant" %in% input$vars2) return(d_quartfig_var)
})
output$dclstimeplot = renderPlotly({
dataplots2 = dclstimeplot()
print(dataplots2)
})
##Sequences Panel##
cseqs = reactive({
if("All Data" %in% input$type) return(g_seqs)
if("DCLS" %in% input$type) return(d_seqs)
})
output$seqs = renderPlotly({
seqplot1 = cseqs()
print(seqplot1)
})
vocseqs = reactive({
if("All Data" %in% input$type2) return(allvoc)
if("DCLS" %in% input$type2) return(dvoc)
})
output$vocs = renderPlotly({
seqplot2 = vocseqs()
print(seqplot2)
})
voiseqs = reactive({
if("All Data" %in% input$type3) return(allvoi)
if("DCLS" %in% input$type3) return(dvoi)
})
output$vois = renderPlotly({
seqplot3 = voiseqs()
print(seqplot3)
})
##### Region graphs
# region = reactive({
# if("Health District" %in% input$region) return (dis_fig)
# if("Health Region" %in% input$region) return(reg_fig)
# })
# output$regs = renderPlotly({
# regplot1 = region()
# print(regplot1)
# })
}
shinyApp(ui,server)