GetFlowJoLabels: Process a FlowJo workspace file

View source: R/0_FlowSOM.R

GetFlowJoLabelsR Documentation

Process a FlowJo workspace file

Description

Reads a FlowJo workspace file using the flowWorkspace library and returns a list with a matrix containing gating results and a vector with a label for each cell from a set of specified gates

Usage

GetFlowJoLabels(
  files,
  wspFile,
  group = "All Samples",
  cellTypes = NULL,
  getData = FALSE,
  ...
)

Arguments

files

The FCS files of interest

wspFile

The FlowJo wsp file to read

group

The FlowJo group to parse. Default "All Samples".

cellTypes

Cell types to use for final labeling the cells. Should correspond with a subset of the gate names in FlowJo.

getData

If true, flowFrames are returned as well.

...

Extra arguments to pass to CytoML::flowjo_to_gatingset

Value

This function returns a list, which for every file contains a list in which the first element ("matrix") is a matrix containing filtering results for each specified gate and the second element ("manual") is a vector which assigns one label to each cell. If only one file is given, only one list is returned instead of a list of lists.

See Also

PlotPies

Examples


# Identify the files
fcs_file <- system.file("extdata", "68983.fcs", package = "FlowSOM")
wspFile <- system.file("extdata", "gating.wsp", package = "FlowSOM")

# Specify the cell types of interest for assigning one label per cell
cellTypes <- c("B cells",
                "gd T cells", "CD4 T cells", "CD8 T cells",
                "NK cells", "NK T cells")

# Parse the FlowJo workspace   
gatingResult <- GetFlowJoLabels(fcs_file, wspFile,
                                cellTypes = cellTypes,
                                getData = TRUE)

# Check the number of cells assigned to each gate
colSums(gatingResult$matrix)

# Build a FlowSOM tree
flowSOM.res <- FlowSOM(gatingResult$flowFrame,
                       colsToUse = c(9, 12, 14:18),
                       nClus = 10,
                       seed = 1)
   
 # Plot pies indicating the percentage of cell types present in the nodes
 PlotPies(flowSOM.res,
          gatingResult$manual,
          backgroundValues = flowSOM.res$metaclustering)


SofieVG/FlowSOM documentation built on Feb. 1, 2024, 11:33 a.m.