Skip to contents

Given a supercell object, recreate the supercells using a different gamma value.

Gamma value controls the number of supercells generated. The smaller the value, the more supercells you get, and vice versa.

For this function to run, you need to have at least run runSuperCellCyto function once!

Usage

recomputeSupercells(
  dt,
  sc_objects,
  markers,
  sample_colname,
  cell_id_colname,
  gam = 20
)

Arguments

dt

A data.table object containing cytometry data where rows represent cells and columns represent markers.

sc_objects

The supercell_object returned by runSuperCellCyto function.

markers

A character vector identifying the markers to create supercells with.

sample_colname

A character string identifying the column in dt that denotes the sample of a cell.

cell_id_colname

A character string identifying the column in dt representing each cell's unique ID.

gam

A numeric value specifying the gamma value which regulates the number of supercells generated. Defaults to 20.

Value

A list with the following components:

  • supercell_expression_matrix: A data.table object that contains the marker expression for each supercell. These marker expressions are computed by calculating the mean of the marker expressions across all cells within each individual supercell.

  • supercell_cell_map: A data.table that maps each cell to its corresponding supercell. This table is essential for identifying the specific supercell each cell has been allocated to. It proves particularly useful for analyses that require one to expand the supercells to the individual cell level.

Author

Givanna Putri

Examples

set.seed(42)
cyto_dat <- simCytoData(10, rep(1000, 3))
markers <- paste0("Marker_", seq_len(10))
out_gam20 <- runSuperCellCyto(
    dt = cyto_dat,
    markers = markers,
    sample_colname = "Sample",
    cell_id_colname = "Cell_Id",
    gam = 20
)
recomputed_sc <- recomputeSupercells(
    dt = cyto_dat,
    sc_objects = out_gam20$supercell_object,
    markers = markers,
    sample_colname = "Sample",
    cell_id_colname = "Cell_Id",
    gam = 50
)