plotGatingSetInput: Build plots from a GatingSet

Description Usage Arguments Value Examples

View source: R/plotGatingSet_module.R

Description

Build plots from a GatingSet

plotGatingSet module server function

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
plotGatingSetInput(id)

plotGatingSet(
  input,
  output,
  session,
  rval,
  plot_params = reactiveValues(),
  simple_plot = TRUE,
  auto_update = TRUE,
  show_gates = FALSE,
  polygon_gate = NULL
)

Arguments

id

shiny id

input

shiny input

output

shiny output

session

shiny session

rval

a reactivevalues object with the following elements :

gating_set

: a GatingSet object

apply_trans

: logical; apply transformations defined in rval$gating_set

apply_comp

: logical; apply compensation defined in rval$gating_set

plot_params

reactivevalues object used to initialize plot parameters. Amongst others it can contain the following elements (not mandatory):

plot_type

: type of plot

sample

: names of samples

subset

: names of subsets

xvar

: x-axis variables

yvar

: y-axis variables

color_var

: color aesthetic

group_var

: group aesthetic

facet_var

: variable used to show different plot facets

split_var

: variable used to create multiple plots

simple_plot

logical, disable a number of plot options (such as faceting, multiple plots with different x, y or color variables)

auto_update

Should plot update be automatic? If FALSE, plot update is controlled by an action button.

show_gates

Should gates with coordinates matching plot coordinates be displayed

polygon_gate

a reactiveValues object with polygon coordinates to be plotted as an additionnal layer. Must contain elements :

x

vector of x coordinates

y

vector of y coordinates

Value

A reactivevalues object with the following elements :

plot

a plot or a list of plots

params

plot parameters

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
## Not run: 
library(shiny)
library(shinydashboard)
library(flowWorkspace)
library(flowCore)
library(viridis)
library(scales)
library(ggplot2)
library(ggrepel)
library(plotly)
library(ggridges)

if (interactive()){
  
  ui <- dashboardPage(
    dashboardHeader(title = "plotGatingSet"),
    sidebar = dashboardSidebar(disable = TRUE),
    body = dashboardBody(
      fluidRow(
        column(4, box(width = NULL, plotGatingSetInput("module"))),
        column(8, box(width = NULL, simpleDisplayUI("simple_display_module")))
      )
    )
  )
  
  server <- function(input, output, session) {
    
    rval <- reactiveValues()
    plot_params <- reactiveValues()
    
    observe({
      utils::data("GvHD", package = "flowCore")
      rval$gating_set <- GatingSet(GvHD)
      plot_params$plot_type <- "histogram"
    })
    
    res <- callModule(plotGatingSet, "module",
                      rval = rval,
                      plot_params = plot_params)
    
    callModule(simpleDisplay, "simple_display_module", res$plot)
    
  }
  
  shinyApp(ui, server)
  
}
## End(Not run)

VoisinneG/flowR documentation built on June 1, 2021, 6:42 p.m.