scmorph.pp.aggregate

Contents

scmorph.pp.aggregate#

scmorph.pp.aggregate(adata, group_keys, method='median', progress=True)[source]#

Aggregate single-cell measurements into well-level profiles

Parameters:
adata AnnData

Annotated data matrix

group_keys str | list[str]

Column names to group by, e.g. “Well” or “PlateID”

method 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() with feature_threshold=1 and cell_threshold=0 to remove features with missing values.

Return type:

AnnData

Returns:

Aggregated annotated data matrix