Skip to content

ValueError: No macrostates have been selected. #1316

@meaksu

Description

@meaksu

Report

When running predict_terminal_states(), I am getting the following error. Does this mean it wasn't able to determine any terminal state? predict_initial_states() on the other hand is able to run and predict a state.

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[16], line 1
----> 1 g.predict_terminal_states()
      2 g.plot_macrostates(which="terminal", legend_loc="right", s=100)

File ~/miniconda3/envs/cellrank2/lib/python3.11/site-packages/cellrank/estimators/terminal_states/_gpcca.py:318, in GPCCA.predict_terminal_states(self, method, n_cells, alpha, stability_threshold, n_states, allow_overlap)
    316     stability = pd.Series(np.diag(coarse_T), index=coarse_T.columns)
    317     names = stability[stability.values >= stability_threshold].index
--> 318     return self.set_terminal_states(
    319         names,
    320         n_cells=n_cells,
    321         allow_overlap=allow_overlap,
    322         params=self._create_params()
    323     )
    324 else:
    325     raise NotImplementedError(f"Method `{method}` is not yet implemented.")

File ~/miniconda3/envs/cellrank2/lib/python3.11/site-packages/cellrank/estimators/terminal_states/_gpcca.py:433, in GPCCA.set_terminal_states(self, states, n_cells, allow_overlap, cluster_key, **kwargs)
    431     states = [states]
    432 if not len(states):  # unset the states
--> 433     raise ValueError("No macrostates have been selected.")
    435 is_singleton = memberships.shape[1] == 1
    436 memberships = memberships[list(states)].copy()

ValueError: No macrostates have been selected.

Version information

Package	Version
cellrank	2.0.7
numpy	2.4.3
pandas	2.3.3
scanpy	1.11.5
matplotlib	3.10.8
anndata	0.12.10
cellmapper	0.2.5
Component	Info
Python	3.11.15 (main, Mar 11 2026, 17:20:07) [GCC 14.3.0]
OS	Linux-5.14.0-611.38.1.el9_7.x86_64-x86_64-with-glibc2.34
Updated	2026-03-28 01:46
Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions