Unverified Commit 330f167f authored by Maciej Dobrzynski's avatar Maciej Dobrzynski Committed by GitHub

Merge pull request #1 from dmattek/master

Cleaning and reorganisation of the code
parents 539be6e0 2006febd
source("modules/hierclustfunction.R")
source("modules/interpolCompleteFunc.R")
source("modules/reacRollWinMODULE.R")
source("modules/reacHierClustMODULE.R")
source('modules/rolling_window_loop.R')
...@@ -3,13 +3,12 @@ ...@@ -3,13 +3,12 @@
#' Author: Mauro Gwerder #' Author: Mauro Gwerder
#' #'
#' In this main file, the input data is processed for feeding it into the modules. #' In this main file, the input data is processed for feeding it into the modules.
#' UI & Server are combined in this file
#' #'
#' package requirements: #' package requirements:
library(shiny) library(shiny)
library(shinydashboard) library(shinydashboard)
library(shinyjs) # http://deanattali.com/shinyjs/ #library(shinyjs) # http://deanattali.com/shinyjs/
library(ggplot2) library(ggplot2)
library(data.table) library(data.table)
library(gplots) # for heatmap.2 library(gplots) # for heatmap.2
...@@ -20,68 +19,6 @@ library(imputeTS) # for interpolating NAs ...@@ -20,68 +19,6 @@ library(imputeTS) # for interpolating NAs
options(shiny.maxRequestSize = 400 * 1024 ^ 2) options(shiny.maxRequestSize = 400 * 1024 ^ 2)
source("hierclustfunction.R")
source("interpolCompleteFunc.R")
source("reacRollWinMODULE.R")
source("reacHierClustMODULE.R")
source('rolling_window_loop.R')
ui <- dashboardPage( # starts shiny in dashboard
dashboardHeader(
# Application title
title ="Outlier Detection"
),
dashboardSidebar(
# dashboard-equivalent to "tabs" in normal shiny
sidebarMenu(
# Every item stands for one tab. "Rolling Window" and "hierarchical clustering" will show outputs of the
# correspondent modules, whereas "Generate synthetic Data" & "Load Data" represent dropdown-menus that load
# or generate datasets.
menuItem("Rolling Window", tabName = "rollwindow", icon = icon("windows")),
menuItem("hierarchical clustering", tabName = "hiercluster", icon = icon("tree")),
menuItem("Generate synthetic Data", tabName = "synDataOpt", icon = icon("random"), # tab for synthetic Data options
sliderInput("slider.syn", "amount of outliers", 0, 30, 1),
checkboxInput("check.super", "add innovative outliers"),
actionButton("b.syndata", "generate synthetic data"),
br()),
menuItem("Load Data", tabName = " ownDataOpt", icon = icon("file"),
fileInput("file.name", "file name:",
accept = c('text/csv', 'text/comma-separated-values,text/plain')
),
# extracted columns from the loaded dataset will be displayed for selection
uiOutput("uiOut.ID"),
uiOutput("uiOut.time"),
uiOutput("uiOut.meas"),
uiOutput("uiOut.FOV"),
actionButton("b.loaddata", "load File"),
br())
)
),
dashboardBody(
# Includes the usage of ShinyJS - not used in the app for now
useShinyjs(),
tabItems(
# references to the modules "RollWin" & "HierCluster"
tabItem(tabName = "rollwindow",
RollWinInput("RollWin")
),
tabItem(tabName = "hiercluster",
HierClusterInput("HierCluster")
)
)
)
)
server <- function(input, output) { server <- function(input, output) {
# clustering and generation of heatmap # clustering and generation of heatmap
...@@ -190,7 +127,7 @@ server <- function(input, output) { ...@@ -190,7 +127,7 @@ server <- function(input, output) {
return(dm.out) return(dm.out)
}) })
# generates synthetic dataset. # generates synthetic dataset.
# Function "LOCgenTraj" taken from Maciej Dobrzynski from his application "Timecourse inspector" # Function "LOCgenTraj" taken from Maciej Dobrzynski from his application "Timecourse inspector"
synData <- eventReactive(input$b.syndata, { synData <- eventReactive(input$b.syndata, {
...@@ -213,7 +150,7 @@ server <- function(input, output) { ...@@ -213,7 +150,7 @@ server <- function(input, output) {
# To enable this, button clicks will be registered so that only the last click decides on # To enable this, button clicks will be registered so that only the last click decides on
# which source is piloted. # which source is piloted.
dataInBoth <- reactive({ dataInBoth <- reactive({
InLoadData <- input$b.loaddata InLoadData <- input$b.loaddata
InSynData <- input$b.syndata InSynData <- input$b.syndata
...@@ -229,10 +166,10 @@ server <- function(input, output) { ...@@ -229,10 +166,10 @@ server <- function(input, output) {
# isolate the checks of counter reactiveValues # isolate the checks of counter reactiveValues
# as we set the values in this same reactive # as we set the values in this same reactive
if (InLoadData != isolate(counter$loadData)) { if (InLoadData != isolate(counter$loadData)) {
cat("dataInBoth if InLoadData\n") cat("dataInBoth if InLoadData\n")
dm = loadColData() dm = loadColData()
counter$loadData <- InLoadData counter$loadData <- InLoadData
} else if (InSynData != isolate(counter$synData)) { } else if (InSynData != isolate(counter$synData)) {
...@@ -250,5 +187,3 @@ server <- function(input, output) { ...@@ -250,5 +187,3 @@ server <- function(input, output) {
} }
shinyApp(ui, server)
library(shinydashboard)
#library(shinyjs) # http://deanattali.com/shinyjs/
ui <- dashboardPage( # starts shiny in dashboard
dashboardHeader(
# Application title
title ="Outlier Detection"
),
dashboardSidebar(
# dashboard-equivalent to "tabs" in normal shiny
sidebarMenu(
# Every item stands for one tab. "Rolling Window" and "hierarchical clustering" will show outputs of the
# correspondent modules, whereas "Generate synthetic Data" & "Load Data" represent dropdown-menus that load
# or generate datasets.
menuItem("Rolling Window", tabName = "rollwindow", icon = icon("windows")),
menuItem("hierarchical clustering", tabName = "hiercluster", icon = icon("tree")),
menuItem("Generate synthetic Data", tabName = "synDataOpt", icon = icon("random"), # tab for synthetic Data options
sliderInput("slider.syn", "amount of outliers", 0, 30, 1),
checkboxInput("check.super", "add innovative outliers"),
actionButton("b.syndata", "generate synthetic data"),
br()),
menuItem("Load Data", tabName = " ownDataOpt", icon = icon("file"),
fileInput("file.name", "file name:",
accept = c('text/csv', 'text/comma-separated-values,text/plain')
),
# extracted columns from the loaded dataset will be displayed for selection
uiOutput("uiOut.ID"),
uiOutput("uiOut.time"),
uiOutput("uiOut.meas"),
uiOutput("uiOut.FOV"),
actionButton("b.loaddata", "load File"),
br())
)
),
dashboardBody(
# Includes the usage of ShinyJS - not used in the app for now
#useShinyjs(),
tabItems(
# references to the modules "RollWin" & "HierCluster"
tabItem(tabName = "rollwindow",
RollWinInput("RollWin")
),
tabItem(tabName = "hiercluster",
HierClusterInput("HierCluster")
)
)
)
)
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