Commit fb0f866e authored by Midoux Cedric's avatar Midoux Cedric

select_physeq()

parent b0d2c309
......@@ -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())
}
)
......
......@@ -28,6 +28,7 @@ shinyServer
physeq <- reactiveVal()
raw_physeq <- reactiveVal()
select_physeq <- reactiveVal()
transform_physeq <- reactiveVal()
showModal(dataInput())
......
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