% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/main.R
\name{cellstate.predict}
\alias{cellstate.predict}
\title{Predict cell states of a projected dataset}
\usage{
cellstate.predict(
  ref,
  query,
  reduction = "pca",
  ndim = NULL,
  k = 5,
  min.confidence = 0.2,
  nn.decay = 0.1,
  labels.col = "functional.cluster"
)
}
\arguments{
\item{ref}{Reference Atlas}

\item{query}{Seurat object with query data}

\item{reduction}{The dimensionality reduction used to calculate pairwise distances. One of "pca" or "umap"}

\item{ndim}{How many dimensions in the reduced space to be used for distance calculations}

\item{k}{Number of neighbors to assign the cell type}

\item{min.confidence}{Minimum confidence score to return cell type labels (otherwise NA)}

\item{nn.decay}{Weight decay for internal nearest neighbors (between 0 and 1)}

\item{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
}
\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.
}
\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)
}
