PlotPies {FlowSOM} | R Documentation |
Plot FlowSOM grid or tree, with pies indicating another clustering or manual gating result
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 = "" )
fsom |
FlowSOM object, as generated by |
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 |
legend |
Logicle, if T add a legend |
main |
Title of the plot |
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.
PlotStars
,PlotMarker
,
PlotCenters
,BuildMST
#' # 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)