theislab / scvelo

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

Run scv.pl. velocity_ Embedding_ Stream error #1179

Open JWJ13164328557 opened 7 months ago

JWJ13164328557 commented 7 months ago

I don't know how to solve this problem, please help me check my mistake.

I tried to lower the filtering criteria(min_shared_counts=10), but the prompt message remained the same. But the most important mistake is the inability to produce a diagram. My command: import scvelo as scv adata = scv.read('test.h5ad') scv.pp.filter_and_normalize(adata, min_shared_counts=20, n_top_genes=2000) scv.pp.moments(adata, n_pcs=30, n_neighbors=30) scv.tl.velocity(adata) scv.tl.velocity_graph(adata) scv.set_figure_params(dpi=300) scv.pl.velocity_embedding_stream(adata, basis="umap", size= 10, alpha=0.6, color="seurat_clusters",title = None,dpi = 300,save = "velocity_embedding_stream.png") ERROR:

import scvelo as scv adata = scv.read('/home/jiwj/RNAsulv/VV/S53/test.h5ad') scv.pp.filter_and_normalize(adata, min_shared_counts=20, n_top_genes=2000) Filtered out 21838 genes that are detected 20 counts (shared). Normalized count data: X, spliced, unspliced. Extracted 2000 highly variable genes. Logarithmized X. scv.pp.moments(adata, n_pcs=30, n_neighbors=30) computing neighbors finished (0:00:34) --> added 'distances' and 'connectivities', weighted adjacency matrices (adata.obsp) computing moments based on connectivities finished (0:00:07) --> added 'Ms' and 'Mu', moments of un/spliced abundances (adata.layers) scv.tl.velocity(adata) computing velocities WARNING: Too few genes are selected as velocity genes. Consider setting a lower threshold for min_r2 or min_likelihood. finished (0:00:07) --> added 'velocity', velocity vectors for each individual cell (adata.layers) scv.tl.velocity_graph(adata) computing velocity graph (using 1/96 cores) 0%| | 0/41636 [00:00<?, ?cells/s] finished (0:00:28) --> added 'velocity_graph', sparse matrix with cosine correlations (adata.uns) scv.set_figure_params(dpi=300) scv.pl.velocity_embedding_stream(adata, basis="umap", size= 10, alpha=0.6, color="seurat_clusters",title = None,dpi = 300,save = "velocity_embedding_stream.png") computing velocity embedding finished (0:00:13) --> added 'velocity_umap', embedded velocity vectors (adata.obsm) Traceback (most recent call last): File "", line 1, in File "/home/jiwj/miniconda3/envs/RNAsulv/lib/python3.9/site-packages/scvelo/plotting/velocity_embedding_stream.py", line 252, in velocity_embedding_stream ax = scatter( File "/home/jiwj/miniconda3/envs/RNAsulv/lib/python3.9/site-packages/scvelo/plotting/scatter.py", line 668, in scatter set_legend( File "/home/jiwj/miniconda3/envs/RNAsulv/lib/python3.9/site-packages/scvelo/plotting/utils.py", line 555, in set_legend obs_vals.cat.categories = obs_vals.cat.categories.astype(str) File "/home/jiwj/miniconda3/envs/RNAsulv/lib/python3.9/site-packages/pandas/core/base.py", line 178, in setattr object.setattr(self, key, value) File "/home/jiwj/miniconda3/envs/RNAsulv/lib/python3.9/site-packages/pandas/core/accessor.py", line 99, in _setter return self._delegate_property_set(name, new_values) File "/home/jiwj/miniconda3/envs/RNAsulv/lib/python3.9/site-packages/pandas/core/arrays/categorical.py", line 2867, in _delegate_property_set return setattr(self._parent, name, new_values) AttributeError: can't set attribute

JWJ13164328557 commented 7 months ago

scv.pl.velocity_embedding_stream(adata, basis="umap",save = "velocity_embedding_stream.png") When I modify the parameters here, I can generate an image, but there is no color. What is the problem