R/ui_3_page.R

Defines functions box_pca_ui box_dbscan_ui box_tsne_ui Anomaly_Score_Threshold_ui box_som_ui box_abod_ui box_isofor_ui

box_pca_ui <- function(id) {
  ns <- NS(id)

  tagList(
    column(
      12,
      verbatimTextOutput(ns("inertia")),
      plotOutput(ns("plot")),

      # To put the two boxes (numeric input and text output) in the same line, and the text centered
      column(12,
        align = "left", style = "display: flex;flex-direction: row;align-items: center;",
        div(style = "width: 50%", numericInput(ns("sphere_radius"), "sphere radius", value = 2, min = 0, step = 0.1)),
        div(style = "width: 49%; text-align: center", textOutput(ns("outliers")))
      )
    )
  )
}

box_dbscan_ui <- function(id) {
  ns <- NS(id)

  tagList(
    column(
      12,

      sidebarLayout(
        sidebarPanel(

          sliderTextInput(ns("k"), "Choose a value for k :", choices = 1:20, selected = 4, grid = T),
          materialSwitch(ns("mean"), label = "Distance mean", value = TRUE, status = "primary"),
          br(),
          numericInput(ns("epsillon"), "Epsillon", 0.5, min = 0, step = 0.1),
          sliderInput(ns("minPts"), "MinPts", min = 1, max = 20, step = 1, value = 5)
        ),
        mainPanel(
          plotOutput(ns("plot")),
          verbatimTextOutput(ns("result"))
        )
      )
    )
  )
}

box_tsne_ui <- function(id) {
  ns <- NS(id)

  tagList(
    column(
      12,
      splitLayout(
        column(
          12,
          h4("DBSCAN"),
          box_dbscan_ui(ns("dbscan"))
        ),
        column(12, plotOutput(ns("plot")))
      )
    )
  )
}

Anomaly_Score_Threshold_ui <- function(id, value = 0.95) {
  ns <- NS(id)

  sliderInput(ns("quantile"), "Anomaly Score Threshold", value = value, min = 0, max = 1, step = 0.01)
}

box_som_ui <- function(id) {
  ns <- NS(id)

  tagList(
    column(
      12,
      Anomaly_Score_Threshold_ui(ns("quantile")),
      textOutput(ns("outliers")),
      column(12, plotOutput(ns("plot"), height = "1000px"))
    )
  )
}


box_abod_ui <- function(id) {
  ns <- NS(id)

  tagList(
    ccolumn(
      12,
      sliderInput(ns("knn"), "Number of nearest neighbours", 20, min = 2, max = 40, step = 1),
      Anomaly_Score_Threshold_ui(ns("quantile"), value = 0.05),
      verbatimTextOutput(ns("outliers"))
    )
  )
}


#' @importFrom purrr map
box_isofor_ui <- function(id) {
  ns <- NS(id)

  tagList(
    column(
      12,
      Anomaly_Score_Threshold_ui(ns("quantile")),
      column(6, selectInput(ns("tree_depth"), "Tree Depth", choices = c(3, 4, 5, 6, 7, 8), selected = 5)),
      column(6, selectInput(ns("trees_number"), "Number of Trees", choices = unlist(map(c(100, 1000), ~ . * c(1, 2, 5))), selected = 100)),
      verbatimTextOutput(ns("outliers"))
    )
  )
}
ArthurPERE/RNASeqDE documentation built on Sept. 17, 2019, 7:34 p.m.