ui.R 36.1 KB
Newer Older
Stevenn Volant's avatar
Stevenn Volant committed
1
2
3
4
if(!require(shinydashboard)){
  install.packages('shinydashboard')
  library(shinydashboard)
}
svolant's avatar
svolant committed
5
library(shinyjs)
stevenn's avatar
stevenn committed
6
7
8
9
if (!require(psych)) {
  install.packages('psych')
  library(psych)
}
Stevenn Volant's avatar
Stevenn Volant committed
10

stevenn's avatar
stevenn committed
11
12
13
14
if (!require(ggplot2)) {
  install.packages('ggplot2')
  library(ggplot2)
}
Stevenn Volant's avatar
Stevenn Volant committed
15

stevenn's avatar
stevenn committed
16
17
18
19
if (!require(vegan)) {
  install.packages('vegan')
  library(vegan)
}
Stevenn Volant's avatar
Stevenn Volant committed
20

stevenn's avatar
stevenn committed
21
22
23
24
if (!require(dendextend)) {
  install.packages('dendextend')
  library(dendextend)
}
Stevenn Volant's avatar
Stevenn Volant committed
25

stevenn's avatar
stevenn committed
26
27
28
29
if (!require(circlize)) {
  install.packages('circlize')
  library(circlize)
}
Stevenn Volant's avatar
Stevenn Volant committed
30

stevenn's avatar
stevenn committed
31
32
33
34
if (!require(biom)) {
  install.packages('biom')
  library(biom)
}
Stevenn Volant's avatar
Stevenn Volant committed
35

stevenn's avatar
stevenn committed
36
37
38
39
if (!require(DT)) {
  install.packages('DT')
  library(DT)
}
Stevenn Volant's avatar
Stevenn Volant committed
40

stevenn's avatar
stevenn committed
41
42
43
44
if (!require(RColorBrewer)) {
  install.packages('RColorBrewer')
  library(RColorBrewer)
}
Stevenn Volant's avatar
Stevenn Volant committed
45

svolant's avatar
svolant committed
46
47
48
49
50
if (!require(scatterD3)) {
  install.packages('scatterD3')
  library(scatterD3)
}

stevenn's avatar
stevenn committed
51
52
53
54
if (!require(gplots)) {
  install.packages('gplots')
  library(gplots)
}
Stevenn Volant's avatar
Stevenn Volant committed
55

stevenn's avatar
stevenn committed
56
57
58
59
60
if (!require(DESeq2)) {
  source("https://bioconductor.org/biocLite.R")
  biocLite("DESeq2")
  library(DESeq2)
}
Stevenn Volant's avatar
Stevenn Volant committed
61

stevenn's avatar
stevenn committed
62
63
64
if (!require(ade4)) {
  install.packages('ade4')
  library(ade4)
Stevenn Volant's avatar
Stevenn Volant committed
65
}
stevenn's avatar
stevenn committed
66

Stevenn Volant's avatar
Stevenn Volant committed
67
if (!require(genefilter)) {
68
69
  source("https://bioconductor.org/biocLite.R")
  biocLite("genefilter")
Stevenn Volant's avatar
Stevenn Volant committed
70
71
72
  library(genefilter)
}

svolant's avatar
svolant committed
73
74
75
76
77
78

if (!require(googleVis)) {
  install.packages('googleVis')
  library(googleVis)
}

stevenn's avatar
stevenn committed
79
80
81
sidebar <- dashboardSidebar(
  sidebarMenu(
    menuItem("Home", tabName = "Home", icon = icon("home")),
82
    menuItem("Tutorial", tabName = "Tutorial", icon = icon("book")),
stevenn's avatar
stevenn committed
83
    menuItem("Upload your data", tabName = "Upload", icon = icon("upload")),
Stevenn Volant's avatar
logo    
Stevenn Volant committed
84
    menuItemOutput("dymMenu"),
Stevenn Volant's avatar
Stevenn Volant committed
85
    img(src = "logo.jpg", height = 49, width = 220,style="position:absolute;bottom:0;margin:0 0 15px 10px;")
stevenn's avatar
stevenn committed
86
87
88
89
90
91
  )
)

