scmorph.pp.aggregate

Contents

scmorph.pp.aggregate#

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

Aggregate single-cell measurements into well-level profiles

Parameters:
adata AnnData

Annotated data matrix

well_key str (default: 'infer')

Name of column in metadata used to define wells.

group_keys str | list[str] | None (default: None)

Other column names to group by, e.g. plate names

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:

dists Aggregated annotated data matrix