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
923aa95d
Commit
923aa95d
authored
Dec 18, 2020
by
Midoux Cedric
Browse files
transfo rarefaction
parent
6e7b8713
Changes
1
Hide whitespace changes
Inline
Side-by-side
panels/dataInput.R
View file @
923aa95d
...
...
@@ -145,7 +145,7 @@ observeEvent(input$okData, {
d
<-
rarefy_even_depth
(
d
,
replace
=
FALSE
,
rngseed
=
as.integer
(
Sys.time
())
,
rngseed
=
314
,
verbose
=
FALSE
)
}
...
...
@@ -284,7 +284,8 @@ transformSample <- function() {
inputId
=
"transformFun"
,
label
=
"Transform function : "
,
selected
=
NULL
,
choices
=
c
(
"Proportional Transformation"
=
"prop"
,
choices
=
c
(
"Rarefaction"
=
"rare"
,
"Proportional Transformation"
=
"prop"
,
"Square Root Transformation"
=
"sqrt"
,
"Square Root Proportional Transformation"
=
"sqrtprop"
,
"Centered Log-Ratio (CLR) Transformation"
=
"clr"
)
...
...
@@ -301,6 +302,7 @@ transformSample <- function() {
output
$
transformFun
<-
renderText
({
validate
(
need
(
input
$
transformFun
,
""
))
switch
(
input
$
transformFun
,
"rare"
=
"data_rare <- rarefy_even_depth(data, rngseed = 314, replace = TRUE)"
,
"prop"
=
paste
(
"count_to_prop <- function(x) {return( x / sum(x) )}"
,
"data_prop <- transform_sample_counts(data, count_to_prop)"
,
sep
=
"\n"
),
...
...
@@ -329,6 +331,9 @@ observeEvent(input$transformData, {
shinyWidgets
::
updateSwitchInput
(
session
=
session
,
inputId
=
"useTransf"
,
value
=
FALSE
)
try
(
switch
(
input
$
transformFun
,
"rare"
=
{
transform_physeq
(
rarefy_even_depth
(
select_physeq
(),
rngseed
=
314
,
replace
=
TRUE
))
},
"prop"
=
{
count_to_prop
<-
function
(
x
)
{
return
(
x
/
sum
(
x
)
)}
transform_physeq
(
transform_sample_counts
(
select_physeq
(),
count_to_prop
))
...
...
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