cascade.data.neighbor_impute

cascade.data.neighbor_impute(adata, k, use_rep, use_batch=None, X_agg='sum', obs_agg=None, obsm_agg=None, layers_agg=None)[source]

Impute data by aggregating nearest neighbors

Parameters:
  • adata (AnnData) – Dataset to be imputed

  • k (int) – Number of nearest neighbors

  • use_rep (str) – Key in obsm containing the representation to be used for nearest neighbor search

  • use_batch (str | None) – Key in obs used to group cells for nearest neighbor search (e.g., intervention label)

  • X_agg (str | None) – Aggregation function for X, must be one of {"sum", "mean", ``None}``. Setting to None discards the X matrix.

  • obs_agg (Mapping[str, str] | None) – Aggregation methods for obs, indexed by obs columns, must be one of {"sum", "mean"}. Fields not specified will be discarded.

  • obsm_agg (Mapping[str, str] | None) – Aggregation methods for obsm, indexed by obsm keys, must be one of {"sum", "mean"}. Fields not specified will be discarded.

  • layers_agg (Mapping[str, str] | None) – Aggregation methods for layers, indexed by layer keys, must be one of {"sum", "mean"}. Fields not specified will be discarded.

Return type:

AnnData

Returns:

Imputed dataset