anndict.wrappers.sample_and_drop_adata_dict

anndict.wrappers.sample_and_drop_adata_dict#

anndict.wrappers.sample_and_drop_adata_dict(adata_dict, strata_keys, n_largest_groups=None, min_num_cells=0, **kwargs)[source]#

Sample each AnnData in adata_dict based on specified strata keys and drop strata with fewer than the minimum number of cells.

Parameters:
adata_dict AdataDict

An AdataDict.

strata_keys list[str]

List of column names in .obs to use for stratification. Must be present in each adata in adata_dict.

min_num_cells int (default: 0)

Minimum number of cells required to retain a stratum.

kwargs

Additional keyword arguments to pass to sample_and_drop().

n_largest_groups int | None

Return type:

AdataDict

Returns:

AdataDict of sampled AnnData after filtering.