cascade.data.aggregate_obs
- cascade.data.aggregate_obs(adata, by, X_agg=None, obs_agg=None, obsm_agg=None, layers_agg=None)[source]
Aggregate obs in a given dataset by certain categories
- Parameters:
adata (
AnnData) – Dataset to be aggregatedby (
str) – Specify a column inobsused for aggregation, must be discrete.X_agg (
str|None) – Aggregation function forX, must be one of{"sum", "mean", ``None}``. Setting toNonediscards theadata.Xmatrix.obs_agg (
Mapping[str,str] |None) – Aggregation methods forobs, indexed by obs columns, must be one of{"sum", "mean", "majority"}, where"sum"and"mean"are for continuous data, and"majority"is for discrete data. Fields not specified will be discarded.obsm_agg (
Mapping[str,str] |None) – Aggregation methods forobsm, indexed by obsm keys, must be one of{"sum", "mean"}. Fields not specified will be discarded.layers_agg (
Mapping[str,str] |None) – Aggregation methods forlayers, indexed by layer keys, must be one of{"sum", "mean"}. Fields not specified will be discarded.
- Return type:
- Returns:
Aggregated dataset