PlotDimRed {FlowSOM}R Documentation

PlotDimRed

Description

Plot a dimensionality reduction

Usage

PlotDimRed(
  fsom,
  colsToUse = fsom$map$colsUsed,
  colorBy = "metaclusters",
  cTotal = NULL,
  dimred = Rtsne::Rtsne,
  extractLayout = function(dimred) {     dimred$Y },
  label = TRUE,
  returnLayout = FALSE,
  seed = NULL,
  title = NULL,
  ...
)

Arguments

fsom

FlowSOM object, as generated by BuildMST

colsToUse

The columns used for the dimensionality reduction. Default = fsom$map$colsUsed.

colorBy

Defines how the dimensionality reduction will be colored. Can be "metaclusters" (default), "clusters" or a marker/channel/index.

cTotal

The total amount of cells to be used in the dimensionality reduction. Default is all the cells.

dimred

A dimensionality reduction function. Default = Rtsne::Rtsne. Alternatively, a data.frame or matrix with either equal number of rows to the fsom or an OriginalID column. Recommended to put cTotal to NULL when providing a matrix (or ensuring that the dimred corresponds to subsampling the flowSOM data for cTotal cells with the same seed).

extractLayout

A function to extract the coordinates from the results of the dimred default = function(dimred)dimred$Y.

label

If label = TRUE (default), labels are added to plot.

returnLayout

If TRUE, this function returns a dataframe with the layout of dimred and the original IDs and the plot. Default = FALSE.

seed

A seed for reproducibility.

title

A title for the plot.

...

Additional arguments to pass to dimred.

Details

Plot a dimensionality reduction of fsom$data

Value

A dimensionality reduction plot made in ggplot2

Examples

   file <- system.file("extdata", "68983.fcs", package="FlowSOM")
   flowSOM.res <- FlowSOM(file, compensate = TRUE, transform = TRUE, 
                  scale = TRUE,
                  colsToUse = c(9, 12, 14:18), nClus = 10, silent = FALSE,
                  xdim = 7, ydim = 7)
   PlotDimRed(flowSOM.res, cTotal = 5000, seed = 1, title = "t-SNE")
   PlotDimRed(flowSOM.res, cTotal = 5000, colorBy = "CD3", seed = 1, 
              title = "t-SNE")
   

[Package FlowSOM version 2.0.0 Index]