- dynamo.tl.neighbors(adata, X_data=None, genes=None, basis='pca', layer=None, n_pca_components=30, n_neighbors=30, method=None, metric='euclidean', metric_kwads=None, cores=1, seed=19491001, result_prefix='', **kwargs)
Search nearest neighbors of the adata object.
AnnData) – An AnnData object.
str) – The space that will be used for nearest neighbor search. Valid names includes, for example, pca, umap, velocity_pca or X (that is, you can use velocity for clustering), etc. Defaults to “pca”.
int) – Number of PCA components. Applicable only if you will use pca basis for nearest neighbor search. Defaults to 30.
int) – Number of nearest neighbors. Defaults to 30.
Callable]) – The distance metric to use for the tree. The default metric is euclidean, and with p=2 is equivalent to the standard Euclidean metric. See the documentation of DistanceMetric for a list of available metrics. If metric is “precomputed”, X is assumed to be a distance matrix and must be square during fit. X may be a sparse graph, in which case only “nonzero” elements may be considered neighbors. Defaults to “euclidean”.
int) – The number of parallel jobs to run for neighbors search. None means 1 unless in a joblib.parallel_backend context. -1 means using all processors. Defaults to 1.
int) – Random seed to ensure the reproducibility of each run. Defaults to 19491001.
str) – The key that will be used as the prefix of the connectivity, distance and neighbor keys in the returning adata. Defaults to “”.
kwargs – Additional arguments that will be passed to each nearest neighbor search algorithm.
ImportError – method is invalid.
- Return type:
An updated anndata object that are updated with the indices, connectivity, distance to the .obsp, as well as a new neighbors key in .uns.