CFLARE.set_terminal_states(labels, cluster_key=None, add_to_existing=False, **kwargs)

Manually define terminal states.

  • labels (Union[Series, Dict[str, Sequence[Any]]]) –

    Defines the terminal states. Valid options are:

    • categorical pandas.Series where each category corresponds to a terminal state. NaN entries denote cells that do not belong to any terminal state, i.e. these are either initial or transient cells.

    • dict where keys are terminal states and values are lists of cell barcodes corresponding to annotations in adata.AnnData.obs_names. If only 1 key is provided, values should correspond to terminal state clusters if a categorical pandas.Series can be found in anndata.AnnData.obs.

  • cluster_key (Optional[str]) – Key in anndata.AnnData.obs in order to associate names and colors with terminal_states. Each terminal state will be given the name and color corresponding to the cluster it mostly overlaps with.

  • add_to_existing (bool) – Whether the new terminal states should be added to pre-existing ones. Cells already assigned to a terminal state will be re-assigned to the new terminal state if there’s a conflict between old and new annotations. This throws an error if no previous annotations corresponding to terminal states have been found.

Return type



Nothing, just updates the following fields: