Skip to contents

This function is a helper to generate a list of cell type to cell marker annotations that can be fed into for example [REF].

Usage

prepare_cell_markers(obj, marker_df)

Arguments

obj

A single cell class, i.e. one of SingleCells or SingleCellsMultiModal.

marker_df

A data.table with the columns "cell_type" and "gene_id". You need to ensure that the gene id type matches the obj gene id.

Value

A list of cell type to marker associations ready for subsequent usage. Genes not found in the object will be automatically removed.

Examples

# a marker table turned into the indexed list the scorers want
sc <- demo_single_cells(prepped = FALSE)
markers <- data.table::data.table(
  cell_type = c("type_a", "type_a", "type_b"),
  gene_id = get_gene_names(sc)[1:3]
)
names(prepare_cell_markers(sc, markers))
#> [1] "type_a" "type_b"

unlink(sc@dir_data, recursive = TRUE, force = TRUE)