Skip to contents

This function implements the meta cell aggregation from Bilous, et al. The core idea is to use the walktrap community detection on the kNN graph. For details, please refer to the paper.

Usage

generate_supercells_sc(
  object,
  sc_supercell_params = params_sc_supercell(),
  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_supercell_params

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

  • walk_length - Integer. Walk length for the Walktrap algorithm.

  • graining_factor - Numeric. Graining level of data (proportion of number of single cells in the initial dataset to the number of metacells in the final dataset)

  • linkage_dist - String. Which type of distance metric to use for the linkage. Defaults to "complete".

  • 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

Bilous, et al. BMC Bioinform., 2022