PlotManualBars {FlowSOM} | R Documentation

## PlotManualBars

### Description

Function to plot the manual labels per FlowSOM (meta)cluster in a barplot

### Usage

    PlotManualBars(
      fsom,
      fcs = NULL,
      manualVector,
      manualOrder = NULL,
      colors = NULL,
      list_insteadof_plots = FALSE
    )

### Arguments

`fsom` | FlowSOM object, as generated by `FlowSOM` or by `NewData`. The clusters and metaclsuters will be plotted in the order of the factor levels.
`fcs` | Fcs file that should be mapped on the FlowSOM object. Default is NULL.
`manualVector` | Vector with cell labels, e.g. obtained by manual gating
`manualOrder` | Optional vector with unique cell labels to fix in which order the cell labels should be shown
`colors` | Optional color vector, should have the same length as the number of unque cell labels
`list_insteadof_plots` | If `FALSE` (default), it returns multiple plots. If `TRUE`, it returns a list of ggplot objects

### Value

Either a plot or a ggplot objects list is returned.

### Examples

    # 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
    cellTypes <- c("B cells",
                    "gd T cells", "CD4 T cells", "CD8 T cells",
                    "NK cells", "NK T cells")

    # Parse the FlowJo workspace
    library(flowWorkspace)
    gatingResult <- GetFlowJoLabels(fcs_file, wsp_file,
                                    cellTypes = cellTypes)

    # Build a FlowSOM object
    flowSOM.res <- FlowSOM(fcs_file,
                           scale = TRUE,
                           compensate = TRUE,
                           transform = TRUE,
                           toTransform = 8:18,
                           colsToUse = c(9, 12, 14:18),
                           nClus = 10,
                           seed = 1)

    # Make the barplot of the manual labels
    pdf("PlotManualBars.pdf")
    PlotManualBars(fsom = flowSOM.res,
                   fcs = fcs_file,
                   manualVector = gatingResult$manual,
                   manualOrder = c(cellTypes, "Unlabeled"),
                   colors = c("#F8766D", "#B79F00", "#00BA38", "#00BFC4",
                              "#619CFF", "#F564E3", "#D3D3D3"))
    dev.off()

[Package FlowSOM version 2.2.0 Index]