scmorph.pp.aggregate#
- scmorph.pp.aggregate(adata, well_key='infer', group_keys=None, method='median', progress=True)#
Aggregate single-cell measurements into well-level profiles
- Parameters:
adata (
AnnData) – Annotated data matrixwell_key (
str(default:'infer')) – Name of column in metadata used to define wells.group_keys (
Union[str,list[str],None] (default:None)) – Other column names to group by, e.g. plate namesmethod (
str(default:'median')) – Which aggregation to perform. Must be one of ‘mean’, ‘median’, ‘std’, ‘var’, ‘sem’, ‘mad’, and ‘mad_scaled’ (i.e. median/mad)progress (
bool(default:True)) – Whether to show a progress bar
Note
If this function produces warnings about dividing by zero, this means that at least one group had a median absolute deviation of 0 for a feature. This means that this feature is constant in that group. However, this will produce missing values. Before proceeding, you should therefore use
drop_na()withfeature_threshold=1andcell_threshold=0to remove features with missing values.- Return type:
- Returns:
dists Aggregated annotated data matrix