
Create K Nearest Neighbor (KNN) Graph
createKNNGraph.Region.Rd
Function to create a k-nearest-neighbor graph, implemented with DBSCAN
Usage
createKNNGraph.Region(
object,
k = 30,
representation = "spatial",
name = NULL,
data.slot = NULL,
dims = NULL,
features = NULL,
dist_filter = NULL,
...
)
Arguments
- object
A Region object.
- k
The number of K-nearest neighbors
- representation
Which representation's embeddings should be used to compute the graph?
- name
A custom name for the graph. By default, will be named according to the representation, method, and parameter specified (e.g.
umap_knn_5
,pca_frnn_50
,spatial_del
).- data.slot
A data slot to use (i.e. look for nearest neighbors in raw or normalized biomarker expression space). See
Data()
for details. PassNULL
torepresentation
to use this parameter. Currently only supported for"knn"
.- dims
Which dimensions to use to compute distance? Only used if
representation
is notNULL
. Pass numeric indices or names of columns from the representation being used.- features
Which features to use to compute distance? Only used if
data.slot
is notNULL
.- dist_filter
A distance beyond which interactions will be dropped. If using a
"spatial"
representation, this distance will be in pixels. Passed tonn.applyDistanceCutoff()
. KNN and Delaunay triangulation graphs may extend across gaps in tissue as long as there are no cells in those gaps, so this threshold can be helpful to ensure that interactions in the NN are representative of the true biological tissue structure. Default (NULL
) skips this filtering.- ...
Additional parameters passed to
dbscan::kNN