FlowSOM: Run the FlowSOM algorithm

View source: R/0_FlowSOM.R

FlowSOMR Documentation

Run the FlowSOM algorithm

Description

Method to run general FlowSOM workflow. Will scale the data and uses consensus meta-clustering by default.

Usage

FlowSOM(
  input,
  pattern = ".fcs",
  compensate = FALSE,
  spillover = NULL,
  transform = FALSE,
  toTransform = NULL,
  transformFunction = flowCore::logicleTransform(),
  transformList = NULL,
  scale = FALSE,
  scaled.center = TRUE,
  scaled.scale = TRUE,
  silent = TRUE,
  colsToUse = NULL,
  nClus = 10,
  maxMeta = NULL,
  importance = NULL,
  seed = NULL,
  ...
)

Arguments

input

a flowFrame, a flowSet, a matrix with column names or an array of paths to files or directories

pattern

if input is an array of file- or directorynames, select only files containing pattern

compensate

logical, does the data need to be compensated

spillover

spillover matrix to compensate with If NULL and compensate = TRUE, we will look for $SPILL description in FCS file.

transform

logical, does the data need to be transformed with the transformation given in transformFunction.

toTransform

column names or indices that need to be transformed. Will be ignored if transformList is given. If NULL and transform = TRUE, column names of $SPILL description in FCS file will be used.

transformFunction

Defaults to logicleTransform()

transformList

transformList to apply on the samples.

scale

logical, does the data needs to be rescaled. Default = FALSE

scaled.center

see scale

scaled.scale

see scale

silent

if TRUE, no progress updates will be printed

colsToUse

Markers, channels or indices to use for building the SOM. Default (NULL) is all the columns used to build the FlowSOM object.

nClus

Exact number of clusters for meta-clustering. Ignored if maxMeta is specified. Default = 10.

maxMeta

Maximum number of clusters to try out for meta-clustering. If NULL (default), only one option will be computed (nClus).

importance

array with numeric values. Parameters will be scaled according to importance

seed

Set a seed for reproducible results

...

options to pass on to the SOM function (xdim, ydim, rlen, mst, alpha, radius, init, distf)

Value

A list with two items: the first is the flowSOM object containing all information (see the vignette for more detailed information about this object), the second is the metaclustering of the nodes of the grid. This is a wrapper function for ReadInput, BuildSOM, BuildMST and MetaClustering. Executing them separately may provide more options.

See Also

scale, ReadInput, BuildSOM, BuildMST, MetaClustering

Examples

# Read from file
fileName <- system.file("extdata", "68983.fcs", package = "FlowSOM")
flowSOM.res <- FlowSOM(fileName, compensate = TRUE, transform = TRUE,
                      scale = TRUE, colsToUse = c(9, 12, 14:18), nClus = 10)
# Or read from flowFrame object
ff <- flowCore::read.FCS(fileName)
ff <- flowCore::compensate(ff, flowCore::keyword(ff)[["SPILL"]])
ff <- flowCore::transform(ff,
         flowCore::transformList(colnames(flowCore::keyword(ff)[["SPILL"]]),
                                flowCore::logicleTransform()))
flowSOM.res <- FlowSOM(ff, 
                       scale = TRUE, 
                       colsToUse = c(9, 12, 14:18), 
                       nClus = 10)

# Plot results
PlotStars(flowSOM.res,
          backgroundValues = flowSOM.res$metaclustering)

# Get metaclustering per cell
flowSOM.clustering <- GetMetaclusters(flowSOM.res)


SofieVG/FlowSOM documentation built on Feb. 1, 2024, 11:33 a.m.