Skip to contents

This function can recover SEs from scRNA-seq data or single-cell spatial data by assigning each single cell to an SE or NonSE.

Usage

RecoverSE(
  dat,
  celltypes = NULL,
  scale = TRUE,
  ncell.per.run = 500,
  Ws = NULL,
  ncores = 1,
  se_results = NULL
)

Arguments

dat

A numeric (sparse) matrix of gene expression data, from single-cell spatial transcriptomics or scRNA-seq data.

celltypes

Character vector specifying the cell type annotations for cells included in the gene expression `dat`. If you're using the default model, cell types like B, CD4T, CD8T, NK, Plasma, Macrophage, DC, Fibroblast, Endothelial are expected.

scale

Logical indicating whether to perform unit-variance normalization (default: TRUE). Change it with caution.

ncell.per.run

Integer specifying the maximum number of cells per NMF prediction run to avoid memory issues.

Ws

A list of cell-type-specific W matrices used to recover SE-specific cell states. Each element in the list should be named after the corresponding cell type and contain a W matrix from an NMF model.

ncores

Integer specifying the number of CPU cores to use for parallel processing (default: 1).

se_results

A list including a seurat object and a metadata with spatial cluster annotations (SE column) returned by SpatialEcoTyper. When supplied, the `dat` should be single cell gene expression data used for the SpatialEcoTyper analysis.

Value

A data frame with four columns, including CID (cell id), CellType (cell type), SE (spatial ecotype), and PredScore (prediction probability for the assigned SE).

Examples

# see https://digitalcytometry.github.io/spatialecotyper/articles/Recovery_scRNA.html
# see https://digitalcytometry.github.io/spatialecotyper/articles/Recovery_Spatial.html