COSIE.utils

Functions

compute_knn_graph

Construct a k-nearest neighbors (k-NN) graph based on an input feature matrix.

compute_neighborhood_embedding

Compute the neighborhood embedding of each cell based on its spatial k-nearest neighbor graph.

construct_knn_graph_hnsw

Efficiently compute approximate k-nearest neighbor (k-NN) graph using the hnswlib library.

nn_approx

Efficiently find approximate K-nearest neighbors using the Annoy library.

setup_seed

Set the random seed for Python, NumPy, and PyTorch to ensure reproducibility.