neighborPurity: Compute purity of each cell's neighborhood, as defined by KNN...

View source: R/utility_functions.R

neighborPurityR Documentation

Compute purity of each cell's neighborhood, as defined by KNN graph.

Description

Compute purity of each cell's neighborhood, as defined by KNN graph. For each neighborhood, the proportion of cells belonging to the most represented cluster is computed as the purity score. The Purity score is stored in the metadata of the returned seurat object.

Usage

neighborPurity(object, graph, cluster.field = "seurat_clusters", verbose = T)

Arguments

object

Seurat object

graph

name of KNN graph to use for analysis. Must be present within provided seurat object. If absent, run FindNeighbors().

cluster.field

name of cluster metadata field to use for cluster membership data. Default is 'seurat_clusters'.

verbose

Print progress. Default is TRUE.

Value

Seurat object with purity score stored in metadata

Author(s)

Nicholas Mikolajewicz

Examples


object <- FindNeighbors(object)
object <- FindClusters(object, resolution = 1)
object <- neighborPurity(object, "RNA_nn")


NMikolajewicz/scMiko documentation built on June 28, 2023, 1:41 p.m.