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
cd0425d5
Commit
cd0425d5
authored
Dec 05, 2018
by
Midoux Cedric
Browse files
first test on ACP_plot
parent
6f478fa6
Changes
1
Show whitespace changes
Inline
Side-by-side
server.R
View file @
cd0425d5
...
...
@@ -1246,10 +1246,101 @@ shinyServer
label
=
"Barycenters : "
,
choices
=
c
(
"..."
=
0
,
sample_variables
(
data16S
()))
),
collapsedBox
(
verbatimTextOutput
(
"acpScript"
),
title
=
"RCode"
)
collapsedBox
(
verbatimTextOutput
(
"acpScript"
),
title
=
"RCode"
),
actionButton
(
"downloadSetting"
,
label
=
"Download plot"
)
)
})
observeEvent
(
input
$
downloadSetting
,
{
showModal
(
modalDialog
(
title
=
"Setting of downloading plot"
,
textInput
(
"plotName"
,
label
=
"Plot name : "
,
value
=
"Easy16S-plot"
),
numericInput
(
"plotWidth"
,
label
=
"Plot width (cm) : "
,
value
=
20
,
min
=
1
,
max
=
100
),
numericInput
(
"plotHeight"
,
label
=
"Plot height (cm) : "
,
value
=
20
,
min
=
1
,
max
=
100
),
numericInput
(
"plotDPI"
,
label
=
"Plot resolution : "
,
value
=
300
,
min
=
70
,
max
=
500
,
step
=
10
),
selectInput
(
"plotDevice"
,
label
=
"Plot device : "
,
choices
=
list
(
"eps"
,
"ps"
,
"tex"
,
"pdf"
,
"jpeg"
,
"tiff"
,
"png"
,
"bmp"
,
"svg"
),
selected
=
"png"
),
size
=
"s"
,
easyClose
=
TRUE
,
footer
=
downloadButton
(
outputId
=
"downloadPlot"
,
label
=
"Download the plot"
)
)
)
})
output
$
downloadPlot
<-
{
downloadHandler
(
filename
=
function
()
{
paste
(
input
$
plotName
,
input
$
plotDevice
,
sep
=
"."
)
},
content
=
function
(
file
)
{
ggsave
(
file
,
plot
=
plotInputACP
(),
device
=
input
$
plotDevice
,
units
=
"cm"
,
width
=
input
$
plotWidth
,
height
=
input
$
plotHeight
,
dpi
=
input
$
plotDPI
,
limitsize
=
FALSE
)
}
)
}
plotInputACP
<-
function
()
{
p
<-
plot_samples
(
data16S
(),
ordination
=
ordinate
(
data16S
(),
method
=
input
$
acpMethod
,
distance
=
input
$
acpDist
),
axes
=
as.numeric
(
input
$
acpAxes
),
title
=
checkNull
(
input
$
acpTitle
),
color
=
checkNull
(
input
$
acpCol
),
replicate
=
if
(
is.null
(
checkNull
(
input
$
acpRep
)))
{
NULL
}
else
{
checkNull
(
input
$
acpRep
)
},
shape
=
checkNull
(
input
$
acpShape
),
label
=
checkNull
(
input
$
acpLabel
)
)
if
(
!
is.null
(
checkNull
(
input
$
acpEllipse
)))
{
p
<-
p
+
stat_ellipse
(
aes_string
(
group
=
input
$
acpEllipse
))
}
return
(
p
+
theme_bw
())
}
output
$
acpScript
<-
renderText
({
scriptArgs
<-
c
(
"physeq = data"
,
...
...
@@ -1298,27 +1389,6 @@ shinyServer
need
(
data16S
(),
"Requires an abundance dataset"
),
need
(
length
(
input
$
acpAxes
)
==
2
,
"Requires two projections axes"
)
)
p
<-
plot_samples
(
data16S
(),
ordination
=
ordinate
(
data16S
(),
method
=
input
$
acpMethod
,
distance
=
input
$
acpDist
),
axes
=
as.numeric
(
input
$
acpAxes
),
title
=
checkNull
(
input
$
acpTitle
),
color
=
checkNull
(
input
$
acpCol
),
replicate
=
if
(
is.null
(
checkNull
(
input
$
acpRep
)))
{
NULL
}
else
{
checkNull
(
input
$
acpRep
)
},
shape
=
checkNull
(
input
$
acpShape
),
label
=
checkNull
(
input
$
acpLabel
)
)
if
(
!
is.null
(
checkNull
(
input
$
acpEllipse
)))
{
p
<-
p
+
stat_ellipse
(
aes_string
(
group
=
input
$
acpEllipse
))
}
return
(
p
+
theme_bw
())
plotInputACP
()
})
})
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