pegasus.annotate

pegasus.annotate(data, name, based_on, anno_dict)[source]

Add annotation to the data object as a categorical variable.

Parameters
  • data (MultimodalData, UnimodalData, or anndata.AnnData) – Gene-count matrix with DE analysis information.

  • name (str) – Name of the new annotation in data.obs.

  • based_on (str) – Name of the attribute the cluster ids coming from.

  • anno_dict (Dict[str, str] or List[str]) – Dictionary mapping from cluster id to cell type. If it is a List, map cell types to cluster ids one to one in correspondence.

Return type

None

Examples

>>> pg.annotate(data, 'anno', 'spectral_louvain_labels', {'1': 'T cell', '2': 'B cell'})
>>> pg.annotate(data, 'anno', 'louvain_labels', ['T cell', 'B cell'])