Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculation of transition matrix problem,ValueError: Input matrix P is not a transition matrix. #1234

Open
Angle28 opened this issue Nov 22, 2024 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@Angle28
Copy link

Angle28 commented Nov 22, 2024

Hello, I would like to ask if I have no error after running this
kernel = cr.tl.transition_matrix(ad,
weight_connectivities=weight_connectivities,
mode=mode,
n_jobs=n_jobs,
softmax_scale=softmax_scale)
And then I run this without error g_fwd = GPCCA(kernel)
Then run this g_fwd.compute_macrostates(n_states=4, cluster_key="lineage")

These errors appear in g_fwd ValueError Traceback (most recent call last)
Cell In[41], line 1
----> 1 g_fwd.compute_macrostates(n_states=4, cluster_key="lineage")
3 g_fwd

The File ~ / local/lib/python3.9 / site - packages/cellrank/tl/estimators terminal_states / _gpcca py: 175, in compute_macrostates(self, n_states, n_cells, cluster_key, **kwargs)

The File ~ / local/lib/python3.9 / site - packages/cellrank/tl/estimators/mixins/decomposition / _schur py: 161, in compute_schur(self, n_components, initial_distribution, method, which, alpha)

The File ~ / local/lib/python3.9 / site - packages/pygpcca / _gpcca. Py: 776, in GPCCA. init (self, P, eta, z, method)
768 def init(
769 self,
770 P: Union[np.ndarray, spmatrix],
(...).
773 method: str = DEFAULT_SCHUR_METHOD,
774):
775 if not is_transition_matrix(P):
--> 776 raise ValueError("Input matrix P is not a transition matrix.")
777 if z not in ["LM", "LR"]:
778 raise ValueError("You didn't give a valid sorting criterion z. Valid options are: 'LM', 'LR'.")

ValueError: Input matrix P is not a transition matrix.
...

@Angle28 Angle28 added the question Further information is requested label Nov 22, 2024
@WeilerP
Copy link
Member

WeilerP commented Nov 22, 2024

@Angle28, can you please update to the latest version of CellRank and check again?

@Angle28
Copy link
Author

Angle28 commented Nov 22, 2024

Hello, I have updated cellrank to 2.0.6, the latest version, and did I use the test data in the literature to do this or such problems occurred.

@WeilerP
Copy link
Member

WeilerP commented Nov 22, 2024

@Angle28, sorry, I'm a bit confused and cannot follow what you did: (1) There is no cellrank.tl module anymore, and (2) what data did you use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants