Learn R Programming

FlowSOM (version 1.4.0)

PlotPies: 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) }, 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
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

Run this code
   # Read from file, build self-organizing map and minimal spanning tree
   fileName <- system.file("extdata","lymphocytes.fcs",package="FlowSOM")
   flowSOM_res <- FlowSOM(fileName, compensate=TRUE,transform=TRUE,
                            scale=TRUE,colsToUse=c(9,12,14:18),nClus=7)
   ff <- flowCore::read.FCS(fileName)
   ff_c <- flowCore::compensate(ff,flowCore::description(ff)$SPILL)
   flowCore::colnames(ff_c)[8:18] <- paste("Comp-",
                                     flowCore::colnames(ff_c)[8:18],
                                     sep="")
   
   # Get the manually gated labels using a gatingML file 
   gatingFile <- system.file("extdata","manualGating.xml", 
                             package="FlowSOM")
   gateIDs <- c( "B cells"=8,
                 "ab T cells"=10,
                 "yd T cells"=15,
                 "NK cells"=5,
                 "NKT cells"=6)
   cellTypes <- c("B cells","ab T cells","yd T cells",
                 "NK cells","NKT cells")
   gatingResult <- ProcessGatingML(ff_c, gatingFile, gateIDs, cellTypes)
       
   
   # Plot pies indicating the percentage of cell types present in the nodes
   PlotPies(flowSOM_res[[1]],gatingResult$manual)

Run the code above in your browser using DataLab