emdann / milopy

Python implementation of Milo for differential abundance testing on KNN graph
MIT License
60 stars 7 forks source link

Retrieving adata.obs_names belonging to each adata.uns["nhood_adata"].obs_names #6

Closed castaway1990 closed 2 years ago

castaway1990 commented 2 years ago

Hi, is there a way to know which original cells are making each neighborhood?

Thanks!

emdann commented 2 years ago

Hi @castaway1990 You can find the assignment of cells to neighbourhoods in adata.obsm["nhoods"]. This is a binary matrix where rows represent cells and columns represent neighbourhoods.

castaway1990 commented 2 years ago

Right, thanks a lot.

emdann commented 2 years ago

or if you are referring to the index cell for each neighbourhood, these are marked in adata.obs['nhood_ixs_refined'] and the order of columns in adata.obsm['nhoods'] is the same as in obs (i.e. the first cell where adata.obs['nhood_ixs_refined']==1 is index to the nhood in the first column in adata.obsm['nhoods'])