Skip to contents

This function performs FlowSOM clustering on high-dimensional cytometry data using a user-specified selection of input variables/high-dimensional cytometry measurements. It is mostly a convenient wrapper around SOM and MetaClustering.

Usage

tof_cluster_flowsom(
  tof_tibble = NULL,
  cluster_cols = where(tof_is_numeric),
  som_xdim = 10,
  som_ydim = 10,
  som_distance_function = c("euclidean", "manhattan", "chebyshev", "cosine"),
  perform_metaclustering = TRUE,
  num_metaclusters = 20,
  ...
)

Arguments

tof_tibble

A `tof_tbl` or `tibble`.

cluster_cols

Unquoted column names indicating which columns in `tof_tibble` to use in computing the flowSOM clusters. Defaults to all numeric columns in `tof_tibble`. Supports tidyselect helpers.

som_xdim

The width of the grid used by the self-organizing map. The total number of clusters returned by FlowSOM will be som_xdim * som_ydim, so adjust this value to affect the final number of clusters. Defaults to 10.

som_ydim

The height of the grid used by the self-organizing map. The total number of clusters returned by FlowSOM will be som_xdim * som_ydim, so adjust this value to affect the final number of clusters. Defaults to 10.

som_distance_function

The distance function used during self-organizing map calculations. Options are "euclidean" (the default), "manhattan", "chebyshev", and "cosine".

perform_metaclustering

A boolean value indicating if metaclustering should be performed on the initial clustering result returned by FlowSOM. Defaults to TRUE.

num_metaclusters

An integer indicating the maximum number of metaclusters that should be returned after metaclustering. Defaults to 20.

...

Optional additional parameters that can be passed to the BuildSOM function.

Value

A tibble with one column named `.flowsom_cluster` or `.flowsom_metacluster` depending on the value of `perform_metaclustering`. The column will contain an integer vector of length `nrow(tof_tibble)` indicating the id of the flowSOM cluster to which each cell (i.e. each row) in `tof_tibble` was assigned.

Details

For additional details about the FlowSOM algorithm, see this paper.

See also

Examples

sim_data <-
    dplyr::tibble(
        cd45 = rnorm(n = 200),
        cd38 = rnorm(n = 200),
        cd34 = rnorm(n = 200),
        cd19 = rnorm(n = 200)
    )

tof_cluster_flowsom(tof_tibble = sim_data, cluster_cols = c(cd45, cd19))
#> # A tibble: 200 × 1
#>    .flowsom_metacluster
#>    <chr>               
#>  1 10                  
#>  2 10                  
#>  3 8                   
#>  4 5                   
#>  5 10                  
#>  6 15                  
#>  7 6                   
#>  8 8                   
#>  9 15                  
#> 10 2                   
#> # ℹ 190 more rows