tacco.tools.merge_observations

merge_observations(adata, obs_index_key, annotation_key=None, min_counts=0, mean_keys=None)[source]

Merges equivalent observations of an AnnData by summing over the expression. Equivalence is determined by the values of .obs columns.

Parameters:
  • adata – An AnnData including expression data in .X and annotation in .obs.

  • obs_index_key – The primary .obs key to merge on. May be an original observation index before split_observations().

  • annotation_key – An optional second .obs key to merge on.

  • min_counts – Minimum count per observation to include in the merged data.

  • mean_keys – The names of the columns containing numerical properties to construct mean quantities for .obs columns with.

Returns:

Returns an AnnData containing the merged expression data.