title: "How to parse gatingML into a GatingSet" author: "Mike Jiang" output: html_document
knitr::opts_chunk$set(echo = TRUE, results = "markup", message = FALSE, warning = FALSE)
This vignette demonstrates how the gatingML files exported from Cytobank can be imported into R as a GatingSet object.
library(flowWorkspace) fcsFiles <- list.files(pattern = "CytoTrol", system.file("extdata", package = "flowWorkspaceData"), full.names = TRUE) xmlfile <- system.file("extdata/cytotrol_tcell_cytobank.xml", package = "flowWorkspace")
parse.gatingML
The entire parsing work can be done with single convevient function parse.gatingML
:
gs <- parse.gatingML(xmlfile, fcsFiles)
Or you can divide the parse into several steps to have more controls.
g <- read.gatingML.cytobank(xmlfile) class(g) g
graphGML stores the gating hierarchy, which can be inspected by various accessors.
getNodes(g) getParent(g, "GateSet_722318") getChildren(g, "GateSet_722318")
And the population tree can be plotted
plot(g)
The node with dotted border means the tailored
gates(or sample-specific gates) are defined for that population.
fs <- read.ncdfFlowSet(fcsFiles)
gs <- GatingSet(fs)
GatingSet
gs <- compensate(gs, g)
trans <- getTransformations(g) trans
GatingSet
gs <- transform(gs, trans)
require(ggcyto) ggcyto(gs, aes(x = CD4), subset = "root") + geom_density() ggcyto(gs, aes(x = CD4, y = CD8), subset = "root") + geom_hex()
gating(g, gs)
autoplot(gs[[1]])
getPopStats(gs, statType = "count")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.