theislab / scvelo

RNA Velocity generalized through dynamical modeling
https://scvelo.org
BSD 3-Clause "New" or "Revised" License
409 stars 102 forks source link

error in tl.paga: Invalid vertex ID #1266

Open sokratiag opened 1 month ago

sokratiag commented 1 month ago

Hello,

I have encountered the following error in scv.tl.paga:

adata.uns['neighbors']['distances'] = adata.obsp['distances'] adata.uns['neighbors']['connectivities'] = adata.obsp['connectivities']

scv.tl.paga(adata, groups='Clusters_new') df = scv.get_df(adata, 'paga/transitions_confidence', precision=2).T df.style.background_gradient(cmap='Blues').format('{:.2g}')

versions: scvelo 0.3.2 (python 3.8.3) igraph 0.11.6

Error:

~/.local/lib/python3.8/site-packages/igraph/clustering.py in cluster_graph(self, combine_vertices, combine_edges) 334 """ 335 result = self.graph.copy() --> 336 result.contract_vertices(self.membership, combine_vertices) 337 if combine_edges is not False: 338 result.simplify(combine_edges=combine_edges)

InternalError: Error at src/constructors/basic_constructors.c:75: Invalid (negative or too large) vertex ID. -- Invalid vertex ID

Any ideas on how to solve it? Thanks!

lcxlcx commented 1 month ago

I have encountered the same problem, do you have a solution?

mailmrcai commented 5 days ago

this bug was caused by cluster name. I fixed this by:

adata = adata[~adata.obs['clusters'].isin([None,np.nan])].copy() #cluster / louvain

filter adata before the first step