nichepca.nhood_embedding.aggregate

Contents

nichepca.nhood_embedding.aggregate#

nichepca.nhood_embedding.aggregate(adata, obsm_key=None, suffix='_agg', n_layers=1, out_key=None, backend='pyg', aggr='mean')#

Aggregate data in an AnnData object based on a previously constructed graph.

Parameters:
  • adata (AnnData) – The AnnData object containing the data to be aggregated.

  • obsm_key (str | None (default: None)) – The key in the obsm attribute of adata that points to the matrix to be aggregated. If None, the default matrix in adata will be used.

  • suffix (str (default: '_agg')) – Suffix to be added to the keys of the aggregated results.

  • n_layers (int (default: 1)) – Number of layers to aggregate. This could represent different levels of aggregation or hierarchical aggregation.

  • out_key (str | None (default: None)) – Key to store the aggregated results in the AnnData object. If None, a default key with the provided suffix will be used.

  • backend (str (default: 'pyg')) – Backend to use for aggregation. Options might include “pyg” (PyTorch Geometric) or “sparse” (scipy.sparse).

  • **kwargs (dict) – Additional keyword arguments to be passed to the aggregation backend or method.

Returns:

None