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) ce_get_panels(ce) ce_get_compensations(ce) ce_get_samples(ce) ce_get_channels(ce) ce_get_markers(ce) pData(ce)
Then import cytobank_experiment
into GatingSet
gs <- cytobank_to_gatingset(ce)
By default, the first panel
(i.e. panel_id = 1
) will be imported. Change panel_id
argument to select different panel (if there are more than one , which can be inspected by ce_get_panels
)
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.