Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
easy16S
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Midoux Cedric
easy16S
Commits
197c12a1
Commit
197c12a1
authored
Mar 25, 2020
by
Midoux Cedric
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rework rarefactionCurve with shinymeta
parent
232c0c2e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
70 deletions
+44
-70
panels/rarefactionCurve-server.R
panels/rarefactionCurve-server.R
+43
-69
panels/rarefactionCurve-ui.R
panels/rarefactionCurve-ui.R
+1
-1
No files found.
panels/rarefactionCurve-server.R
View file @
197c12a1
output
$
rarefactionCurve
<-
renderPlot
({
validate
(
need
(
data16S
(),
"Requires an abundance dataset"
))
p
<-
ggrare
(
physeq
=
data16S
(),
step
=
100
,
#step = input$rarefactionStep,
color
=
checkNull
(
input
$
rarefactionColor
),
label
=
checkNull
(
input
$
rarefactionLabel
),
se
=
FALSE
)
if
(
!
is.null
(
checkNull
(
input
$
rarefactionGrid
)))
{
p
<-
p
+
facet_grid
(
paste
(
"."
,
"~"
,
input
$
rarefactionGrid
))
}
if
(
input
$
rarefactionMin
)
{
p
<-
p
+
geom_vline
(
xintercept
=
min
(
sample_sums
(
data16S
())),
color
=
"gray60"
)
}
return
(
p
+
ggtitle
(
input
$
rarefactionTitle
))
})
output
$
rarefactionCurveUI
<-
renderUI
({
validate
(
need
(
data16S
(),
""
))
validate
(
need
(
physeq
(),
""
))
box
(
title
=
"Setting : "
,
width
=
NULL
,
status
=
"primary"
,
# sliderInput(
# "rarefactionStep",
# label = "Etapes de calcul : ",
# min = 1,
# max = 1000,
# value = 100
# ),
checkboxInput
(
"rarefactionMin"
,
label
=
"Show min sample threshold"
,
value
=
FALSE
),
textInput
(
"rarefactionTitle"
,
label
=
"Title : "
,
...
...
@@ -41,56 +11,60 @@ output$rarefactionCurveUI <- renderUI({
selectInput
(
"rarefactionColor"
,
label
=
"Color : "
,
choices
=
c
(
"..."
=
0
,
sample_variables
(
data16S
()))
choices
=
c
(
"..."
=
0
,
sample_variables
(
physeq
()))
),
selectInput
(
"rarefactionLabel"
,
label
=
"Label : "
,
choices
=
c
(
"..."
=
0
,
sample_variables
(
data16S
()))
choices
=
c
(
"..."
=
0
,
sample_variables
(
physeq
()))
),
selectInput
(
"rarefactionGrid"
,
label
=
"Subplot : "
,
choices
=
c
(
"..."
=
0
,
sample_variables
(
data16S
()))
),
collapsedBox
(
verbatimTextOutput
(
"rarefactionCurveScript"
),
title
=
"RCode"
)
choices
=
c
(
"..."
=
0
,
sample_variables
(
physeq
()))
)
)
})
output
$
rarefactionCurve
Script
<-
renderText
(
{
scriptArgs
<-
c
(
"physeq = data"
,
"step = 100"
,
"se = FALSE"
)
if
(
!
is.null
(
checkNull
(
input
$
rarefactionColor
))
)
{
scriptArgs
<-
c
(
scriptArgs
,
glue
(
"color = \"{input$rarefactionColor}\""
)
)
output
$
rarefactionCurve
<-
metaRender2
(
renderPlot
,
{
validate
(
need
(
physeq
(),
"Requires an abundance dataset"
))
data
<-
physeq
()
rarefactionMin
<-
if
(
input
$
rarefactionMin
)
{
metaExpr
({
geom_vline
(
xintercept
=
min
(
sample_sums
(
data
)),
color
=
"gray60"
)
}
)
}
if
(
!
is.null
(
checkNull
(
input
$
rarefactionLabel
)))
{
scriptArgs
<-
c
(
scriptArgs
,
glue
(
"label = \"{input$rarefactionLabel}\""
))
rarefactionGrid
<-
if
(
!
is.null
(
checkNull
(
input
$
rarefactionGrid
)))
{
metaExpr
({
facet_grid
(
..
(
paste
(
"."
,
"~"
,
input
$
rarefactionGrid
)),
scales
=
"free_x"
)
})
}
script
<-
c
(
scriptHead
,
"# Plot rarefaction curves"
,
glue
(
"p <- ggrare({glue_collapse(scriptArgs, sep=', ')})"
)
metaExpr
({
p
<-
ggrare
(
physeq
=
data
,
step
=
100
,
color
=
..
(
checkNull
(
input
$
rarefactionColor
)),
label
=
..
(
checkNull
(
input
$
rarefactionLabel
)),
se
=
FALSE
)
p
<-
p
+
..
(
rarefactionMin
)
p
<-
p
+
..
(
rarefactionGrid
)
p
+
ggtitle
(
..
(
input
$
rarefactionTitle
))
})
})
observeEvent
(
input
$
rarefactionCurve_output_code
,
{
displayCodeModal
(
expandChain
(
quote
(
library
(
phyloseq
)),
quote
(
library
(
phyloseq.extended
)),
"# Replace `data` with you own data."
,
output
$
rarefactionCurve
()
)
if
(
!
is.null
(
checkNull
(
input
$
rarefactionGrid
)))
{
script
<-
c
(
script
,
glue
(
"p <- p + facet_grid(\". ~ {input$rarefactionGrid}\")"
))
}
if
(
input
$
rarefactionMin
)
{
script
=
c
(
script
,
"p <- p + geom_vline(xintercept = min(sample_sums(data)), color = \"gray60\")"
)
}
if
(
!
is.null
(
checkNull
(
input
$
rarefactionTitle
)))
{
script
<-
c
(
script
,
glue
(
"p <- p + ggtitle({input$rarefactionTitle})"
))
}
script
<-
c
(
script
,
""
,
"plot(p)"
)
return
(
glue_collapse
(
script
,
sep
=
"\n"
))
})
)
panels/rarefactionCurve-ui.R
View file @
197c12a1
rarefactionCurve
<-
fluidPage
(
withLoader
(
plotOutput
(
"rarefactionCurve"
,
height
=
700
)),
rarefactionCurve
<-
fluidPage
(
outputCodeButton
(
withLoader
(
plotOutput
(
"rarefactionCurve"
,
height
=
700
)
)),
uiOutput
(
"rarefactionCurveUI"
))
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