came.utils.preprocess.group_mean_adata

came.utils.preprocess.group_mean_adata(adata: AnnData, groupby: str, features: Sequence | None = None, binary: bool = False, use_raw: bool = False)

Compute averaged feature-values for each group

Parameters:
  • adata (AnnData) –

  • groupby (str) – a column name in adata.obs

  • features – a subset of names in adata.var_names (or adata.raw.var_names)

  • binary (bool) – if True, the results will turn to be the non-zeor proportions for all (or the given) features

  • use_raw (bool) – whether to access adata.raw to compute the averages.

Return type:

a pd.DataFrame with features as index and groups as columns