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: tcell
## gatingML File: /tmp/Rtmpj363G2/file67c0793f40ad/experiments/3637/cytobank_gate_ml2_v41.xml
## panel samples
## 1 Panel 1 1
cytobank_experiment is a wrapper around the ACS
file, which can be inspected by various accessors.
sampleNames(ce)
## [1] "CytoTrol_CytoTrol_1.fcs"
colnames(ce)
## [1] "FSC-A" "FSC-H" "FSC-W" "SSC-A" "B710-A" "R660-A" "R780-A" "V450-A"
## [9] "V545-A" "G560-A" "G780-A" "Time"
markernames(ce)
## $CytoTrol_CytoTrol_1.fcs
## [1] "FSC-A" "FSC-H" "FSC-W" "SSC-A" "CD4"
## [6] "CD38 APC" "CD8 APCH7" "CD3" "HLA-DR V500" "CCR7 PE"
## [11] "CD45RA PECy7" "Time"
pData(ce)
## name Conditions Individuals
## CytoTrol_CytoTrol_1.fcs CytoTrol_CytoTrol_1.fcs condition1 ptid1
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]])