This vignette demonstrates how the gatingML files exported from Cytobank can be imported into R as a GatingSet object.

library(flowWorkspace)
library(CytoML)
fcsFiles <- list.files(pattern = "CytoTrol", system.file("extdata", package = "flowWorkspaceData"), full.names = TRUE)
xmlfile <- system.file("extdata/cytotrol_tcell_cytobank.xml", package = "CytoML")

0.1 Use cytobank2GatingSet

The entire parsing work can be done with single convevient function cytobank2GatingSet:

gs <- cytobank2GatingSet(xmlfile, fcsFiles)

0.2 Load GatingML and FCS separately

Or you can divide the parsing into several steps to have more controls.

0.2.1 Load the gatingML file as a graphGML object

g <- read.gatingML.cytobank(xmlfile)
class(g)
## [1] "graphGML"
## attr(,"package")
## [1] "CytoML"
g
## --- Gating hieararchy parsed from GatingML: 
##  with  12  populations defined

graphGML stores the gating hierarchy, which can be inspected by various accessors.

getNodes(g)
## GateSet_722318 GateSet_722319 GateSet_722320 GateSet_722321 GateSet_722322 
##          "CD4"          "CD8"           "Q4"           "Q3"     "singlets" 
## GateSet_722323 GateSet_722324 GateSet_722325 GateSet_722326 GateSet_722327 
##   "not debris"           "Q1"           "Q2"       "CD8_Q2"          "CD3" 
## GateSet_722328 GateSet_722329 
##   "CD38 range"    "HLA range"
getParent(g, "GateSet_722318")
## [1] "GateSet_722327"
getChildren(g, "GateSet_722318")
## [1] "GateSet_722320" "GateSet_722321" "GateSet_722324" "GateSet_722325"

And the population tree can be plotted

plot(g)