GetFlowJoLabels: Process a flowjo workspace file

Description Usage Arguments Value See Also Examples

View source: R/0_FlowSOM.R

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

1
2
3
4
5
6
7
8
GetFlowJoLabels(
  files,
  wsp_file,
  group = "All Samples",
  cell_types = NULL,
  get_data = FALSE,
  ...
)

Arguments

files

The fcs files of interest

wsp_file

The FlowJo wsp file to read

group

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

cell_types

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

get_data

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Identify the files
fcs_file <- system.file("extdata", "68983.fcs", package = "FlowSOM")
wsp_file <- system.file("extdata", "gating.wsp", package = "FlowSOM")

# Specify the cell types of interest for assigning one label per cell
cell_types <- 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, wsp_file,
                                cell_types = cell_types,
                                get_data = 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$FlowSOM,
          gatingResult$manual,
          backgroundValues = flowSOM.res$metaclustering)

FlowSOM documentation built on Nov. 8, 2020, 6:40 p.m.