PlotPies {FlowSOM} | R Documentation

## Plot comparison with other clustering

### Description

Plot FlowSOM grid or tree, with pies indicating another clustering or manual gating result

### Usage

    PlotPies(
      fsom,
      cellTypes,
      view = "MST",
      colorPalette = grDevices::colorRampPalette(c("white", "#00007F", "blue", "#007FFF",
        "cyan", "#7FFF7F", "yellow", "#FF7F00", "red")),
      backgroundValues = NULL,
      backgroundColor = function(n) {     grDevices::rainbow(n, alpha = 0.3) },
      backgroundLim = NULL,
      backgroundBreaks = NULL,
      legend = TRUE,
      main = ""
    )

### Arguments

`fsom` | FlowSOM object, as generated by `BuildMST`
`cellTypes` | Array of factors indicating the celltypes
`view` | Preferred view, options: "MST", "grid" or "tSNE" (if this option was selected while building the MST)
`colorPalette` | Colorpalette to be used for the markers
`backgroundValues` | Values to be used for background coloring, either numerical values or something that can be made into a factor (e.g. a clustering)
`backgroundColor` | Colorpalette to be used for the background coloring . Can be either a function or an array specifying colors
`backgroundLim` | Only used when backgroundValues are numerical. Defaults to min and max of the backgroundValues.
`backgroundBreaks` | Breaks to pass on to `cut`, to split numerical background values. If NULL, the length of backgroundColor will be used (default 100).
`legend` | Logicle, if T add a legend
`main` | Title of the plot

### Value

Nothing is returned. A plot is drawn in which each node is represented by a pie chart indicating the percentage of cells present of each cell type. At the end, the layout is set to 1 figure again.

### See Also

`PlotStars`,`PlotMarker`, `PlotCenters`,`BuildMST`

### 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
    cell_types <- 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,
                                    cell_types = cell_types)

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

    # Build a FlowSOM tree
    flowSOM.res <- FlowSOM(fcs_file,
                           compensate = TRUE,
                           transform = TRUE,
                           toTransform = 8:18,
                           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)

[Package FlowSOM version 1.19.4 Index]