Title: | A GatingML Interface for Cross Platform Cytometry Data Sharing |
---|---|
Description: | Uses platform-specific implemenations of the GatingML2.0 standard to exchange gated cytometry data with other software platforms. |
Authors: | Mike Jiang, Jake Wagner |
Maintainer: | Mike Jiang <[email protected]> |
License: | AGPL-3.0-only |
Version: | 2.19.0 |
Built: | 2024-11-27 04:26:45 UTC |
Source: | https://github.com/bioc/CytoML |
add customInfo nodes to each gate node and add BooleanAndGates
addCustomInfo(root, gs, flowEnv, cytobank.default.scale = TRUE, showHidden)
addCustomInfo(root, gs, flowEnv, cytobank.default.scale = TRUE, showHidden)
root |
the root node of the XML |
gs |
a GatingSet object |
flowEnv |
the environment that stores the information parsed by 'read.GatingML'. |
cytobank.default.scale |
logical flag indicating whether to use the default Cytobank asinhtGml2 settings. Currently it should be set to TRUE in order for gates to be displayed properly in Cytobank because cytobank currently does not parse the global scale settings from GatingML. |
showHidden |
whether to include the hidden population nodes in the output |
XML root node
Extract channels from cytobank_experiment
ce_get_channels(x, panel_name = NULL)
ce_get_channels(x, panel_name = NULL)
x |
A |
panel_name |
select panel to process |
Obtain the spillover matrices for the samples in a Cytobank experiment
ce_get_compensations(x)
ce_get_compensations(x)
x |
A cytobank_experiment object |
A named list of spillover matrices
Extract markers from cytobank_experiment
ce_get_markers(x, panel_name = NULL)
ce_get_markers(x, panel_name = NULL)
x |
A |
panel_name |
select panel to process |
Obtain counts of the number of samples associated with each marker panel in a Cytobank experiment
ce_get_panels(x)
ce_get_panels(x)
x |
|
A tibble
of panels with sample counts
Obtain a mapping between the samples and marker panels in a Cytobank experiment
ce_get_samples(x)
ce_get_samples(x)
x |
A |
A tibble
with rows containing sample names and their associated
panel names
Obtain the transformations associated with each channel in a Cytobank experiment
ce_get_transformations(x, panel_name = NULL)
ce_get_transformations(x, panel_name = NULL)
x |
A |
panel_name |
select panel to process |
A transformerList
object containing transformation
objects for each
transformed channel
compensate a GatingSet based on the compensation information stored in graphGML object
## S4 method for signature 'GatingSet,graphGML' compensate(x, spillover, ...)
## S4 method for signature 'GatingSet,graphGML' compensate(x, spillover, ...)
x |
GatingSet |
spillover |
graphGML |
... |
unused. |
compensated GatingSet
Reconstruct the population tree from the GateSets
constructTree(flowEnv, gateInfo)
constructTree(flowEnv, gateInfo)
flowEnv |
the enivornment contains the elements parsed by read.gatingML function |
gateInfo |
the data.frame contains the gate name, fcs filename parsed by parse.gateInfo function |
a graphNEL represent the population tree. The gate and population name are stored as nodeData in each node.
These methods mirror similar accessor methods for the GatingSet
class.
## S4 method for signature 'cytobank_experiment' markernames(object) ## S4 method for signature 'cytobank_experiment' colnames(x, do.NULL = "missing", prefix = "missing") ## S4 method for signature 'cytobank_experiment' sampleNames(object) ## S4 method for signature 'cytobank_experiment' pData(object)
## S4 method for signature 'cytobank_experiment' markernames(object) ## S4 method for signature 'cytobank_experiment' colnames(x, do.NULL = "missing", prefix = "missing") ## S4 method for signature 'cytobank_experiment' sampleNames(object) ## S4 method for signature 'cytobank_experiment' pData(object)
object |
A |
x |
cytobank_experiment |
do.NULL , prefix
|
not used |
cytobank_experiment
object) into GatingSetA wrapper that parses the gatingML and FCS files (or cytobank_experiment
object) into GatingSet
## Default S3 method: cytobank_to_gatingset(x, FCS, trans = NULL, ...) ## S3 method for class 'cytobank_experiment' cytobank_to_gatingset(x, panel_id = 1, ...)
## Default S3 method: cytobank_to_gatingset(x, FCS, trans = NULL, ...) ## S3 method for class 'cytobank_experiment' cytobank_to_gatingset(x, panel_id = 1, ...)
x |
the cytobank_experiment object or the full path of gatingML file |
FCS |
FCS files to be loaded |
trans |
a 'transfomerList' object to override the transformations from gatingML files. it is typically used by 'cytobank_experiment' parser(i.e. 'cytobank_to_gatingset.cytobank_experiment') to use the scales info recorded in yaml file. |
... |
other arguments |
panel_id |
select panel to process |
a GatingSet
## Not run: acsfile <- system.file("extdata/cytobank_experiment.acs", package = "CytoML") ce <- open_cytobank_experiment(acsfile) xmlfile <- ce$gatingML fcsFiles <- list.files(ce$fcsdir, full.names = TRUE) gs <<- cytobank_to_gatingset(xmlfile, fcsFiles) library(ggcyto) autoplot(gs[[1]]) ## End(Not run)
## Not run: acsfile <- system.file("extdata/cytobank_experiment.acs", package = "CytoML") ce <- open_cytobank_experiment(acsfile) xmlfile <- ce$gatingML fcsFiles <- list.files(ce$fcsdir, full.names = TRUE) gs <<- cytobank_to_gatingset(xmlfile, fcsFiles) library(ggcyto) autoplot(gs[[1]]) ## End(Not run)
GatingSet2cytobank
–> gatingset_to_cytobank
GatingSet2flowJo
–> gatingset_to_flowjo
cytobankExperiment
–> open_cytobank_experiment
cytobank2GatingSet
–> cytobank_to_gatingset
parseWorkspace
–> flowjo_to_gatingset
getKeywords
–> fj_ws_get_keywords
getSamples
–> fj_ws_get_samples
getSampleGroups
–> fj_ws_get_sample_groups
openDiva
–> open_diva_xml
parseWorkspace
–> diva_to_gatingset
Return a data.frame of sample group information from a FACSDiva workspace
diva_get_samples(x) diva_get_sample_groups(x)
diva_get_samples(x) diva_get_sample_groups(x)
x |
A |
A data.frame
with columns tub
, name
, and specimen
Function to parse a FACSDiva Workspace, generate a GatingHierarchy
or GatingSet
object, and associated flowCore gates.
diva_to_gatingset( obj, name = NULL, subset = NULL, path = obj@path, worksheet = c("normal", "global"), swap_cols = list(`FSC-H` = "FSC-W", `SSC-H` = "SSC-W"), verbose = FALSE, ... )
diva_to_gatingset( obj, name = NULL, subset = NULL, path = obj@path, worksheet = c("normal", "global"), swap_cols = list(`FSC-H` = "FSC-W", `SSC-H` = "SSC-W"), verbose = FALSE, ... )
obj |
diva_workspace |
name |
sample group to be parsed, either numeric index or the group name |
subset |
samples to be imported. either numeric index or the sample name. Default is NULL, which imports all samples. |
path |
the FCS data path |
worksheet |
select worksheet to import. either "normal" or "global" |
swap_cols |
diva seems to swap some data cols during importing fcs to experiments this argument provide a list to tell the parser which cols to be swapped default is list(‘FSC-H' = ’FSC-W',‘SSC-H' = ’SSC-W') |
verbose |
whether print more messages during the parsing |
... |
other arguments |
Inherited from flowjo_workspace-class
version
:Object of class "character"
. The version of the XML workspace.
file
:Object of class "character"
. The file name.
.cache
:Object of class "environment"
. An environment for internal use.
path
:Object of class "character"
. The path to the file.
doc
:Object of class "XMLInternalDocument"
. The XML document object.
options
:Object of class "integer"
. The XML parsing options passed to xmlTreeParse
.
It is equivalent to the behavior of shifting the off-scale boundary events into the gate boundary that is describled in bounding transformation section of gatingML standard.
extend( gate, bound, data.range = NULL, plot = FALSE, limits = c("original", "extended") ) ## S3 method for class 'polygonGate' extend( gate, bound, data.range = NULL, plot = FALSE, limits = c("original", "extended") ) ## S3 method for class 'rectangleGate' extend(gate, ...) ## S3 method for class 'ellipsoidGate' extend(gate, ...)
extend( gate, bound, data.range = NULL, plot = FALSE, limits = c("original", "extended") ) ## S3 method for class 'polygonGate' extend( gate, bound, data.range = NULL, plot = FALSE, limits = c("original", "extended") ) ## S3 method for class 'rectangleGate' extend(gate, ...) ## S3 method for class 'ellipsoidGate' extend(gate, ...)
gate |
a flowCore filter/gate |
bound |
numeric matrix representing the bouding information parsed from gatingML. Each row corresponds to a channel. rownames should be the channel names. colnames should be c("min", "max") |
data.range |
numeric matrix specifying the data limits of each channel. It is used to set the extended value of vertices and must has the same structure as 'bound'. when it is not supplied, c(-.Machine$integer.max, - .Machine$integer.max) is used. |
plot |
whether to plot the extended polygon. |
limits |
character whether to plot in "extended" or "original" gate limits. Default is "original". |
... |
other arguments |
The advantage of extending gates instead of shifting data are two folds: 1. Avoid the extra computation each time applying or plotting the gates 2. Avoid changing the data distribution caused by adding the gates
Normally this function is not used directly by user but invoked when parsing GatingML file exported from Cytobank.
a flowCore filter/gate
library(flowCore) sqrcut <- matrix(c(300,300,600,600,50,300,300,50),ncol=2,nrow=4) colnames(sqrcut) <- c("FSC-H","SSC-H") pg <- polygonGate(filterId="nonDebris", sqrcut) pg bound <- matrix(c(100,3e3,100,3e3), byrow = TRUE, nrow = 2, dimnames = list(c("FSC-H", "SSC-H"), c("min", "max"))) bound pg.extened <- extend(pg, bound, plot = TRUE)
library(flowCore) sqrcut <- matrix(c(300,300,600,600,50,300,300,50),ncol=2,nrow=4) colnames(sqrcut) <- c("FSC-H","SSC-H") pg <- polygonGate(filterId="nonDebris", sqrcut) pg bound <- matrix(c(100,3e3,100,3e3), byrow = TRUE, nrow = 2, dimnames = list(c("FSC-H", "SSC-H"), c("min", "max"))) bound pg.extened <- extend(pg, bound, plot = TRUE)
Retrieve keywords associated with a workspace
fj_ws_get_keywords(obj, y, ...)
fj_ws_get_keywords(obj, y, ...)
obj |
A |
y |
c |
... |
other arguments
sampNloc a |
Retrieve a list of keywords from a flowjo_workspace
A list of keyword - value pairs.
## Not run: d<-system.file("extdata",package="flowWorkspaceData") wsfile<-list.files(d,pattern="manual.xml",full=TRUE) ws <- open_flowjo_xml(wsfile) fj_ws_get_samples(ws) res <- try(fj_ws_get_keywords(ws,"CytoTrol_CytoTrol_1.fcs"), silent = TRUE) print(res[[1]]) fj_ws_get_keywords(ws, 1) ## End(Not run)
## Not run: d<-system.file("extdata",package="flowWorkspaceData") wsfile<-list.files(d,pattern="manual.xml",full=TRUE) ws <- open_flowjo_xml(wsfile) fj_ws_get_samples(ws) res <- try(fj_ws_get_keywords(ws,"CytoTrol_CytoTrol_1.fcs"), silent = TRUE) print(res[[1]]) fj_ws_get_keywords(ws, 1) ## End(Not run)
Return a data frame of sample group information from a flowJo workspace
fj_ws_get_sample_groups(x)
fj_ws_get_sample_groups(x)
x |
A |
Note that the samples with 0 populations are also included (since count populations requires traversing xml for all samples thus can be expensive) Returns a table of samples and groups defined in the flowJo workspace
A data.frame
containing the groupName
, groupID
, and sampleID
for each sample in the workspace. Each sample may be associated with multiple groups.
flowjo_workspace-class
flowjo_to_gatingset
## Not run: #ws is a flowjo_workspace fj_ws_get_sample_groups(ws); ## End(Not run)
## Not run: #ws is a flowjo_workspace fj_ws_get_sample_groups(ws); ## End(Not run)
Return a data frame of samples contained in a flowJo workspace
fj_ws_get_samples(x, group_id = NULL)
fj_ws_get_samples(x, group_id = NULL)
x |
A |
group_id |
|
The samples with 0 populations are excluded.
Returns a data.frame
of samples in the flowjo_workspace
, including their
sampleID
, name
A data.frame
with columns sampleID
, name
## Not run: #ws is a flowjo_workspace fj_ws_get_samples(ws); ## End(Not run)
## Not run: #ws is a flowjo_workspace fj_ws_get_samples(ws); ## End(Not run)
Objects can be created by calls of the form new("flowjo_workspace.xml", ...)
.
doc
:Object of class "externalptr"
.
require(flowWorkspaceData) d<-system.file("extdata",package="flowWorkspaceData") wsfile<-list.files(d,pattern="A2004Analysis.xml",full=TRUE) ws <- open_flowjo_xml(wsfile); ws fj_ws_get_samples(ws)
require(flowWorkspaceData) d<-system.file("extdata",package="flowWorkspaceData") wsfile<-list.files(d,pattern="A2004Analysis.xml",full=TRUE) ws <- open_flowjo_xml(wsfile); ws fj_ws_get_samples(ws)
this function retrieves the gates from GatingSet and writes a customed GatingML-2.0 file that can be imported into cytobank.
gatingset_to_cytobank( gs, outFile, showHidden = FALSE, cytobank.default.scale = TRUE, ... )
gatingset_to_cytobank( gs, outFile, showHidden = FALSE, cytobank.default.scale = TRUE, ... )
gs |
a GatingSet object |
outFile |
a file name |
showHidden |
whether to include the hidden population nodes in the output |
cytobank.default.scale |
logical flag indicating whether to use the default Cytobank asinhtGml2 settings. Currently it should be set to TRUE in order for gates to be displayed properly in Cytobank because cytobank currently does not parse the global scale settings from GatingML. |
... |
rescale.gate default is TRUE. which means the gate is rescaled to the new scale that is understandable by cytobank. It is recommended not to change this behavior unless user wants to export to a gatingML file used for other purpose other than being imported into cytobank. |
The process can be divided into four steps: 1. Read in gate geometry, compensation and transformation from gatingSet 2. Rescale gate boundaries with flowjo_biexp() so gates can be displayed properly in Cytobank 3. Save gates and hierarchy structure to R environment 4. Write environment out to gatingML using write.GatingML()
nothing
library(flowWorkspace) dataDir <- system.file("extdata",package="flowWorkspaceData") gs <- load_gs(list.files(dataDir, pattern = "gs_manual",full = TRUE)) gs_pop_remove(gs, "CD8") #output to cytobank outFile <- tempfile(fileext = ".xml") gatingset_to_cytobank(gs, outFile) #type by default is 'cytobank'
library(flowWorkspace) dataDir <- system.file("extdata",package="flowWorkspaceData") gs <- load_gs(list.files(dataDir, pattern = "gs_manual",full = TRUE)) gs_pop_remove(gs, "CD8") #output to cytobank outFile <- tempfile(fileext = ".xml") gatingset_to_cytobank(gs, outFile) #type by default is 'cytobank'
It is a R wrapper for the docker app (https://hub.docker.com/r/rglab/gs-to-flowjo)
gatingset_to_flowjo(gs, outFile, showHidden = FALSE, docker_img = NULL, ...)
gatingset_to_flowjo(gs, outFile, showHidden = FALSE, docker_img = NULL, ...)
gs |
a GatingSet object or a folder contains the GatingSet archive (generated by previous |
outFile |
the workspace file path to write |
showHidden |
whether to export hidden gates. Default is FALSE |
docker_img |
the docker image that does the actual work |
... |
other arguments passed to |
Docker images for gatingset_to_flowjo
will be maintained at https://gallery.ecr.aws/x4k5d9i7/cytoverse/gs-to-wsp
docker pull public.ecr.aws/x4k5d9i7/cytoverse/gs-to-wsp:latest
nothing
## Not run: library(flowWorkspace) path <- system.file("extdata",package="flowWorkspaceData") gs_path <- list.files(path, pattern = "gs_manual",full = TRUE) gs <- load_gs(gs_path) #output to flowJo outFile <- tempfile(fileext = ".wsp") gatingset_to_flowjo(gs, outFile) #or directly use the archive as the input (to avoid the extra copying inside of the wrapper) gatingset_to_flowjo(gs_path, outFile) ## End(Not run)
## Not run: library(flowWorkspace) path <- system.file("extdata",package="flowWorkspaceData") gs_path <- list.files(path, pattern = "gs_manual",full = TRUE) gs <- load_gs(gs_path) #output to flowJo outFile <- tempfile(fileext = ".wsp") gatingset_to_flowjo(gs, outFile) #or directly use the archive as the input (to avoid the extra copying inside of the wrapper) gatingset_to_flowjo(gs_path, outFile) ## End(Not run)
get children nodes
## S4 method for signature 'graphGML,character' getChildren(obj, y)
## S4 method for signature 'graphGML,character' getChildren(obj, y)
obj |
|
y |
|
a graphNEL node
## Not run: g <- read.gatingML.cytobank(xmlfile) getChildren(g, "GateSet_722326") getParent(g, "GateSet_722326") ## End(Not run)
## Not run: g <- read.gatingML.cytobank(xmlfile) getChildren(g, "GateSet_722326") getParent(g, "GateSet_722326") ## End(Not run)
Extract compensation from graphGML object.
## S3 method for class 'graphGML' getCompensationMatrices(x)
## S3 method for class 'graphGML' getCompensationMatrices(x)
x |
graphGML |
compensation object or "FCS" when compensation comes from FCS keywords
get gate from the node
## S4 method for signature 'graphGML,character' getGate(obj, y)
## S4 method for signature 'graphGML,character' getGate(obj, y)
obj |
|
y |
|
the gate information associated with the node
get nodes from graphGML object
## S4 method for signature 'graphGML' getNodes(x, y, order = c("default", "bfs", "dfs", "tsort"), only.names = TRUE)
## S4 method for signature 'graphGML' getNodes(x, y, order = c("default", "bfs", "dfs", "tsort"), only.names = TRUE)
x |
|
y |
|
order |
|
only.names |
|
It returns the node names and population names by default. Or return the entire nodeData associated with each node.
## Not run: g <- read.gatingML.cytobank(xmlfile) getNodes(g) getNodes(g, only.names = FALSE) ## End(Not run)
## Not run: g <- read.gatingML.cytobank(xmlfile) getNodes(g) getNodes(g, only.names = FALSE) ## End(Not run)
get parent nodes
## S4 method for signature 'graphGML,character' getParent(obj, y)
## S4 method for signature 'graphGML,character' getParent(obj, y)
obj |
|
y |
|
a graphNEL node
Extract transformations from graphGML object.
## S3 method for class 'graphGML' getTransformations(x, ...)
## S3 method for class 'graphGML' getTransformations(x, ...)
x |
graphGML |
... |
not used |
transformerList object
Each node corresponds to a population(or GateSet) defined in gatingML file. The actual gate object (both global and tailored gates) is associated with each node as nodeData. Compensation and transformations are stored in graphData slot.
The class simply extends the graphNEL class and exists for the purpose of method dispatching.
compare the counts to cytobank's exported csv so that the parsing result can be verified.
gs_compare_cytobank_counts( gs, file, id.vars = c("FCS Filename", "population"), ... )
gs_compare_cytobank_counts( gs, file, id.vars = c("FCS Filename", "population"), ... )
gs |
parsed GatingSet |
file |
the stats file (contains the populatio counts) exported from cytobank. |
id.vars |
either "population" or "FCS filename" that tells whether the stats file format is one population per row or FCS file per row. |
... |
arguments passed to data.table::fread function |
a data.table (in long format) that contains the counts from openCyto and Cytobank side by side.
acsfile <- system.file("extdata/cytobank_experiment.acs", package = "CytoML") ce <- open_cytobank_experiment(acsfile) gs <- cytobank_to_gatingset(ce) ## verify the stats are correct statsfile <- ce$attachments[1] dt_merged <- gs_compare_cytobank_counts(gs, statsfile, id.vars = "population", skip = "FCS Filename") all.equal(dt_merged[, count.x], dt_merged[, count.y], tol = 5e-4)
acsfile <- system.file("extdata/cytobank_experiment.acs", package = "CytoML") ce <- open_cytobank_experiment(acsfile) gs <- cytobank_to_gatingset(ce) ## verify the stats are correct statsfile <- ce$attachments[1] dt_merged <- gs_compare_cytobank_counts(gs, statsfile, id.vars = "population", skip = "FCS Filename") all.equal(dt_merged[, count.x], dt_merged[, count.y], tol = 5e-4)
Given the leaf node, try to find out if a collection of nodes can be matched to a path in a graph(tree) by the bottom-up searching
matchPath(g, leaf, nodeSet)
matchPath(g, leaf, nodeSet)
g |
graphNEL |
leaf |
the name of leaf(terminal) node |
nodeSet |
a set of node names |
TRUE if path is found, FALSE if not path is matched.
cytobank_experiment
object from ACS fileConstruct a cytobank_experiment
object from ACS file
open_cytobank_experiment(acs, exdir = tempfile())
open_cytobank_experiment(acs, exdir = tempfile())
acs |
ACS file exported from Cytobank |
exdir |
he directory to extract files to |
cytobank_experiment object
open Diva xml workspace
open_diva_xml(file, options = 0, ...)
open_diva_xml(file, options = 0, ...)
file |
xml file |
options |
argument passed to xmlTreeParse |
... |
arguments passed to xmlTreeParse |
a diva_workspace
object
## Not run: library(flowWorkspace) library(CytoML) ws <- open_diva_xml(system.file('extdata/diva/PE_2.xml', package = "flowWorkspaceData")) ws diva_get_sample_groups(ws) gs <- diva_to_gatingset(ws, name = 2, subset = 1) sampleNames(gs) gs_get_pop_paths(gs) plotGate(gs[[1]]) ## End(Not run)
## Not run: library(flowWorkspace) library(CytoML) ws <- open_diva_xml(system.file('extdata/diva/PE_2.xml', package = "flowWorkspaceData")) ws diva_get_sample_groups(ws) gs <- diva_to_gatingset(ws, name = 2, subset = 1) sampleNames(gs) gs_get_pop_paths(gs) plotGate(gs[[1]]) ## End(Not run)
Open a flowJo workspace and return a flowjo_workspace
object.
Close a flowjo_workspace, destroying the internal representation of the XML document, and freeing the associated memory.
open_flowjo_xml(file, options = 0, sample_names_from = "keyword", ...)
open_flowjo_xml(file, options = 0, sample_names_from = "keyword", ...)
file |
Full path to the XML flowJo workspace file. |
options |
xml parsing options passed to |
sample_names_from |
character specifying where in the XML workspace file to obtain the sample names, either "keyword" for the included $FIL keyword for each sample, or "sampleNode" for the name of the sample node |
... |
not used |
Open an XML flowJo workspace file and return a flowjo_workspace
object. The workspace is represented using a XMLInternalDocument
object.
Close a flowJoWorkpsace after finishing with it. This is necessary to explicitly clean up the C-based representation of the XML tree. (See the XML package).
a flowjo_workspace
object.
## Not run: file<-"myworkspace.xml" ws<-open_flowjo_xml(file); ws ## End(Not run)
## Not run: file<-"myworkspace.xml" ws<-open_flowjo_xml(file); ws ## End(Not run)
Fcs filename and gate name stored in 'custom_info' element are beyong the scope of the gatingML standard and thus not covered by the default 'read.gatingML'.
parse.gateInfo(file, ...)
parse.gateInfo(file, ...)
file |
xml file path |
... |
additional arguments passed to the handlers of 'xmlTreeParse' |
a data.frame that contains three columns: id (gateId), name (gate name), fcs (fcs_file_filename).
Function to parse a flowJo Workspace, generate a GatingHierarchy
or GatingSet
object, and associated flowCore gates. The data are not loaded or acted upon until an explicit call to recompute()
is made on the GatingHierarchy
objects in the GatingSet
.
parseWorkspace(obj, ...) ## S4 method for signature 'flowjo_workspace' parseWorkspace(obj, ...) flowjo_to_gatingset( ws, name = NULL, subset = list(), execute = TRUE, path = "", cytoset = NULL, backend_dir = tempdir(), backend = get_default_backend(), includeGates = TRUE, additional.keys = "$TOT", additional.sampleID = FALSE, keywords = character(), keywords.source = "XML", keyword.ignore.case = FALSE, extend_val = 0, extend_to = -4000, channel.ignore.case = FALSE, leaf.bool = TRUE, include_empty_tree = FALSE, skip_faulty_gate = FALSE, compensation = NULL, transform = TRUE, fcs_file_extension = ".fcs", greedy_match = FALSE, mc.cores = 1, ... )
parseWorkspace(obj, ...) ## S4 method for signature 'flowjo_workspace' parseWorkspace(obj, ...) flowjo_to_gatingset( ws, name = NULL, subset = list(), execute = TRUE, path = "", cytoset = NULL, backend_dir = tempdir(), backend = get_default_backend(), includeGates = TRUE, additional.keys = "$TOT", additional.sampleID = FALSE, keywords = character(), keywords.source = "XML", keyword.ignore.case = FALSE, extend_val = 0, extend_to = -4000, channel.ignore.case = FALSE, leaf.bool = TRUE, include_empty_tree = FALSE, skip_faulty_gate = FALSE, compensation = NULL, transform = TRUE, fcs_file_extension = ".fcs", greedy_match = FALSE, mc.cores = 1, ... )
obj |
flowjo_workspace |
... |
Additional arguments to be passed to FCS parser |
ws |
A |
name |
|
subset |
|
execute |
|
path |
either a |
cytoset |
a |
includeGates |
|
additional.keys |
|
additional.sampleID |
|
keywords |
|
keywords.source |
|
keyword.ignore.case |
a |
extend_val |
|
extend_to |
|
channel.ignore.case |
a |
leaf.bool |
a |
include_empty_tree |
a |
skip_faulty_gate |
a |
compensation |
a |
transform |
|
fcs_file_extension |
default is ".fcs" |
greedy_match |
|
mc.cores |
|
h5_dir |
the path to write h5 data |
A flowjo_workspace is generated with a call to open_flowjo_xml()
, passing the name of the xml workspace file. This returns a flowjo_workspace
, which can be parsed using the flowjo_to_gatingset()
method. The function can be called non-interactively by passing the index or name of the group of samples to be imported via flowjo_to_gatingset(obj,name=x)
, where x
is either the numeric index, or the name.
The subset
argument allows one to select a set of files from the chosen sample group. The routine will take the intersection of the files in the sample group, the files specified in subset
and the files available on disk, and import them.
a GatingSet
, which is a wrapper around a list of GatingHierarchy
objects, each representing a single sample in the workspace. The GatingHierarchy
objects contain graphNEL
trees that represent the gating hierarchy of each sample. Each node in the GatingHierarchy
has associated data, including the population counts from flowJo, the parent population counts, the flowCore
gates generated from the flowJo workspace gate definitions. Data are not yet loaded or acted upon at this stage. To execute the gating of each data file, a call to execute()
must be made on each GatingHierarchy
object in the GatingSet
. This is done automatically by default, and there is no more reason to set this argument to FALSE.
fj_ws_get_sample_groups
,GatingSet
## Not run: #f is a xml file name of a flowJo workspace ws <- open_flowjo_xml(f) #parse the second group gs <- flowjo_to_gatingset(ws, name = 2); #assume that the fcs files are under the same folder as workspace gs <- flowjo_to_gatingset(ws, name = 4 , path = dataDir #specify the FCS path , subset = "CytoTrol_CytoTrol_1.fcs") #subset the parsing by FCS filename gs <- flowjo_to_gatingset(ws, path = dataDir, name = 4 , keywords = c("PATIENT ID", "SAMPLE ID", "$TOT", "EXPERIMENT NAME") #tell the parser to extract keywords as pData , keywords.source = "XML" # keywords are extracted from xml workspace (alternatively can be set to "FCS") , additional.keys = c("PATIENT ID") #use additional keywords together with FCS filename to uniquely identify samples , execute = F) # parse workspace without the actual gating (can save time if just want to get the info from xml) #subset by pData (extracted from keywords) gs <- flowjo_to_gatingset(ws, path = dataDir, name = 4 , subset = `TUBE NAME` %in% c("CytoTrol_1", "CytoTrol_2") , keywords = "TUBE NAME") #overide the default compensation defined in xml with the customized compenstations gs <- flowjo_to_gatingset(ws, name = 2, compensation = comps); #comp is either a compensation object or a list of compensation objects ## End(Not run)
## Not run: #f is a xml file name of a flowJo workspace ws <- open_flowjo_xml(f) #parse the second group gs <- flowjo_to_gatingset(ws, name = 2); #assume that the fcs files are under the same folder as workspace gs <- flowjo_to_gatingset(ws, name = 4 , path = dataDir #specify the FCS path , subset = "CytoTrol_CytoTrol_1.fcs") #subset the parsing by FCS filename gs <- flowjo_to_gatingset(ws, path = dataDir, name = 4 , keywords = c("PATIENT ID", "SAMPLE ID", "$TOT", "EXPERIMENT NAME") #tell the parser to extract keywords as pData , keywords.source = "XML" # keywords are extracted from xml workspace (alternatively can be set to "FCS") , additional.keys = c("PATIENT ID") #use additional keywords together with FCS filename to uniquely identify samples , execute = F) # parse workspace without the actual gating (can save time if just want to get the info from xml) #subset by pData (extracted from keywords) gs <- flowjo_to_gatingset(ws, path = dataDir, name = 4 , subset = `TUBE NAME` %in% c("CytoTrol_1", "CytoTrol_2") , keywords = "TUBE NAME") #overide the default compensation defined in xml with the customized compenstations gs <- flowjo_to_gatingset(ws, name = 2, compensation = comps); #comp is either a compensation object or a list of compensation objects ## End(Not run)
The node with dotted order represents the population that has tailored gates (sample-specific gates) defined.
## S4 method for signature 'graphGML,missing' plot(x, y = "missing", label = c("popName", "gateName"))
## S4 method for signature 'graphGML,missing' plot(x, y = "missing", label = c("popName", "gateName"))
x |
a graphNEL generated by constructTree function |
y |
not used |
label |
specifies what to be dispaled as node label. Can be either 'popName' (population name parsed from GateSets) or 'gateName'(the name of the actual gate associated with each node) |
nothing
## Not run: g <- read.gatingML.cytobank(xmlfile) plot(g) ## End(Not run)
## Not run: g <- read.gatingML.cytobank(xmlfile) plot(g) ## End(Not run)
the parameter range from the flow data associated with GatingHierarchy
## S3 method for class 'GatingHierarchy' range(..., na.rm = FALSE, type = c("instrument", "data"), raw.scale = FALSE)
## S3 method for class 'GatingHierarchy' range(..., na.rm = FALSE, type = c("instrument", "data"), raw.scale = FALSE)
... |
GatingHierarchy object |
na.rm |
not used |
type |
character of "instrument" or "data" indicating whether to retrieve the instrument or the actual data range |
raw.scale |
logical whether convert the range from transformed scale to raw scale |
matrix
## Not run: range(gh, type = "data")#return data range range(gh) #return instrument range range(gh, raw.scale = TRUE) #inverse transform the range to the raw scale ## End(Not run)
## Not run: range(gh, type = "data")#return data range range(gh) #return instrument range range(gh, raw.scale = TRUE) #inverse transform the range to the raw scale ## End(Not run)
The Default parser (read.gatingML) does not parse the population tree as well as the custom information from cytobank. (e.g. gate name, fcs filename).
read.gatingML.cytobank(file, ...)
read.gatingML.cytobank(file, ...)
file |
Gating-ML XML file |
... |
additional arguments passed to the handlers of 'xmlTreeParse' |
a graphGML that represents the population tree. The gate and population name are stored in nodeData of each node. Compensation and transformations are stored in graphData.
## Not run: g <- read.gatingML.cytobank(xml) #parse the population tree #plot(g) #visualize it ## End(Not run)
## Not run: g <- read.gatingML.cytobank(xml) #parse the population tree #plot(g) #visualize it ## End(Not run)
show method for graphGML
## S4 method for signature 'graphGML' show(object)
## S4 method for signature 'graphGML' show(object)
object |
|
nothing