-
Notifications
You must be signed in to change notification settings - Fork 2
/
ui.R
201 lines (195 loc) · 8.44 KB
/
ui.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
library(shinythemes)
library(shinydashboard)
# This tag is a button disabler (triggered by some event)
tagfordisable <- singleton(tags$head(HTML(
'
<script type="text/javascript">
$(document).ready(function() {
// disable download at startup. downloadFinalProtocol is the id of the downloadButton
$("#downloadFinalProtocol").attr("disabled", "true").attr("onclick", "return false;");
Shiny.addCustomMessageHandler("download_ready", function(message) {
$("#downloadFinalProtocol").removeAttr("disabled").removeAttr("onclick").html(
"<i class=\\"fa fa-download\\"></i> Download of final protocol file is ready" + message.mex);
});
})
</script>
'
)))
shinyUI(
dashboardPage(skin="purple"
,header=dashboardHeader(title = "Transform Phenotype App" , titleWidth=350)
,sidebar=dashboardSidebar(width=200
#Logo
,imageOutput("myImage")
,sidebarMenu(
menuItem("Analysis" , tabName="analysispan" , icon=icon("area-chart"))
,menuItem("Help" , tabName="help" , icon=icon("info-sign" , lib="glyphicon"))
,menuItem("Contacts" , tabName="contact" , icon=icon("list"))
)
,disable=FALSE
)
,body=dashboardBody(
tags$head(tags$style(HTML("
@import url('//fonts.googleapis.com/css?family=Lobster|Cabin:400,700');
")))
,tags$head(tags$style(HTML('
.main-header .logo {
font-family: "Lobster", cursive;
font-weight: bold;
}
')))
,tabItems(
tabItem("analysispan" ,
fluidPage(
tagfordisable
,sidebarLayout(
sidebarPanel(id="sideID"
,style = "overflow-y:scroll; max-height: 1000px; position:relative;"
,fileInput('myfile'
,'Choose a tab delimited file'
# , accept=c('text/comma-separated-values' , 'text/plain')
, multiple=TRUE)
,actionButton("example" , "Load Example Dataset")
,helpText("Transform Phenotype accepts a tab-delimited file with header")
,tags$hr()
,actionButton("storeattempt", "Store this transformation")
,actionButton("deleteattempt", "Delete this transformation")
,selectInput("trait" , "Choose A Trait to analyze:"
,choices=c("")
,multiple=FALSE
,selected=""
)
,textInput("units", label = "Input Unit of measurement", value = "nmol/l")
,selectInput("transformation_method",
"Choose a function for the transformation:",
,choices=names(normalizationFunctionsList)
,multiple=FALSE
,selected="untransformed")
,selectInput("sd_num"
,"Filter Outliers based on SD value:"
,choices=c( 1 , 2 , 3 , 4 , 5 , 6 , NA )
,multiple=FALSE
,selected=NA)
,selectInput("sd_num_sex"
,"Filter Outliers based on SD value (Sex stratified):"
,choices=c( 1 , 2 , 3 , 4 , 5 , 6 , NA )
,multiple=FALSE
,selected=NA)
,radioButtons('sd_dir', 'Set Direction of the SD filter'
,c("Greater than"='gt'
,"Less than"='lt'
,"Both"='both')
,'both')
,sliderInput("filters", "Additional filter on raw values:"
,min = 0
,max = 1
,value = c(0,1))
,selectInput("covariates_tested",
"Choose one or more covariate:",
,choices=NULL
,multiple=TRUE
# ,selected=NA
)
# ,helpText("If you select NA among covariates, it will overwrite any other choice")
,tags$hr()
,radioButtons('sexStratFlag', 'Stratify by sex?'
,c("Yes"="Yes"
,"No"="No"
)
,"No")
,selectInput("stratifier"
,"Choose one stratification column:"
,choices=NULL
,multiple=TRUE
# ,selected=NA
)
,width=3)
,mainPanel(
tabsetPanel(
type = "tabs"
,tabPanel("Uploaded Data" , fluidPage(DT::dataTableOutput("contents")
, verbatimTextOutput("dferror")
))
, tabPanel("Gender Difference" , fluidPage(
uiOutput("sexplot")
)
)
, tabPanel("Transform Plot"
,uiOutput("transformer")
)
, tabPanel("Normality Summary" , fluidPage(
uiOutput("normalTable")
)
)
, tabPanel("Covariate Analysis" , uiOutput("covariateAnalysis")
)
, tabPanel("Protocol" , fluidPage(
p(h3(span("Current Trait" , style = "color:blue")))
,tableOutput("protocolFile")
,tagfordisable
,p(h3(span("Cumulative Protocol File" , style = "color:blue")))
,downloadButton("downloadFinalProtocol" , label="Download Protocol File")
,helpText("Download will be available after first click to Store this transformation.")
,DT::dataTableOutput("cumulativeProtocolFile")
))
)
,width=9)
))
)
#### HELP SECTION IN DEVELOPMENT ####
# ,tabItem("help"
# , fluidRow(
# column(4,
# # h3("What's this app?"),
# imageOutput("cheatsheet")
# ),
# column(8,
# htmlOutput("myVideo")
# )
# )
# )
,tabItem("contact"
,fluidPage(sidebarLayout(
sidebarPanel(h2("TransformPhenotype Contacts"))
,mainPanel(
p(h4("The TransformPhenotype App was created by Giorgio Melloni at the Wellcome Trust Sange Institute")),
p(h4("The original code was written by Angela Matchan and improved by Arthur Gilly, Rachel Moore, Loz Southam and Vincent Appel")),
p(h4("For any question or suggestion regarding the app, write to"
, span("melloni.giorgio [a] gmail.com" , style = "color:blue"))),
br(),
p(h3(strong("Thank you for using our app :)")))
))))
)
)
)
)
#-----------------------------#
# CODE CEMETERY #
#-----------------------------#
# FAILED AESTHESTICS IMPROVEMENTS
# tags$head(HTML('<style>.span2 {min-width: 265px; max-width: 265px; }</style>'))
# ,tags$head(
# tags$style(type="text/css", "label.radio { display: inline-block; }", ".radio input[type=\"radio\"] { float: none; }"),
# tags$style(type="text/css", "select { max-width: 200px; }"),
# tags$style(type="text/css", "textarea { max-width: 4000px; }"),
# tags$style(type="text/css", ".jslider { max-width: 200px; }"),
# tags$style(type='text/css', ".well { padding: 12px; margin-bottom: 5px; max-width: 280px; }"),
# tags$style(type='text/css', ".span4 { max-width: 10px; }"),
# tags$style(type='text/css', ".span8 { max-width: 4000px; min-width: 4000px;}")
# )
# , conditionalDisabledPanel(element="goDDButton" , tagmessage="go_with_the_analysis")
# UNUSED DISABLING TAG
# tagfordisable2 <- singleton(tags$head(HTML(
# '
# <script type="text/javascript">
# $(document).ready(function() {
# // disable download at startup. downloadResidual is the id of the downloadButton
# $("#downloadResidual").attr("disabled", "true").attr("onclick", "return false;");
# Shiny.addCustomMessageHandler("download_ready_res", function(message) {
# $("#downloadResidual").removeAttr("disabled").removeAttr("onclick").html(
# "<i class=\\"fa fa-download\\"></i> Download of residual table file is ready" + message.mex);
# });
# })
# </script>
# '
# )))