knitr::opts_chunk$set(echo = TRUE) knitr::opts_knit$set(root.dir = "../")
flowDashboard
In order to enable comparison of flow cytometry data across samples, we have developed three R6 objects that enable different portions of the analysis in our Shiny Dashboard.
qcFlowObj
- used to visualize qc analysisgatingObj
- used to visualize gating and population percentagespopulationExpressionObj
- used to compare expression across conditions.Why R6 objects? We wanted to make the data easily comparable and reusable. Putting data into these objects allows for rapid deployment of a comparative flow analysis dashboard. Once the objects are built, they can be loaded into a Shiny dashboard with relatively little work.
All three data objects have an annotation
slot, which holds a data.table
. This annotation
slot allows for subsetting the data according to covariates in the data. There is a constraint on these objects that forces the annotation
and associated data
slot (qcData
, popTable
, and expressionData
) to have sample ids that reconcile with each other. The mapping variable between these two data.table
s must be specified as a named vector (for example: c("idVar"="FCSFiles")
) in the mapVar
slot.
qcData
can be generated from both flowSets
and gatingSets
. popTable
and expressionData
can only be generated from gatingSets
.
flowDashboard
ObjectsEach object type has display options associated with the object. Setting these options on the objects greatly simplifies deployment of a modular dashboard. For example, you can control what variables in your annotation to sort on and subset on using the subsetModule
. For the GatingObj
, you can control which populations are visible in your dashboard using the setPopulations
method.
Common display options across all of the classes are:
setSubsetAndSortOptions()
- Setting columns for subsetting in the annotation slot
setAnnotationDisplayOptions()
- Setting the columns in the annotation slot to display
subsetAnnotation()
- subset the annotation and data slots to be restricted to a set of ids (this is a destructive operation)
qcFlowObj
setMarkers()
GatingObj
setPopulations()
populationExpressionObj
setPopulations()
qcFlowObj
, gatingObj
and populationExpressionObj
from a GatingSet
Here we build a qcFlowObj
from a subset of GvHD
dataset. Before we do, we look at the phenotypes available in the phenoData
slot in the GatingSet
.
library(flowWorkspace) gsFile <- system.file("extdata/gvHDgs/", package = "flowDashboard") gs <- load_gs(gsFile) ##look at phenoData slot in gs phenotypes <- pData(gs@data@phenoData) phenotypes
##look at marker information in gs markerInfo <- pData(parameters(gs)) markerInfo
#build a qcFlowObj QCO <- QCOFromGatingSet(gs, samplePop = 1000) #show annotation slot QCO$annotation #show first few lines of qcData QCO$qcData
Here we build a gatingObj
from our GatingSet
. If you want to show the gating for each sample, you will also need to set plotGraphs=TRUE
and provide an imageDir
as arguments to gatingObjFromGatingSet
.
objId <- "GOgvhd" #GO <- GOFromGatingSet(gs, objId = objId)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.