extract

extract#

squidpy.pl.extract(adata, *, obsm_key='img_features', prefix=None)[source]#

Create a temporary anndata.AnnData object for plotting.

Move columns from anndata.AnnData.obsm ['{obsm_key}'] to anndata.AnnData.obs to enable the use of scanpy.pl functions.

Parameters:
adata AnnData

Annotated data object.

obsm_key list[str] | str (default: 'img_features')

Entries in anndata.AnnData.obsm that should be moved to anndata.AnnData.obs.

prefix list[str] | str | None (default: None)

Prefix to prepend to each column name. Should be a :class;`list` if obsm_key is a list. If None, use the original column names.

Returns:

AnnData – Temporary anndata.AnnData object with desired entries in anndata.AnnData.obs.

Raises:

ValueError – If number of prefixes does not fit to number of obsm_keys.

Notes

If anndata.AnnData.obs ['{column}'] already exists, it will be overwritten and a warning will be issued.