anndata.AnnData.to_memory

AnnData.to_memory(copy=True)

Return a new AnnData object with all backed arrays loaded into memory.

Parameters
copy : default: True

Whether the arrays that are already in-memory should be copied.

Return type

AnnData

Example

import anndata
backed = anndata.read_h5ad("file.h5ad", backed="r")
mem = backed[backed.obs["cluster"] == "a", :].to_memory()