clustering: Clustering

View source: R/clustering.R

clusteringR Documentation

Clustering

Description

clustering currently implements two methods. The first approach groups cells into xdimxydim clusters using FlowSOM, and then performs metaclustering with ConsensusClusterPlus into maxK clusters. The second approach performs dimention reduction through UMAP, constructs shared nearest-neighbor graphs using scran, and then performs community detection using the Leuvein algorithm in igraph. In both cases, an SingleCellExperiment object with a 'cluster_id' column is returned.
clustering_with_masking performs a preliminary clustering and prompts the user to provide the clusters to be masked. The median expression value heatmap will be generated by plotClusterHeatmap. Then the function performs the main clustering only using the non-masked cells. The masked cells will be assigned to a cluster ID of zero.

Usage

clustering(
  sce,
  features = rownames(sce),
  by_exprs_values = "normexprs",
  method = "FlowSOM",
  xdim = 20,
  ydim = 20,
  maxK = 40,
  n_components = min(c(10, length(features))),
  n_neighbors = 10,
  min_dist = 0.1,
  seed = 12345
)

clustering_with_masking(
  sce,
  features = rownames(sce),
  features_masking = rownames(sce),
  by_exprs_values = "normexprs",
  method = "FlowSOM",
  xdim = 20,
  ydim = 20,
  maxK = 40,
  n_components = min(c(10, length(features))),
  n_neighbors = 10,
  min_dist = 0.1,
  seed = 12345
)

Arguments

sce

A SingleCellExperiment object.

features

A character vector. Specifies which antigens to use for clustering.

by_exprs_values

A character string. Specifies which assay data to use for clustering.

method

A character string. Specifies which clustering method to use. Currently, either "FlowSOM" or "SNNGraph" is supported.

xdim, ydim

Numeric. Specifies the grid size of the self-orginizing map. For example, 20x20 grid will yield 400 clusters.

maxK

Numeric. Specifies the maximum number of clusters to evaluate in the metaclustering. For maxK = 40, for example, metaclustering will be performed to obtain 40 clusters.

n_components, n_neighbors, min_dist

Specifies parameters for UMAP and SNN-graph construction.

seed

Numeric. Sets a random seed.

features_masking

A character vector. Specifies which antigens to use for the preliminary masking.

Value

A SingleCellExperiment-class object with a 'cluster_id' column. Masked cells are assigned to the cluster 0.


casanova-lab/iMUBAC documentation built on Sept. 13, 2022, 6:36 p.m.