nichecompass.benchmarking.utils.compute_knn_graph_connectivities_and_distances
- nichecompass.benchmarking.utils.compute_knn_graph_connectivities_and_distances(adata, feature_key='nichecompass_latent', knng_key='nichecompass_latent_15knng', n_neighbors=15, random_state=0, n_jobs=1)
Compute approximate k-nearest-neighbors graph.
- Parameters:
adata (
AnnData) – AnnData object with the features for knn graph computation stored in ´adata.obsm[feature_key]´.feature_key (
str(default:'nichecompass_latent')) – Key in ´adata.obsm´ that will be used to compute the knn graph.knng_key (
str(default:'nichecompass_latent_15knng')) – Key under which the knn graph connectivities will be stored in ´adata.obsp´ with the suffix ‘_connectivities’, the knn graph distances will be stored in ´adata.obsp´ with the suffix ‘_distances’, and the number of neighbors will be stored in ´adata.uns with the suffix ‘_n_neighbors’ .n_neighbors (
int(default:15)) – Number of neighbors of the knn graph.random_state (
int(default:0)) – Random state for reproducibility.n_jobs (
int(default:1)) – Number of jobs to use for parallelization of neighbor search.
- Return type: