Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Guillaume Perréal
easy16S
Commits
a36798bd
Commit
a36798bd
authored
Sep 12, 2018
by
Midoux Cedric
Browse files
rework histScript
parent
ece485db
Changes
1
Hide whitespace changes
Inline
Side-by-side
server.R
View file @
a36798bd
...
...
@@ -28,7 +28,7 @@ shinyServer
options
=
list
(
dom
=
"lBtip"
,
pageLength
=
10
,
lengthMenu
=
list
(
c
(
10
,
25
,
50
,
100
,
-1
),
list
(
'10'
,
'25'
,
'50'
,
'100'
,
'All'
)),
lengthMenu
=
list
(
c
(
10
,
25
,
50
,
100
,
-1
),
list
(
'10'
,
'25'
,
'50'
,
'100'
,
'All'
)),
buttons
=
list
(
'colvis'
,
list
(
...
...
@@ -124,20 +124,18 @@ shinyServer
})
}
scriptHead
=
paste0
(
"# Loading packages\n"
,
"source(\"https://raw.githubusercontent.com/mahendra-mariadassou/phyloseq-extended/master/R/load-extra-functions.R\")\n"
,
"\n"
,
"# Loading data\n"
,
paste0
(
"load(\""
,
paste
(
"Easy16S-data"
,
Sys.Date
(),
"RData"
,
sep
=
"."
),
"\") # if necessary, adapt the file path\n"
scriptHead
<-
c
(
"# Loading packages"
,
"source(\"https://raw.githubusercontent.com/mahendra-mariadassou/phyloseq-extended/master/R/load-extra-functions.R\")"
,
""
,
"# Loading data"
,
glue
(
"load(\"Easy16S-data.{Sys.Date()}.RData\") # if necessary, adapt the file path"
),
"
\n
"
,
"# View data
\n
"
,
"data
\n
"
,
"
\n
"
""
,
"# View data"
,
"data"
,
""
)
output
$
downloadData
<-
{
...
...
@@ -240,31 +238,28 @@ shinyServer
})
output
$
histScript
<-
renderText
({
paste0
(
scriptArgs
<-
c
(
"physeq = data"
,
glue
(
"fill = \"{input$barFill}\""
))
if
(
!
is.null
(
checkNull
(
input
$
barX
)))
{
scriptArgs
<-
c
(
scriptArgs
,
glue
(
"x = \"{input$barX}\""
))
}
if
(
!
is.null
(
checkNull
(
input
$
barTitle
)))
{
scriptArgs
<-
c
(
scriptArgs
,
glue
(
"title = \"{input$barTitle}\""
))
}
script
<-
c
(
scriptHead
,
"# Plot barplot\n"
,
"p <- plot_bar(physeq = data"
,
glue
(
", fill = \"{input$barFill}\""
),
ifelse
(
is.null
(
checkNull
(
input
$
barX
)),
""
,
glue
(
", x = \"{input$barX}\""
)),
ifelse
(
is.null
(
checkNull
(
input
$
barTitle
)),
""
,
glue
(
", title = \"{input$barTitle}\""
)
),
")\n"
,
ifelse
(
is.null
(
checkNull
(
input
$
barGrid
)),
""
,
glue
(
"p <- p + facet_grid(\". ~ {input$barGrid}\", scales = \"free_x\")
"
)
),
"\n"
,
"plot(p)"
)
"# Plot barplot"
,
glue
(
"p <- plot_bar({glue_collapse(scriptArgs, sep=', ')})"
)
)
if
(
!
is.null
(
checkNull
(
input
$
barGrid
)))
{
script
<-
c
(
script
,
glue
(
"p <- p + facet_grid(\". ~ {input$barGrid}\", scales = \"free_x\")"
))
}
script
<-
c
(
script
,
""
,
"plot(p)"
)
return
(
glue_collapse
(
script
,
sep
=
"\n"
))
})
output
$
histo
<-
renderPlot
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment