Yang-Tang / heatmapPlateMod

A shiny module for plotting microplate data as a heatmap

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

heatmapPlateMod

A shiny module for plotting microplate data as a heatmap

Introduction

This is a highcharter package based shiny module that can plot microplate data as heatmap and return infomation of user selected wells.

Pre-request

This shiny module requires following packages. Please make sure they are installed.

install.package('dplyr')
install.package('tidyr')
install.package('highcharter')

Usage

  1. Source the module file
source('heatmapPlateMod.R')
  1. In server function, create a shiny reactive object that contains the microplate data to be displayed in dataframe format:
server <- function(input, output) {

  # The microplate dataframe should contain at least tow columns:
  #   Well: the well id of microplate (eg, A1, A2, B5, D12) 
  #   Value: the value of that well to be displayed as heatmap
  # The dataframe may contain other columns and will be ignored.
  
  microplate <- reactive({
    expand.grid(Row = LETTERS[1:8], Col = as.character(1:12),
                stringsAsFactors = F) %>%
    unite(Well, Row, Col, sep = '') %>%
    mutate(Value = runif(n())) %>%
    sample_frac(0.9)
  })

  # other codes

}
  1. Invoke module in server function and send the microplate data object to the data parameter. Set nrow and ncol to define the type of microplate:
selected <- callModule(hmplate, id = 'YOU_MODULE_ID', data = microplate, nrow = 8, ncol = 12)
  1. Add heatmap output ui
ui <- fluidPage(

  hmplateUI('YOU_MODULE_ID')

)
  1. Run app. Select wells by Ctrl/Shift + Click. The module returns a subsetted dataframe according to the selection.

alt text

About

A shiny module for plotting microplate data as a heatmap


Languages

Language:R 100.0%