stereo.core.StPipeline.neighbors¶
- StPipeline.neighbors(pca_res_key='pca', method='umap', metric='euclidean', n_pcs=None, n_neighbors=10, knn=True, n_jobs=10, res_key='neighbors')[source]¶
Compute a spatial neighborhood graph over all cells.
- Parameters:
pca_res_key (
str) – the key of PCA analysis to get corresponding result fromself.result.method (
Literal['umap','gauss']) – useumaporgaussto compute connectivities.metric (
str) –a known metric’s name or a callable that returns a distance, include:
euclidean
manhattan
chebyshev
minkowski
canberra
braycurtis
mahalanobis
wminkowski
seuclidean
cosine
correlation
haversine
hamming
jaccard
dice
russelrao
kulsinski
rogerstanimoto
sokalmichener
sokalsneath
yule
n_pcs (
Optional[int]) – the number of principle components to run neighbors, default is None such thatself.Xis used.n_neighbors (
int) – the size of nearest neighbors.knn (
bool) – ifTrue, use a hard threshold to restrict the number of neighbors ton_neighbors, namely consider a knn graph. Otherwise, use a Gaussian Kernel to assign low weights to neighbors more distant than then_neighborsnearest neighbors.n_jobs (
int) – the number of parallel running jobs for neighbors, if set to-1, all CPUs will be used. Notice that extremely high value ofn_jobsmay cause segment fault.res_key (
str) – the key for storing result of neighbors, default isneighbors.
- Returns:
Neighbors result is stored in
self.resultwhere the result key is'neighbors'.