UMI tables using scanpy


How can I get the UMIs tables for a ‘data.obs’ using scanpy?
My data is a time-series scRNA Anndata with time points "4,8,12 and 16’'. I want to know how to extract the UMI table for each time point using scanpy. Any help will be appreciated. Thanks

HI @Dannie,

I’m not totally sure what you mean. By UMI table do you mean UMI’s counted per cell and gene? Or are you looking for the UMI’s which were assigned to a cell?

Hi @ivirshup,
I mean UMI’s counted per cell per gene.


They will be stored in X or layers. You could group these by time point by doing something like:

for timepoint, indices in adata.obs.groupby("timepoint").indices.items():
    timepoint_X = adata.X[indices, :]