body <- dashboardBody(
  tabItems(
    tabItem(tabName = "Home",
92
93
            div(style="width:100% ; max-width: 1200px",
              tabBox(title="Welcome to SHAMAN", id="tabset1", width=NULL,
94
95
                   tabPanel("About", tags$script(type="text/javascript", language="javascript", src="google-analytics.js"),
                            p("SHAMAN is a SHiny application for Metagenomic ANalysis including the normalization,
Stevenn Volant's avatar
Stevenn Volant committed
96
                                       the differential analysis and mutiple visualization.",style = "font-family: 'times'; font-si16pt"),
Stevenn Volant's avatar
Stevenn Volant committed
97
98
                            p("SHAMAN is based on DESeq2 R package", a("[Anders and Huber 2010]", href="http://www.ncbi.nlm.nih.gov/pubmed/20979621"), "for the analysis of metagenomic data, as suggested in", a("[McMurdie and Holmes 2014]",href="http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3974642/"),
                              ". SHAMAN robustly identifies the differential abundant genera with the Generalized Linear Model implemented in DESeq2", a("[Love 2014]", href="http://www.ncbi.nlm.nih.gov/pubmed/25516281"),".
Stevenn Volant's avatar
Stevenn Volant committed
99
                              Resulting p-values are adjusted according to the Benjamini and Hochberg procedure [Benjamini and Hochberg 1995].
100
101
                              The PCOA is performed with the", a("ade4 R package",href="http://pbil.univ-lyon1.fr/ade4/"), "and plots are generated with", a("ggplot2",href="http://ggplot2.org/"), "or", a("D3.js packages",href="http://d3js.org/"), ".
                              A presentation about SHAMAN is available", a("here",target="_blank",href="shaman_presentation.pdf"),style = "font-family: 'times'; font-si16pt"),
Stevenn Volant's avatar
Stevenn Volant committed
102
                            p("Hereafter is the global workflow of the SHAMAN application:"),
Stevenn Volant's avatar
Stevenn Volant committed
103
                            div(img(src = "Workflow.png",width = "100%",style="max-width: 600px"),Align="center")
Stevenn Volant's avatar
Stevenn Volant committed
104
                            ),
Stevenn Volant's avatar
Stevenn Volant committed
105
                   tabPanel("Authors", h3("The main contributors to SHAMAN:"),
Stevenn Volant's avatar
Stevenn Volant committed
106
107
108
109
110
111
112
113
                            p(a("Stevenn Volant", href="mailto:stevenn.volant@pasteur.fr"), "(Initiator, coding, testing, documentation, evaluation)"),
                            p(a("Amine Ghozlane",href="mailto:amine.ghozlane@pasteur.fr"), "(Coding, testing, documentation, evaluation)"),
                            p(a("Hugo Varet",href="mailto:hugo.varet@pasteur.fr"), "(Coding, testing, feature suggestions)"),
                            p(a("Pierre Lechat",href="mailto:pierre.lechat@pasteur.fr"), "(Coding, testing, feature suggestions)"),
                            p(a("Marie-Agnès Dillies",href="mailto:marie-agnes.dillies@pasteur.fr"), "(Evaluation)"),
                            p(a("Sean Kennedy",href="mailto:sean.kennedy@pasteur.fr"), "(Evaluation)"),
                            h3("Acknowledgements"),
                            p("Thanks to the following people for patches and other suggestions for improvements:"),
Stevenn Volant's avatar
Stevenn Volant committed
114
                            p(a("Christophe Malabat",href="mailto:christophe.malabat@pasteur.fr"),a(", Julien Tap",href="mailto:julien.tap@danone.com"),a(", Anna Zhukova",href="mailto:anna.zhukova@pasteur.fr"), a(", Rachel Torchet",href="mailto:rachel.torchet@pasteur.fr"))
Stevenn Volant's avatar
logo    
Stevenn Volant committed
115
                          ),
Stevenn Volant's avatar
Stevenn Volant committed
116
                   tabPanel("Citing SHAMAN",p("No papers about SHAMAN have been published yet, but a manuscript is in preparation.",style = "font-family: 'times'; font-si16pt"),
117
118
119
                            p("For now, if you have any comments, questions or suggestions, or want to use SHAMAN please contact authors", a("here", href="mailto:shaman@pasteur.fr"),".", style = "font-family: 'times'; font-si16pt; color:red")
            )))
    ),
Stevenn Volant's avatar
Stevenn Volant committed
120

121
    tabItem(tabName = "Tutorial",
122
123
            div(style="width:100% ; max-width: 1200px",
            tabBox(title="How to use SHAMAN", id="tabset1", width =NULL,
124
125
126
127
128
129
130
131
            tabPanel("Introduction",
            p(" You can test SHAMAN with the dataset from", a("[Tap et al. 2015]",href="http://www.ncbi.nlm.nih.gov/pubmed/26235304"),
              ", which is available", a("here",target="_blank",href="Alimintest.zip"),"."),
            p("The zip archive contains 4 different files :", br(),
              "- the otu count matrix : Alimintest_otu_table.csv,", br(),
              "- the otu annotation table : Alimintest_otu_table.csv,", br(),
              "- the experimental design : Alimintest_target.csv,", br(),
              "- the contrast table : Alimintest_contrasts.csv."),
132
133
            p("Two groups of person follow two  strict diet periods that involve the intake of 40g following 10g of fiber per day, or 10g of fiber after a 40g fiber intake period:"),
            img(src = "tutorial/FigS1.png",width = "100%",style="max-width: 900px"),
134
135
136
            p("The 16S rRNA (V3 - V4 regions) from fece samples was sequenced at time stamp : 2, 3, 4 and 5.", br(),
              "The analysis will consider the different impact of the different fiber intake and the comparison to patient metabolic data.")),
            tabPanel("1-Load 16S data",
137
            p("The first step consists to load the count matrix and the annotation table as follow :"),
138
            p("- Select 'Upload your data'", br(),
139
140
              "- Load the count table :",br(), img(src = "tutorial/tutorial_upload1.png",width = "100%",style="max-width: 900px"),hr(),
              "- Load the annotation table :", br(), img(src = "tutorial/tutorial_upload2.png",width = "100%",style="max-width: 900px"),hr(),
141
              "- When successfully loaded, the tables are accessible as bellow :",br(),
142
              img(src = "tutorial/tutorial_upload3.png",width = "100%",style="max-width: 600px"),img(src = "tutorial/tutorial_upload4.png",width = "100%",style="max-width: 600px"))),
143
            tabPanel("2-Differential analysis",
144
            p("The second step consists to load the experimental design and the contrast table as follow :"),
145
            p("- Select 'Run differential analysis'",br(),
146
147
148
149
150
151
152
              "- Load the target file :",br(),img(src = "tutorial/tutorial_target.png",width = "100%",style="max-width: 800px"),hr(),
              "- Identify the taxonomy level where the analysis will be performed :",br(),img(src = "tutorial/tutorial_target1.png",width = "100%",style="max-width: 800px"),hr(),
              "- Identify the interactions :",br(),img(src = "tutorial/tutorial_target2.png",width = "100%",style="max-width: 800px"),hr(),
              "- Run the analysis :",br(),img(src = "tutorial/tutorial_target3.png",width = "100%",style="max-width: 800px"),hr(),
              "- When successfully loaded, the tables are accessible as bellow :",br(),img(src = "tutorial/tutorial_target4.png",width = "100%",style="max-width: 800px")),hr(),
            p("- Finally, load the contrast file :",br(),img(src = "tutorial/tutorial_contraste.png",width = "100%",style="max-width: 800px"),hr(),
              "- Contrasts can be visualized as follow :",br(),img(src = "tutorial/tutorial_contraste1.png",width = "100%",style="max-width: 400px"))),
153
            tabPanel("3-Diagnostic plots",
154
155
156
157
158
159
160
161
162
            p("'Diagnostic plots' section provides several visualizations to control the analysis",br(),
              "- Total mapped read count",br(),img(src="tutorial/tutorial_total_barplot.png",width = "100%",style="max-width: 900px"),hr(),
              "- Nul barplot count",br(),img(src="tutorial/tutorial_nul_barplot.png",width = "100%",style="max-width: 900px"),hr(),
              "- Maj taxonomy count",br(),img(src="tutorial/tutorial_maj_taxonomy.png",width = "100%",style="max-width: 900px"),hr(),
              "- Density of counts",br(),img(src="tutorial/tutorial_density.png",width = "100%",style="max-width: 900px"),hr(),
              "- Size factors vs total number of reads",br(),img(src="tutorial/tutorial_size_factor.png",width = "100%",style="max-width: 900px"),hr(),
              "- PCA",br(),img(src="tutorial/tutorial_pca.png",width = "100%",style="max-width: 900px"),hr(),
              "- PCOA",br(),img(src="tutorial/tutorial_pcoa.png",width = "100%",style="max-width: 900px"),hr(),
              "- Clustering",br(),img(src="tutorial/tutorial_clustering.png",width = "100%",style="max-width: 900px"))),
163
            tabPanel("4-Differential analysis results",
164
            img(src = "tutorial/tutorial_table.png",width = "100%",style="max-width: 900px")),
165
166
            tabPanel("5-Visualization",
                     p("'Diagnostic plots' section provides several visualization to control the analysis",br(),
167
168
169
170
171
                     "- Barplot",br(),img(src="tutorial/tutorial_barplot.png",width = "100%",style="max-width: 900px"),hr(),
                     "- Heatmap",br(),img(src="tutorial/tutorial_heatmap.png",width = "100%",style="max-width: 900px"),hr(),
                     "- Boxplot",br(),img(src="tutorial/tutorial_boxplot.png",width = "100%",style="max-width: 900px"),hr(),
                     "- Diversity",br(),img(src="tutorial/tutorial_diversity.png",width = "100%",style="max-width: 900px"),hr(),
                     "- Rarefaction",br(),img(src="tutorial/tutorial_rarefaction.png",width = "100%",style="max-width: 900px")))))
172
    ),
Stevenn Volant's avatar
Stevenn Volant committed
173
    
stevenn's avatar
stevenn committed
174
175
176
    tabItem(tabName = "Upload",
            tags$style(type='text/css', ".well { max-width: 20em; }"),
            fluidRow(
Stevenn Volant's avatar
Stevenn Volant committed
177
178
179
180
181
182
183
              column(width=3,valueBoxOutput("valueErrorPercent",width=NULL)),
              column(width=3,infoBoxOutput("InfoErrorCounts",width=NULL)),
              column(width=3,infoBoxOutput("InfoErrorTaxo",width=NULL))
            ),
            br(),
             fluidRow(
                box(title="Select your file format",width = 3,status = "success", solidHeader = TRUE,collapsible = FALSE,
184
                  selectInput("FileFormat","",c("Count table & taxonomy"="fileCounts","BIOM file"="fileBiom"),selected="fileCounts")
Stevenn Volant's avatar
Stevenn Volant committed
185
                ),
stevenn's avatar
stevenn committed
186
                conditionalPanel(condition="input.FileFormat=='fileCounts'",
187
                  box(title="Load the count table",width = 3,height = "250px", status = "primary", solidHeader = TRUE,collapsible = FALSE,
stevenn's avatar
stevenn committed
188
                    fileInput('fileCounts', h6(strong('Select your file')),width="100%")
stevenn's avatar
stevenn committed
189
                  ),
stevenn's avatar
stevenn committed
190
                  
Stevenn Volant's avatar
Stevenn Volant committed
191
192
193
194
195
196
197
                  box(title="Load the taxonomy file",width = 3,height = "250px", status = "primary", solidHeader = TRUE,collapsible = FALSE,
                      fluidRow(
                        column(width=6,radioButtons("TypeTaxo",h6(strong("Format:")),c("Table"="Table","RDP"="RDP"))),
                        column(width=6,
                             conditionalPanel(condition="input.TypeTaxo=='RDP'",numericInput("RDP_th",h6(strong("Threshold:")),0.5,step=0.01,min=0.01,max=1))
                        )
                      ),
stevenn's avatar
stevenn committed
198
                      fileInput('fileTaxo', h6(strong('Select your file')),width="100%")
stevenn's avatar
stevenn committed
199
200
201
202
203
                  )
                  
                ),
                
                conditionalPanel(condition="input.FileFormat=='fileBiom'",
Stevenn Volant's avatar
Stevenn Volant committed
204
                                 box(title="Load the BIOM file",width = 3,height = "250px", status = "primary", solidHeader = TRUE,collapsible = FALSE,
stevenn's avatar
stevenn committed
205
206
207
                                     fileInput('fileBiom', h5(strong('Select your file')),width="100%")
                                 )           
                )
Stevenn Volant's avatar
Stevenn Volant committed
208
             ),
stevenn's avatar
stevenn committed
209
210
211
              column(12,uiOutput("TabBoxData"))

              
Stevenn Volant's avatar
Stevenn Volant committed
212
          
stevenn's avatar
stevenn committed
213
214
    ),
    
stevenn's avatar
stevenn committed
215
216
217
  #### Statistical analysis

    tabItem(tabName = "RunDiff",
stevenn's avatar
stevenn committed
218
219
220
            fluidRow(
              column(width=3,infoBoxOutput("RowTarget",width=NULL)),
              column(width=3,infoBoxOutput("InfoTaxo",width=NULL)),
221
              column(width=3,infoBoxOutput("InfoDESeq",width=NULL)),
222
              column(width=3,infoBoxOutput("InfoContrast",width=NULL))
Stevenn Volant's avatar
Stevenn Volant committed
223
            ),            
stevenn's avatar
stevenn committed
224
            fluidRow(
stevenn's avatar
stevenn committed
225
226
227
              column(width=5,
                box(title="Experimental design",width = NULL, status = "primary", solidHeader = TRUE,collapsible = TRUE,collapsed = FALSE,
                  fluidRow(
stevenn's avatar
stevenn committed
228
229
                    column(width=6,fileInput('fileTarget', h6(strong('Select your target file')),width="100%")),
                    column(width=6,uiOutput("SelectTaxo"))
stevenn's avatar
stevenn committed
230
231
232
233
                  ),
                  fluidRow( 
                    column(width=6,uiOutput("SelectInterestVar")),
                    column(width=6,uiOutput("SelectInteraction2")),
234
                    column(width=6,uiOutput("RunButton"))
stevenn's avatar
stevenn committed
235
                  )
Amine  GHOZLANE's avatar
Amine GHOZLANE committed
236
237
238
                ),
                uiOutput("BoxTarget"),
                uiOutput("BoxCountsMerge")
stevenn's avatar
stevenn committed
239
              ),
stevenn's avatar
stevenn committed
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
       
              column(width=7,
                box(title="Options",width = NULL, status = "primary", solidHeader = TRUE,collapsible = TRUE,collapsed = TRUE,
                  fluidRow(
                    column(width=3,
                      radioButtons("TransType",h6(strong("Type of transformation")),choices = c("VST"="VST","rlog"="rlog"))
                    ), 
                    column(width=3,
                      radioButtons("IndFiltering",h6(strong("Independent filtering")),choices = c("True"=TRUE,"False"=FALSE))
                    ),
                    column(width=3,
                      radioButtons("AdjMeth",h6(strong("p-value adjustement")),choices = c("BH"="BH","BY"="BY"))
                    ),
                    column(width=3,
                      textInput("AlphaVal",h6(strong("Level of significance")),value=0.05)
                    )
                  ),
                  fluidRow(
                    column(width=3,
Amine  GHOZLANE's avatar
Amine GHOZLANE committed
259
                           radioButtons("CooksCutOff",h6(strong("Cooks cut-off")),choices = c("Auto"='Auto',"No cut-off"=Inf,"Value"="val")),
stevenn's avatar
stevenn committed
260
261
262
263
264
265
266
267
268
                           conditionalPanel(condition="input.CooksCutOff=='val'",textInput("CutOffVal",h6("Cut-off:"),value=0))
                    ),
                    
                    column(width=3,
                      radioButtons("locfunc",h6(strong("Local function")),choices = c("Median"="median","Shorth"="shorth"))
                    ),  
                    column(width=3,
                      radioButtons("fitType",h6(strong("Relationship")),choices = c("Parametric"="parametric","Local"="local"))
                    ),
269
270
                    column(width=3,checkboxInput("AccountForNA","Compute geometric mean without 0",value=TRUE))
                    # column(width=3,uiOutput("RefSelect"))
stevenn's avatar
stevenn committed
271
                  )
stevenn's avatar
stevenn committed
272
                ),
273
274
                fluidRow(
                column(width=8,
Stevenn Volant's avatar
Stevenn Volant committed
275
#                        uiOutput("contrastBox"),
276
277
278
279
                       uiOutput("contrastBoxAdvanced")
                       ),
                column(width=4,
                       uiOutput("contrastDefined")
280
281
                )
                )
Amine  GHOZLANE's avatar
Amine GHOZLANE committed
282
              )
stevenn's avatar
stevenn committed
283
            )
stevenn's avatar
stevenn committed
284
    ),
Amine  GHOZLANE's avatar
Amine GHOZLANE committed
285
    tabItem(tabName = "DiagPlotTab",
stevenn's avatar
stevenn committed
286
            fluidRow(
stevenn's avatar
stevenn committed
287
              column(width=9,
Stevenn Volant's avatar
Stevenn Volant committed
288
289
290
                     
                plotOutput("PlotDiag",height="100%"),
                br(),
291
                conditionalPanel(condition="input.DiagPlot=='SfactorsVStot'",
stevenn's avatar
stevenn committed
292
293
294
                  box(title = "Size factors",  width = NULL, status = "primary", solidHeader = TRUE,collapsible = TRUE,collapsed= TRUE,
                    dataTableOutput("SizeFactTable")
                  )
Amine  GHOZLANE's avatar
Amine GHOZLANE committed
295
296
297
298
                ),
                  
                conditionalPanel(condition="input.DiagPlot=='pcaPlot'",
                                 box(title = "Eigen values",  width = 6, status = "primary", solidHeader = TRUE,collapsible = TRUE,collapsed= FALSE,
Stevenn Volant's avatar
Stevenn Volant committed
299
                                    plotOutput("PlotEigen",height="100%")
Amine  GHOZLANE's avatar
Amine GHOZLANE committed
300
301
302
303
                                 )
                ),
                conditionalPanel(condition="input.DiagPlot=='pcoaPlot'",
                                 box(title = "Eigen values",  width = 6, status = "primary", solidHeader = TRUE,collapsible = TRUE,collapsed= FALSE,
Stevenn Volant's avatar
Stevenn Volant committed
304
                                     plotOutput("PlotpcoaEigen",height="100%")
Amine  GHOZLANE's avatar
Amine GHOZLANE committed
305
                                 )
stevenn's avatar
stevenn committed
306
                )
Amine  GHOZLANE's avatar
Amine GHOZLANE committed
307
                
stevenn's avatar
stevenn committed
308
309
              ),
              column(width=3,
310
311
                box(title = "Select your plot",  width = NULL, status = "primary", solidHeader = TRUE,collapsible = FALSE,collapsed= FALSE,
                  selectInput("DiagPlot","",c("Total barplot"="barplotTot","Nul barplot"="barplotNul",
312
                                              "Maj. taxonomy"="MajTax", "Density"="densityPlot", "Dispersion" = "DispPlot",
313
                                              "Size factors VS total"="SfactorsVStot", "PCA"="pcaPlot", "PCoA"="pcoaPlot","Clustering" = "clustPlot"))
314
                    ),
Amine  GHOZLANE's avatar
Amine GHOZLANE committed
315
                box(title = "Options",  width = NULL, status = "primary", solidHeader = TRUE,collapsible = TRUE,collapsed= FALSE,
316
317
318
                    conditionalPanel(condition="input.DiagPlot!='clustPlot' && input.DiagPlot!='pcaPlot' && input.DiagPlot!='SfactorsVStot' && input.DiagPlot!='DispPlot'",
                                     radioButtons("CountsType","Counts:",c("Normalized"="norm","Raw"="raw"),inline = TRUE)
                                     ),
Amine  GHOZLANE's avatar
Amine GHOZLANE committed
319
                    conditionalPanel(condition="input.DiagPlot!='Sfactors' && input.DiagPlot!='SfactorsVStot' ",uiOutput("VarIntDiag")),
320
                    conditionalPanel(condition="input.DiagPlot=='pcoaPlot' || input.DiagPlot=='pcaPlot'",
Amine  GHOZLANE's avatar
Amine GHOZLANE committed
321
                                     h5(strong("Select the modalities")),
Stevenn Volant's avatar
Stevenn Volant committed
322
                                     uiOutput("ModMat")
323
                                    ),
Stevenn Volant's avatar
Stevenn Volant committed
324
                    conditionalPanel(condition="input.DiagPlot=='pcoaPlot' || input.DiagPlot=='SERE' || input.DiagPlot=='clustPlot' ",
325
326
327
328
                                      selectInput("DistClust","Distance",c("euclidean", "SERE"="sere", "canberra", "bray", "kulczynski", "jaccard", 
                                                  "gower", "altGower", "morisita", "horn","mountford","raup","binomial",
                                                  "chao","cao","mahalanobis"),selected="jaccard")
                                    )
Stevenn Volant's avatar
Stevenn Volant committed
329
                    
stevenn's avatar
stevenn committed
330
331
332
333
334
335
336
#                 conditionalPanel(condition="input.RadioPlotBi=='Nuage'",selectInput("ColorBiplot", "Couleur",choices=c("Bleue" = 'blue',"Rouge"='red',"Vert"='green', "Noir"='black'),width="50%")),
#                 sliderInput("TransAlphaBi", "Transparence",min=1, max=100, value=50, step=1),
#                 conditionalPanel(condition="input.RadioPlotBi!='Nuage'", radioButtons("SensGraphBi","Sens du graph",choices=c("Vertical"="Vert","Horizontal"="Hori"))),
#                 conditionalPanel(condition="input.RadioPlotBi=='box'", checkboxInput("CheckAddPointsBoxBi","Ajouter les données",value=FALSE)) 
               ),
                box(
                  title = "Appearance",  width = NULL, status = "primary", solidHeader = TRUE,collapsible = TRUE,collapsed= TRUE,
337
338
339
340
#                     conditionalPanel(condition="input.DiagPlot=='Sfactors'",
#                                      h6(strong("Layout")),
#                                      numericInput("NbcolSfactors", h6("Columns"),min=1,value = NA)
#                     ),
Stevenn Volant's avatar
Stevenn Volant committed
341
342
                  sliderInput("heightDiag", "Height",min=100,max=1500,value = 500,step =10),

Amine  GHOZLANE's avatar
Amine GHOZLANE committed
343
344
345
346
347
348
349
350
351
352
353
354
                  conditionalPanel(condition="input.DiagPlot=='clustPlot'",
                                   h6(strong("Layout")),
                                   selectInput("typeHculst", h6("Type"),c("Horizontal"="hori","Fan"="fan")),
                                   checkboxInput("colorHC","Add color",value=TRUE)
                  ),
                  conditionalPanel(condition="input.DiagPlot=='pcoaPlot'",  selectInput("labelPCOA","Label type",c("Group", "Sample"),selected="Group"),
                                   #checkboxInput("colorgroup","Same color for the group",value=FALSE),
                                   sliderInput("cexcircle", "Circle size",min=0,max=2,value = 0.9,step =0.1),
                                   sliderInput("cexpoint", "Point size",min=0,max=3,value = 1,step =0.1),
                                   sliderInput("cexstar", "Star height",min=0,max=1,value = 0.95,step =0.1)
                                   
                  ),
Stevenn Volant's avatar
Stevenn Volant committed
355
356
357
358
359
360
361
                  conditionalPanel(condition="input.DiagPlot=='SfactorsVStot'",
                    checkboxInput("addLabelSFact","Add label",FALSE)
                  ),

                  fluidRow(
                    column(width=12, p(strong("Size"))),
                    column(width=6,sliderInput("cexTitleDiag", h6("Axis"),min=0,max=5,value = 1,step =0.1)),
362
                    conditionalPanel(condition="input.DiagPlot=='SfactorsVStot' || input.DiagPlot=='pcaPlot' || input.DiagPlot=='pcoaPlot'",column(width=6,sliderInput("cexLabelDiag", h6("Points"),min=0,max=5,value = 1,step =0.1)))
Stevenn Volant's avatar
Stevenn Volant committed
363
364
365
                    
                  )

Amine  GHOZLANE's avatar
Amine GHOZLANE committed
366
367
#                   sliderInput("widthDiag", "width",min=100,max=1500,value = 1000,step =10)
                 
stevenn's avatar
stevenn committed
368

stevenn's avatar
stevenn committed
369
370
371
372
373
374
375
376
377
378
379
380
381
382
              ),
              box(title = "Export",  width = NULL, status = "primary", solidHeader = TRUE,collapsible = TRUE,collapsed= TRUE,
                  selectInput("Exp_format",h5(strong("Export format")),c("png"="png","pdf"="pdf","eps"="eps","svg"="svg"), multiple = FALSE),
                  fluidRow(
                  column(width=6,numericInput("heightDiagExport", "Height (in px)",min=100,max=NA,value = 500,step =1)),
                  column(width=6,numericInput("widthDiagExport", "Width (in px)",min=100,max=NA,value = 500,step =1))
                  ),
                  downloadButton("exportdiag", "Export")
                  
#                   downloadButton("exportPDFdiag", "Download pdf"),
#                   downloadButton("exportPNGdiag", "Download png"),
#                   downloadButton("exportEPSdiag", "Download eps"),
#                   downloadButton("exportSVGdiag", "Download svg"),
                  
stevenn's avatar
stevenn committed
383
384
385
              )
            )
        )
stevenn's avatar
stevenn committed
386
387
388
    ),
    tabItem(tabName = "TableDiff",
            fluidRow(
Amine  GHOZLANE's avatar
Amine GHOZLANE committed
389
390
391
392
393
              column(width=9,uiOutput("TabBoxDataDiff")),
              column(width=3,
                     box(title = "Select your contrast",  width = NULL, status = "primary", solidHeader = TRUE,collapsible = TRUE,collapsed= FALSE,
                         selectInput("ContrastList_table",h6(strong("Contrast list")),"", multiple = FALSE),
                         htmlOutput("ContrastOverviewTable")
394
395
396
397
398
                     ),
                     box(title = "Export",  width = NULL, status = "primary", solidHeader = TRUE,collapsible = TRUE,collapsed= TRUE,
                         fluidRow(column(width=12,selectInput("WhichExportTable", "Select the table to export",c("Complete"="Complete","Up"="Up","Down"="Down")))),
                         uiOutput("ExportTableButton")   
                     )
Amine  GHOZLANE's avatar
Amine GHOZLANE committed
399
            )
Stevenn Volant's avatar
Stevenn Volant committed
400
            ) 
stevenn's avatar
stevenn committed
401
402
403
404
    ),
  
  #### Data Viz
  
405
  tabItem(tabName = "Visu",
stevenn's avatar
stevenn committed
406
          fluidRow(
407
            column(width=9,
svolant's avatar
svolant committed
408
409
410
411
                   uiOutput("plotVisu"),
                   conditionalPanel(condition="input.PlotVisuSelect=='Scatterplot' && !input.AddRegScatter",
                                    useShinyjs(),
                                    br(),
svolant's avatar
svolant committed
412
413
414
415
                                    p(actionButton("scatterD3-reset-zoom", HTML("<span class='glyphicon glyphicon-search' aria-hidden='true'></span> Reset Zoom")),Align="right"),
                                    box(title = "Correlation table",  width = NULL, status = "primary", solidHeader = TRUE,collapsible = TRUE,collapsed= TRUE,
                                        dataTableOutput("CorTable")
                                    )
svolant's avatar
svolant committed
416
                                    ), 
svolant's avatar
svolant committed
417
                   
svolant's avatar
svolant committed
418
                   conditionalPanel(condition="input.PlotVisuSelect=='Scatterplot' && input.AddRegScatter", 
svolant's avatar
svolant committed
419
420
421
422
423
424
                                    fluidRow(
                                      column(width=6,
                                      br(),
                                      box(title = "Regression coefficients",  width = NULL, status = "primary", solidHeader = TRUE,collapsible = TRUE,collapsed= TRUE,
                                          dataTableOutput("lmRegScatter")
                                      )
svolant's avatar
svolant committed
425
426
                                    ),
                                    column(width=6,br(),htmlOutput("lmEquation"))
svolant's avatar
svolant committed
427
                                    )
svolant's avatar
svolant committed
428
429
430
                   )
                                    
                   ),
Amine  GHOZLANE's avatar
Amine GHOZLANE committed
431
432

            column(width=3,
433
              box(title = "Select your plot",  width = NULL, status = "primary", solidHeader = TRUE,collapsible = FALSE,collapsed= FALSE,
svolant's avatar
svolant committed
434
                  selectizeInput("PlotVisuSelect","",c("Barplot"="Barplot","Heatmap"="Heatmap","Boxplot"="Boxplot","Diversity"="Diversity","Rarefaction"="Rarefaction"),selected = "Barplot")
435
              ),
436
437


438
439
440
441
442
              ########################################################################
              ###
              ###               Options Visualization
              ###
              ########################################################################
Amine  GHOZLANE's avatar
Amine GHOZLANE committed
443
              box(title = "Options",  width = NULL, status = "primary", solidHeader = TRUE,collapsible = TRUE,collapsed= FALSE,
svolant's avatar
svolant committed
444
445
                  conditionalPanel(condition="input.PlotVisuSelect!='Rarefaction' && input.PlotVisuSelect!='Scatterplot' ",
                                   uiOutput("VarIntVisu"),
446
447
                                   h5(strong("Select the modalities")),
                                   uiOutput("ModVisu")
448
                  ),
svolant's avatar
svolant committed
449
450
                  conditionalPanel(condition="input.PlotVisuSelect=='Scatterplot' ",
                                   uiOutput("VarIntVisuScatter"),
svolant's avatar
svolant committed
451
                                   radioButtons("CorMeth","Correlation method",c("Pearson" = "pearson","Spearman" = "spearman"),inline=TRUE),
svolant's avatar
svolant committed
452
453
454
                                   checkboxInput("AddRegScatter","Add regression line",FALSE)
                  ),                 
                  conditionalPanel(condition="input.PlotVisuSelect!='Rarefaction' && input.PlotVisuSelect!='Diversity' && input.PlotVisuSelect!='Scatterplot'",
svolant's avatar
svolant committed
455
                                   radioButtons("SelectSpecifTaxo","Select the features",c("Most abundant"="Most","All"="All", "Differential features" = "Diff", "Non differential features" = "NoDiff"))
456
                  ),
svolant's avatar
svolant committed
457
                  conditionalPanel(condition="input.PlotVisuSelect!='Rarefaction' && input.PlotVisuSelect!='Diversity' && input.PlotVisuSelect!='Scatterplot' && (input.SelectSpecifTaxo=='Diff' || input.SelectSpecifTaxo=='NoDiff') ",
458
459
                                   selectizeInput("ContrastList_table_Visu","",choices = "", multiple = FALSE)
                  ),
svolant's avatar
svolant committed
460
                  conditionalPanel(condition="input.PlotVisuSelect!='Rarefaction' && input.PlotVisuSelect!='Diversity' && input.PlotVisuSelect!='Scatterplot'",
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
                                   uiOutput("TaxoToPlotVisu")
                  ),

                ##################
                ## BARPLOT
                ##################
                conditionalPanel(condition="input.PlotVisuSelect=='Barplot'",
                                 selectizeInput(inputId = "CountsOrProp",label = h6(strong("Type of data")),choices = c("Proportions" = "prop", "Counts" = "counts"),selected = "prop")
                ),
                
                
                ##################
                ## HEATMAP
                ##################
                conditionalPanel(condition="input.PlotVisuSelect=='Heatmap'",
                                 selectizeInput(inputId = "HeatMapType",label = h6(strong("Type of data")),choices = c("Counts" = "Counts", "Log2FC" = "Log2FC"),selected = "Counts")                                 
                ),
                conditionalPanel(condition="input.PlotVisuSelect=='Heatmap' && input.HeatMapType=='Log2FC'",
                                 selectizeInput("ContrastList_table_FC",h6(strong("Contrasts (Min = 2)")),choices = "", multiple = TRUE)
                ),
                conditionalPanel(condition="input.PlotVisuSelect=='Heatmap'",
                                 selectizeInput(inputId = "scaleHeatmap",label = h6(strong("Scale:")),choices = c("None" = "none", "Rows" = "row", "Column" = "col"),selected = "none")
                                 
                ),
                
                ##################
                ## BOXPLOT
                ##################
                conditionalPanel(condition="input.PlotVisuSelect=='Boxplot'",
                                 selectizeInput("typeDataBox",h6(strong("Type of data")),c("Log2"="Log2","Relative"="Relative"))
                ),
                
                ##################
                ## DIVERSITY
                ##################
                conditionalPanel(condition="input.PlotVisuSelect=='Diversity'",
                                 selectizeInput("WhichDiv",h6(strong("Diversity")),c('Alpha','Beta','Gamma'),selected  = c('Alpha','Beta','Gamma'),multiple=TRUE),
                                 checkboxInput("AddBoxplotDiv","AddBoxplot",value=FALSE)
                )
svolant's avatar
svolant committed
500
501
502
#                 conditionalPanel(condition="input.PlotVisuSelect=='Diversity' && input.AddBoxplotDiv",
#                                  uiOutput("SelectVarBoxDiv")
#                 )
Amine  GHOZLANE's avatar
Amine GHOZLANE committed
503
              ),
504
505


506
507
508
509
510
              ########################################################################
              ###
              ###               Appearance Visualization
              ###
              ########################################################################
Amine  GHOZLANE's avatar
Amine GHOZLANE committed
511
              box(title = "Appearance",  width = NULL, status = "primary", solidHeader = TRUE,collapsible = TRUE,collapsed= TRUE,
Amine  GHOZLANE's avatar
Amine GHOZLANE committed
512
                sliderInput("heightVisu", h6(strong("Height")),min=100,max=4000,value = 800),
513
514
515
516
                ##################
                ## BOXPLOT
                ##################
                conditionalPanel(condition="input.PlotVisuSelect=='Boxplot'",
517
                                 uiOutput("ColBoxplot"),
Stevenn Volant's avatar
Stevenn Volant committed
518
                                 radioButtons("ScaleBoxplot","Scales",c("Fixed"="fixed","Free"="free"),inline=TRUE),
519
520
521
522
523
524
525
526
527
528
529
530
531
                                 checkboxInput("CheckAddPointsBox","Add points",value=TRUE)
                ),
                ##################
                ## DIVERSITY
                ##################
                conditionalPanel(condition="input.PlotVisuSelect=='Diversity'",
                                 sliderInput("sizePointGlobal", h6(strong("Points size")),min=0.5,max=10,value =3,step=0.5),
                                 checkboxInput("SplitVisuGlobal","Split diversity",value=FALSE)
                ),
                ##################
                ## HEATMAP
                ##################
                conditionalPanel(condition="input.PlotVisuSelect=='Heatmap' && input.HeatMapType!='Log2FC'",
Stevenn Volant's avatar
Stevenn Volant committed
532
                                 selectInput("colors", label=h6(strong("Gradient of colors")),choices = c("green-blue", "blue-white-red", "purple-white-orange", "red-yellow-green"),selected = "blue-white-red")
533
534
535
536
537
538
539
540
541
542
543
544
                ),
                conditionalPanel(condition="input.PlotVisuSelect=='Heatmap'",
                                 fluidRow(
                                   column(width=12,h6(strong("Labels options"))),
                                   column(width=6,sliderInput("LabelSizeHeatmap", h6("Size"),min=0.1,max=2,value = 0.7,step = 0.1)),
                                   column(width=6,sliderInput("LabelOrientHeatmap", h6("Orientation"),min=0,max=90,value = 0,step = 5)),
                                   column(width=6,sliderInput("LabelColOffsetHeatmap", h6("Column offset"),min=0,max=4,value = 0,step = 0.5)),
                                   column(width=6,sliderInput("LabelRowOffsetHeatmap", h6("Row offset"),min=0,max=4,value = 0,step = 0.5)),
                                   column(width=12,h6(strong("Margins options"))),
                                   column(width=6,sliderInput("rightMargin", h6("Right"),min=0,max=20,value = 6,step = 1)),
                                   column(width=6,sliderInput("lowerMargin", h6("Lower"),min=0,max=20,value = 6,step = 1))
                                 )
545
                ),
svolant's avatar
svolant committed
546
547
548
549
550
551
552
553
554
555
                
                ##################
                ## Scatterplot
                ##################
                conditionalPanel(condition="input.PlotVisuSelect=='Scatterplot'",
                                 fluidRow(
                                   column(width=12,sliderInput("SizeLabelScatter", h6("Label size"),min=0,max=50,value = 10,step = 1))
                                  )
                ),
                
556
557
558
559
560
561
                ##################
                ## ALL
                ##################
                conditionalPanel(condition="input.PlotVisuSelect!='Rarefaction'",
                                 radioButtons(inputId = "SensPlotVisu",label = h6(strong("Orientation")),choices = c("Vertical" = "Vertical", "Horizontal" = "Horizontal"),selected = "Vertical",inline = TRUE)
                )
Stevenn Volant's avatar
Stevenn Volant committed
562
563
564
565
566
567
568
569
570
571
572
573
574
575
              ),
              box(title = "Export",  width = NULL, status = "primary", solidHeader = TRUE,collapsible = TRUE,collapsed= TRUE,
                  ##################
                  ## BARPLOT
                  ##################
                  conditionalPanel(condition="input.PlotVisuSelect=='Barplot'",
                                   radioButtons("positionBarPlot","Position",c("Grouped"="fill","Stacked"="dodge"),inline=TRUE)
                  ),
                  selectInput("Exp_format_Visu",h5(strong("Export format")),c("png"="png","pdf"="pdf","eps"="eps","svg"="svg"), multiple = FALSE),
                  fluidRow(
                    column(width=6,numericInput("heightVisuExport", "Height (in px)",min=100,max=NA,value = 500,step =1)),
                    column(width=6,numericInput("widthVisuExport", "Width (in px)",min=100,max=NA,value = 500,step =1))
                  ),
                  downloadButton("exportVisu", "Export")
576
              )
Amine  GHOZLANE's avatar
Amine GHOZLANE committed
577
578
579
580
            )
          )
  ),

stevenn's avatar
stevenn committed
581
582
  #### Krona plot
  tabItem(tabName = "Krona",
Amine  GHOZLANE's avatar
Amine GHOZLANE committed
583
         fluidRow(
Stevenn Volant's avatar
Stevenn Volant committed
584
585
586
587
588
589
590
591
592
593
594
595
            column(width=3,
                   p(strong("Krona plot")),
                   img(src="Krona.png",height = 200, width = 220),
                   a(href = "test_krona.html",target="_blank", "Click Here!")
#                    tableOutput("krona") 

),
            column(width=3,
            p(strong("Tree abundance")),
            img(src="Tree.png",height = 200, width = 220),
            a(href = "http://genopole.pasteur.fr/SynTView/flash/TreeAbundance",target="_blank", "Click Here!")
            )
596
        )
Stevenn Volant's avatar
Stevenn Volant committed
597
 #includeHTML("file:///home/aghozlan/workspace/SHAMAN_App/www/text.krona.html")
stevenn's avatar
stevenn committed
598
  )
599
600
601
 )
)
  ## GOOGLE ANALYTIC
602
 #tags$head(includeScript("google-analytics.js"))
Stevenn Volant's avatar
logo    
Stevenn Volant committed
603
604
605
606
  ## Logo SHAMAN
  dbHeader <- dashboardHeader(title = "SHAMAN")
  dbHeader$children[[2]]$children <-  tags$a(tags$img(src='akuaku.png',height='40',width='50',style="margin:5px 0 5px 0;",align='left'), tags$h3("SHAMAN",style="font-family:Purisa; margin:15px 25px 5px 0;color:white;"))
  
stevenn's avatar
stevenn committed
607
# Put them together into a dashboardPage
Stevenn Volant's avatar
logo    
Stevenn Volant committed
608
609
610
611
612
  dashboardPage(skin="blue",
    dbHeader,
    sidebar,
    body
  )
stevenn's avatar
stevenn committed
613
614