Skip to contents

This function implements the meta cell aggregation from Morabito, et al. The generation of metacells is a useful approach for subsequent application of for example correlation-based methods to identify co-regulated genes.

Usage

generate_meta_cells_sc(
  object,
  sc_meta_cell_params = params_sc_metacells(),
  regenerate_knn = FALSE,
  embd_to_use = "pca",
  no_embd_to_use = NULL,
  cells_to_use = NULL,
  target_size = 1e+05,
  seed = 42L,
  .verbose = TRUE
)

Arguments

object

SingleCells class.

sc_meta_cell_params

List. Output of params_sc_metacells(). A list with the following items:

  • max_shared - Maximum number of allowed shared neighbours for the meta cell to be considered.

  • target_no_metacells - Number of target meta cells you wish to reach.

  • max_iter - Maximum number of iterations you want to use for the algorithm.

  • knn - List of kNN parameters. See params_knn_defaults() for available parameters and their defaults.

regenerate_knn

Boolean. Shall a kNN graph be regenerated.

embd_to_use

String. The embedding to use. Only relevant if you set regenerate_knn to TRUE.

no_embd_to_use

Optional integer. Number of embedding dimensions to use. If NULL all will be used. Only relevant if you set regenerate_knn to TRUE.

cells_to_use

Optional string. Names of the cells to use for the generation of the meta-cells. If provided, this function will regenerate the kNN graph no matter what.

target_size

Numeric. The library target size to normalise the meta cells to.

seed

Integer. Seed for reproducibility.

.verbose

Boolean. Controls verbosity of the function.

Value

A MetaCells() with the data generated by this meta cell aggregation method.

References

Morabito, et al. Cell Rep Methods, 2023