Commit 923aa95d authored by Midoux Cedric's avatar Midoux Cedric
Browse files

transfo rarefaction

parent 6e7b8713
......@@ -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))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment