mantispy.tl.aggregate#
- mantispy.tl.aggregate(adata, by=('Metadata_Plate', 'Metadata_Well'), func='median', min_cells=10, layer=None)[source]#
Aggregate
adatato one profile per group.- Parameters:
adata (
AnnData) – Single-cell object to aggregate.by (
Sequence[str] (default:('Metadata_Plate', 'Metadata_Well'))) – Columns defining a profile. The default is one profile per well.func (
str(default:'median')) –"median"(the pycytominer default) or"mean".min_cells (
int(default:10)) – Groups with fewer cells than this are dropped.layer (
str|None(default:None)) – Aggregate this layer instead ofX.
- Return type:
- Returns:
A new
AnnDatawith one row per group.varis carried over unchanged;obsholds the grouping columns,Metadata_CellCount, and every otherMetadata_column that is constant within every group.
Notes
This uses mantispy’s own NaN-skipping kernel rather than
scanpy.get.aggregate(), which propagates NaN and is measurably slower on both mean and median.