plastro.plasticity.construct_phenotypic_graph
- plastro.plasticity.construct_phenotypic_graph(ad: AnnData, latent_space_key: str, n_nbrs: int = 10) Graph[source]
Construct a k-nearest neighbor graph from latent space coordinates.
- Parameters:
ad (anndata.AnnData) – Annotated data object.
latent_space_key (str) – Key in ad.obsm containing latent space coordinates.
n_nbrs (int, optional) – Number of nearest neighbors for graph construction, by default 10.
- Returns:
Graph where nodes are cells and edges connect nearest neighbors.
- Return type: