How to import Cytobank into a GatingSet

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)
library(CytoML)
acs <- system.file("extdata/cytobank_experiment.acs", package = "CytoML")

Create cytobank_experiment object from the ACS bundle exported from Cytobank

ce <- open_cytobank_experiment(acs)
ce

cytobank_experiment is a wrapper around the ACS file, which can be inspected by various accessors.

sampleNames(ce)
colnames(ce)
markernames(ce)
pData(ce)

Then import cytobank_experiment into GatingSet

gs <- cytobank_to_gatingset(ce)

Alternatively, the import can be done by gatingML and fcs files that are downloaded separately form Cytobank without ACS.

xmlfile <- ce$gatingML
fcsFiles <- list.files(ce$fcsdir, full.names = TRUE)
gs <- cytobank_to_gatingset(xmlfile, fcsFiles)

However, it doesn't have the information from yaml file (part of ACS). E.g. sample tags (i.e. pData) and customized markernames. So it is recommended to import ACS.

Inspect the results

library(ggcyto)
## Plot the gates
autoplot(gs[[1]])
# Extract the population statistics
gs_pop_get_count_fast(gs, statType = "count")


Try the CytoML package in your browser

Any scripts or data that you put into this service are public.

CytoML documentation built on March 12, 2021, 2 a.m.