Skip to contents

Compute cell neighborhoods, a higher order abstraction or classification defined by (1) a set of cell labels (the feature parameter; e.g. clusters) and (2) a network graph of the cells, produced by spatialNearestNeighbors. Essentially a census/tally of the neighborhood around each cell.

Usage

cellNeighborhoods(object, nn, feature, feature_vector = NULL, drop.self = T)

Arguments

object

SpatialMap or Region object

nn

The name of a neighbors network which will be used to compute neighborhoods.

feature

The name of the cellMetadata feature (e.g. cell type) used for defining neighborhoods.

feature_vector

Deprecated. Add your feature to your object using addCellMetadata, and then pass the name to feature.

drop.self

Whether to drop self-interactions prior to computation.

Value

A SpatialMap or Region object (depending on what was passed to object), with data added to the misc slot of the NN specified by nn. The new data will be named by {feature}_neighborhood, and will be a matrix indicating the counts of each cell type within the neighbors of each cell.

Details

See vignette("AnalysisGuide6_Neighborhoods") for a representative workflow that uses this function.

Scroll to top