anndata.AnnData.to_memory

anndata.AnnData.to_memory#

AnnData.to_memory(copy=False)[source]#

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

Parameters:
copy default: False

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()