cellstate.predict: Predict cell states of a projected dataset

View source: R/main.R

cellstate.predictR Documentation

Predict cell states of a projected dataset

Description

This function uses a nearest-neighbor algorithm to predict a feature (e.g. the cell state) of the query cells. Distances between cells in the reference map and cells in the query are calculated in a reduced space (PCA or UMAP) and the feature is assigned to query cells based on a consensus of its nearest neighbors in the reference object.

Usage

cellstate.predict(
  ref,
  query,
  reduction = "pca",
  ndim = NULL,
  k = 5,
  min.confidence = 0.2,
  nn.decay = 0.1,
  labels.col = "functional.cluster"
)

Arguments

ref

Reference Atlas

query

Seurat object with query data

reduction

The dimensionality reduction used to calculate pairwise distances. One of "pca" or "umap"

ndim

How many dimensions in the reduced space to be used for distance calculations

k

Number of neighbors to assign the cell type

min.confidence

Minimum confidence score to return cell type labels (otherwise NA)

nn.decay

Weight decay for internal nearest neighbors (between 0 and 1)

labels.col

The metadata field of the reference to annotate the clusters (default: functional.cluster)

Value

The query object submitted as parameter, with two additional metadata slots for predicted state and its confidence score

Examples

data(query_example_seurat)
ref <- load.reference.map()
q <- make.projection(query_example_seurat, ref=ref)
q <- cellstate.predict(ref, query=q)
table(q$functional.cluster)

carmonalab/ProjecTILs documentation built on April 13, 2025, 10:04 p.m.