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
Midoux Cedric
easy16S
Commits
fb0f866e
Commit
fb0f866e
authored
Jul 20, 2020
by
Midoux Cedric
Browse files
select_physeq()
parent
b0d2c309
Changes
2
Hide whitespace changes
Inline
Side-by-side
panels/dataInput.R
View file @
fb0f866e
...
...
@@ -172,7 +172,10 @@ observeEvent(input$okData, {
)
if
(
inherits
(
raw_physeq
(),
"phyloseq"
))
{
select_physeq
(
raw_physeq
())
physeq
(
raw_physeq
())
transform_physeq
(
NULL
)
shinyWidgets
::
updateSwitchInput
(
session
=
session
,
inputId
=
"useTransf"
,
disabled
=
TRUE
,
value
=
FALSE
)
message
(
paste
(
"[Easy16S] Correct upload with"
,
input
$
dataset
,
"mode :"
,
message
))
removeModal
()
}
else
{
...
...
@@ -191,7 +194,7 @@ filterSample <- function() {
inline
=
TRUE
,
choices
=
c
(
"Sample"
=
"sample"
,
sample_variables
(
raw
_physeq
(),
errorIfNULL
=
FALSE
)
sample_variables
(
select
_physeq
(),
errorIfNULL
=
FALSE
)
),
selected
=
"sample"
),
...
...
@@ -212,10 +215,10 @@ output$filterUI <- renderUI({
if
(
input
$
filterCriteria
==
"sample"
)
{
label
<-
"Sample to keep :"
choices
<-
sample_names
(
raw
_physeq
())
choices
<-
sample_names
(
select
_physeq
())
}
else
{
label
<-
"Variable to keep :"
choices
<-
levels
(
get_variable
(
raw
_physeq
(),
input
$
filterCriteria
))
choices
<-
levels
(
get_variable
(
select
_physeq
(),
input
$
filterCriteria
))
}
observe
({
...
...
@@ -251,18 +254,19 @@ observeEvent(input$selectData, {
}
else
{
try
(
if
(
input
$
filterCriteria
==
"sample"
)
{
raw
_physeq
(
prune_samples
(
samples
=
input
$
filterCheck
,
raw
_physeq
()))
select
_physeq
(
prune_samples
(
samples
=
input
$
filterCheck
,
select
_physeq
()))
}
else
{
criteria
<<-
input
$
filterCriteria
check
<<-
input
$
filterCheck
raw
_physeq
(
subset_samples
(
raw
_physeq
(),
eval
(
parse
(
text
=
criteria
))
%in%
check
))
select
_physeq
(
subset_samples
(
select
_physeq
(),
eval
(
parse
(
text
=
criteria
))
%in%
check
))
},
silent
=
TRUE
,
outFile
=
showModal
(
dataInput
(
failed
=
TRUE
)))
if
(
inherits
(
raw
_physeq
(),
"phyloseq"
))
{
if
(
inherits
(
select
_physeq
(),
"phyloseq"
))
{
message
<-
paste
(
input
$
filterCheck
,
collapse
=
", "
)
message
(
paste
(
"[Easy16S] Select some samples :"
,
message
))
physeq
(
select_physeq
())
removeModal
()
}
else
{
showModal
(
dataInput
(
failed
=
TRUE
))
...
...
@@ -326,14 +330,14 @@ observeEvent(input$transformData, {
switch
(
input
$
transformFun
,
"prop"
=
{
count_to_prop
<-
function
(
x
)
{
return
(
x
/
sum
(
x
)
)}
transform_physeq
(
transform_sample_counts
(
raw
_physeq
(),
count_to_prop
))
transform_physeq
(
transform_sample_counts
(
select
_physeq
(),
count_to_prop
))
},
"sqrt"
=
{
transform_physeq
(
transform_sample_counts
(
raw
_physeq
(),
sqrt
))
transform_physeq
(
transform_sample_counts
(
select
_physeq
(),
sqrt
))
},
"sqrtprop"
=
{
count_to_sqrtprop
<-
function
(
x
)
{
return
(
sqrt
(
x
/
sum
(
x
)))}
transform_physeq
(
transform_sample_counts
(
raw
_physeq
(),
count_to_sqrtprop
))
transform_physeq
(
transform_sample_counts
(
select
_physeq
(),
count_to_sqrtprop
))
},
"clr"
=
{
gm_mean
<-
function
(
x
,
na.rm
=
TRUE
)
{
...
...
@@ -344,7 +348,7 @@ observeEvent(input$transformData, {
x
<-
log
(
x
/
gm_mean
(
x
),
base
)
return
(
x
)
}
transform_physeq
(
transform_sample_counts
(
raw
_physeq
(),
clr
))
transform_physeq
(
transform_sample_counts
(
select
_physeq
(),
clr
))
}
),
silent
=
TRUE
,
...
...
@@ -365,7 +369,7 @@ observeEvent(input$useTransf,
if
(
input
$
useTransf
)
{
physeq
(
transform_physeq
())
}
else
{
physeq
(
raw
_physeq
())
physeq
(
select
_physeq
())
}
)
...
...
server.R
View file @
fb0f866e
...
...
@@ -28,6 +28,7 @@ shinyServer
physeq
<-
reactiveVal
()
raw_physeq
<-
reactiveVal
()
select_physeq
<-
reactiveVal
()
transform_physeq
<-
reactiveVal
()
showModal
(
dataInput
())
...
...
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