Commit 894413b0 authored by Midoux Cedric's avatar Midoux Cedric
Browse files

reactive betaDist

parent ca7904d8
^.*\.Rproj$
^\.Rproj\.user$
betaDist <- metaReactive2({
data <- physeq()
metaExpr({
distance(data, method = ..(input$betaDistance))
})
})
output$betaMdsUI <- renderUI({
validate(need(physeq(), ""))
box(
......@@ -63,7 +70,8 @@ output$betaMds <- metaRender2(renderPlot, {
metaExpr({
ord <- ordinate(data,
method = ..(input$betaMdsMethod),
distance = ..(input$betaDistance))
distance = ..(betaDist())
)
p <- plot_ordination(
physeq = data,
ordination = ord,
......@@ -113,7 +121,7 @@ output$betaCluster <- metaRender2(renderPlot, {
metaExpr({
p <- plot_clust(physeq = data,
dist = ..(input$betaDistance),
dist = ..(betaDist()),
method = ..(input$betaClusterMethod),
color = ..(checkNull(input$betaClusterCol))
)
......@@ -157,7 +165,7 @@ output$betaHeatmap <- metaRender2(renderPlot, {
if (!is.null(checkNull(input$betaHeatmapOrder)))
{
metaExpr({
beta <- reshape2::melt(as.matrix(distance(data, method = ..(input$betaDistance))))
beta <- reshape2::melt(as.matrix(..(betaDist())))
colnames(beta) <- c("x", "y", "distance")
new_factor = as.factor(get_variable(data, ..(input$betaHeatmapOrder)))
variable_sort <- as.factor(get_variable(data, ..(input$betaHeatmapOrder))[order(new_factor)])
......@@ -177,7 +185,7 @@ output$betaHeatmap <- metaRender2(renderPlot, {
})
} else {
metaExpr({
beta <- reshape2::melt(as.matrix(distance(data, method = ..(input$betaDistance))))
beta <- reshape2::melt(as.matrix(..(betaDist())))
colnames(beta) <- c("x", "y", "distance")
p <- ggplot(beta, aes(x = x, y = y, fill = distance)) + geom_tile()
p <- p + ggtitle(..(input$betaHeatmapTitle))
......@@ -238,7 +246,7 @@ output$betaNetwork <- metaRender2(renderPlot, {
metaExpr({
g <- make_network(data,
distance = ..(input$betaDistance),
distance = ..(betaDist()),
max.dist = ..(input$betaNetworkMax),
keep.isolates = ..(input$betaNetworkOrphan)
)
......@@ -273,6 +281,6 @@ output$betaTable <- renderUI({
title = "Distance table",
width = NULL,
status = "primary",
beautifulTable(tibble::rownames_to_column(as.data.frame(round(as.matrix(distance(physeq(), method = input$betaDistance)), digits = 2)), var = "SAMPLE"))
beautifulTable(tibble::rownames_to_column(as.data.frame(round(as.matrix(betaDist()), digits = 2)), var = "SAMPLE"))
)
})
......@@ -69,8 +69,8 @@ dashboardHeader(title = "Easy16S"),
choices = list("bray", "jaccard", "unifrac", "wunifrac", "dpcoa", "jsd", "euclidean")),
menuSubItem("MultiDimensional Scaling", tabName = "betaMds"),
menuSubItem("Samples clustering", tabName = "betaCluster"),
menuSubItem("Samples heatmap", tabName = "betaHeatmap"),
menuSubItem("Network", tabName = "betaNetwork"),
menuSubItem("Samples heatmap", tabName = "betaHeatmap"),
menuSubItem("Table", tabName = "betaTable")
),
menuItem("PCA", tabName = "pca", icon = icon("bullseye")),
......@@ -91,8 +91,8 @@ dashboardHeader(title = "Easy16S"),
tabItem(tabName = "alphaTable", alphaTable),
tabItem(tabName = "betaMds", betaMds),
tabItem(tabName = "betaCluster", betaCluster),
tabItem(tabName = "betaHeatmap", betaHeatmap),
tabItem(tabName = "betaNetwork", betaNetwork),
tabItem(tabName = "betaHeatmap", betaHeatmap),
tabItem(tabName = "betaTable", betaTable),
tabItem(tabName = "pca", pca),
tabItem(tabName = "tree", tree),
......
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