anndict.wrappers.summarize_metadata_adata_dict

anndict.wrappers.summarize_metadata_adata_dict#

anndict.wrappers.summarize_metadata_adata_dict(adata, cols)[source]#

Generate a summary for specified metadata column(s) in adata.

Parameters:
adata AnnData

The anndata object containing the data.

columns

List of columns in adata.obs. Use ‘*’ to specify joint frequencies of multiple columns.

cols str | list[str]

Return type:

dict

Returns:

A dict with keys as column descriptions and values as a DataFrame of counts.

Notes

Use ‘*’ to specify joint frequencies of multiple columns.

Examples

Case 1: calculate frequency of donor and tissue columns

import anndict as adt
adt.wrappers.summarize_metadata(adata, ['donor', 'tissue'])

Case 2: calculate joint frequency of donor x tissue

import anndict as adt
adt.wrappers.summarize_metadata(adata, ['donor*tissue'])

See also

get_adata_columns()

To use string matching to retrieve specific column names from adata.

display_html_summary()

To print the results of summarize_metadata() as an html table.

anndict.wrappers.anndictionary_.summarize_metadata_adata_dict(), anndict.wrappers.anndictionary_.display_html_summary_adata_dict()