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 from self.result.

  • method (Literal['umap', 'gauss']) – use umap or gauss to 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 that self.X is used.

  • n_neighbors (int) – the size of nearest neighbors.

  • knn (bool) – if True, use a hard threshold to restrict the number of neighbors to n_neighbors, namely consider a knn graph. Otherwise, use a Gaussian Kernel to assign low weights to neighbors more distant than the n_neighbors nearest 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 of n_jobs may cause segment fault.

  • res_key (str) – the key for storing result of neighbors, default is neighbors.

Returns:

Neighbors result is stored in self.result where the result key is 'neighbors'.