dynamo-release
dynamo-release copied to clipboard
IndexError: list index out of range
dyn.tl.cell_velocities(adata)
IndexError Traceback (most recent call last)
/tmp/ipykernel_21547/875872558.py in
/opt/conda/envs/dynamo/lib/python3.7/site-packages/dynamo/tools/cell_velocities.py in cell_velocities(adata, ekey, vkey, X, V, X_embedding, transition_matrix, use_mnn, n_pca_components, transition_genes, min_r2, min_alpha, min_gamma, min_delta, basis, neigh_key, adj_key, add_transition_key, add_velocity_key, n_neighbors, method, neg_cells_trick, calc_rnd_vel, xy_grid_nums, correct_density, scale, sample_fraction, random_seed, enforce, preserve_len, **kernel_kwargs) 196 mapper_r = get_mapper_inverse() 197 layer = mapper_r[ekey] if (ekey is not None and ekey in mapper_r.keys()) else ekey --> 198 ekey, vkey, layer = get_ekey_vkey_from_adata(adata) if (ekey is None or vkey is None) else (ekey, vkey, layer) 199 200 if calc_rnd_vel:
/opt/conda/envs/dynamo/lib/python3.7/site-packages/dynamo/tools/utils.py in get_ekey_vkey_from_adata(adata) 1703 """ekey: expression from which to extrapolate velocity; vkey: velocity key; layer: the states cells will be used in 1704 velocity embedding.""" -> 1705 dynamics_key = [i for i in adata.uns.keys() if i.endswith("dynamics")][0] 1706 experiment_type, use_smoothed = ( 1707 adata.uns[dynamics_key]["experiment_type"],
IndexError: list index out of range
######################################## how to slove this problem ,thanks。
怎么解决这个错误?谢谢
################################################ pip list Package Version
algopy 0.5.7 anndata 0.7.5 annoy 1.17.1 anyio 3.6.1 argon2-cffi 21.3.0 argon2-cffi-bindings 21.2.0 attrs 22.1.0 Babel 2.10.3 backcall 0.2.0 beautifulsoup4 4.11.1 bleach 5.0.1 certifi 2022.6.15 cffi 1.15.1 cfgv 3.3.1 charset-normalizer 2.1.1 click 8.1.3 colorcet 3.0.0 cvxopt 1.3.0 cycler 0.11.0 Cython 0.29.32 debugpy 1.6.3 decorator 5.1.1 defusedxml 0.7.1 distlib 0.3.5 dynamo-release 1.0.0 entrypoints 0.4 fastjsonschema 2.16.1 filelock 3.8.0 fonttools 4.36.0 h5py 3.7.0 hdbscan 0.8.28 identify 2.5.3 idna 3.3 igraph 0.9.11 importlib-metadata 4.12.0 importlib-resources 5.9.0 ipykernel 6.15.1 ipython 7.34.0 ipython-genutils 0.2.0 ipywidgets 8.0.1 jedi 0.18.1 Jinja2 3.1.2 joblib 1.1.0 json5 0.9.10 jsonschema 4.14.0 jupyter 1.0.0 jupyter-client 7.3.4 jupyter-console 6.4.4 jupyter-core 4.11.1 jupyter-server 1.18.1 jupyterlab 3.4.5 jupyterlab-pygments 0.2.2 jupyterlab-server 2.15.0 jupyterlab-widgets 3.0.2 kiwisolver 1.4.4 llvmlite 0.39.0 loompy 3.0.7 lxml 4.9.1 MarkupSafe 2.1.1 matplotlib 3.5.3 matplotlib-inline 0.1.6 mistune 2.0.4 natsort 8.1.0 nbclassic 0.4.3 nbclient 0.6.6 nbconvert 7.0.0 nbformat 5.4.0 nest-asyncio 1.5.5 networkx 2.6.3 nodeenv 1.7.0 notebook 6.4.12 notebook-shim 0.1.0 numba 0.56.0 numdifftools 0.9.40 numpy 1.21.6 numpy-groupies 0.9.19 packaging 21.3 pandas 1.1.5 pandocfilters 1.5.0 param 1.12.2 parso 0.8.3 patsy 0.5.2 pexpect 4.8.0 pickleshare 0.7.5 Pillow 9.2.0 pip 22.2.2 pkgutil_resolve_name 1.3.10 platformdirs 2.5.2 pre-commit 2.20.0 prometheus-client 0.14.1 prompt-toolkit 3.0.30 psutil 5.9.1 ptyprocess 0.7.0 pycparser 2.21 pyct 0.4.8 Pygments 2.13.0 pynndescent 0.5.7 pyparsing 3.0.9 pyrsistent 0.18.1 python-dateutil 2.8.2 python-igraph 0.9.11 pytz 2022.2.1 PyYAML 6.0 pyzmq 23.2.1 qtconsole 5.3.1 QtPy 2.2.0 requests 2.28.1 scikit-learn 1.0.2 scipy 1.7.3 seaborn 0.11.2 Send2Trash 1.8.0 setuptools 65.2.0 six 1.16.0 sniffio 1.2.0 soupsieve 2.3.2.post1 statsmodels 0.13.2 terminado 0.15.0 texttable 1.6.4 threadpoolctl 3.1.0 tinycss2 1.1.1 toml 0.10.2 tornado 6.2 tqdm 4.64.0 traitlets 5.3.0 trimap 1.1.4 typing_extensions 4.3.0 umap-learn 0.5.3 urllib3 1.26.12 virtualenv 20.16.3 wcwidth 0.2.5 webencodings 0.5.1 websocket-client 1.3.3 wheel 0.37.1 widgetsnbextension 4.0.2 zipp 3.8.1
Please provide the script that you use dynamo and the print result after typing adata
please also check this issue https://github.com/aristoteleo/dynamo-release/issues/377
import dynamo as dyn dyn.get_all_dependencies_version()
dyn.configuration.set_figure_params('dynamo', background='white') # jupter notebooks
adata = dyn.sample_data.DentateGyrus() !ls ./data/*loom ##./data/DentateGyrus.loom ./data/bk.loom
dyn.pp.recipe_monocle(adata)
dyn.tl.moments(adata)
dyn.tl.dynamics(adata) #######I forgot to run this line so it raise "IndexError: list index out of range"
dyn.tl.reduceDimension(adata)
dyn.tl.cell_velocities(adata)
dyn.tl.cell_wise_confidence(adata)
dyn.vf.VectorField(adata) ####but this error raise, why ?有完整的run这个流程的代码吗?可否贴上给我调试一下,谢谢
|-----> vectorfield calculation begins...
|-----> Retrieve X and V based on genes, layer: None.
Vector field will be learned in the gene expression space.
KeyError Traceback (most recent call last)
/tmp/ipykernel_22021/3361624020.py in
/opt/conda/envs/dynamo/lib/python3.7/site-packages/dynamo/vectorfield/topography.py in VectorField(adata, basis, layer, dims, genes, normalize, grid_velocity, grid_num, velocity_key, method, model_buffer_path, return_vf_object, map_topography, pot_curl_div, cores, result_key, copy, **kwargs) 644 X = np.expm1(X) 645 else: --> 646 X = inverse_norm(adata, adata.layers[layer]) 647 648 V = adata[:, valid_genes].layers[velocity_key].copy()
/opt/conda/envs/dynamo/lib/python3.7/site-packages/anndata/_core/aligned_mapping.py in getitem(self, key) 146 147 def getitem(self, key: str) -> V: --> 148 return self._data[key] 149 150 def setitem(self, key: str, value: V):
KeyError: None
dyn.vf.topography(adata, basis='umap')
dyn.ext.ddhodge(adata)
dyn.vf.Potential(adata)
dyn.pl.cell_wise_vectors(adata, color=colors, ncols=3) dyn.pl.grid_vectors(adata, color=colors, ncols=3) dyn.pl.stremline_plot(adata, color=colors, ncols=3) dyn.pl.line_integral_conv(adata)
dyn.vf.VectorField(adata, basis='umap') dyn.pl.topography(adata)
import matplotlib.pyplot as plt fig1, f1_axes = plt.subplots(ncols=2, nrows=2, constrained_layout=True, figsize=(12, 10)) f1_axes f1_axes[0, 0] = dyn.pl.cell_wise_vectors(adata, color='umap_ddhodge_potential', pointsize=0.1, alpha = 0.7, ax=f1_axes[0, 0], quiver_length=6, quiver_size=6, save_show_or_return='return') f1_axes[0, 1] = dyn.pl.grid_vectors(adata, color='speed_umap', ax=f1_axes[0, 1], quiver_length=12, quiver_size=12, save_show_or_return='return') f1_axes[1, 0] = dyn.pl.streamline_plot(adata, color='divergence_pca', ax=f1_axes[1, 0], save_show_or_return='return') f1_axes[1, 1] = dyn.pl.topography(adata, color='acceleration_umap', ax=f1_axes[1, 1], save_show_or_return='return') plt.show()
can you maker a docker images? please tell me how to find it
exampe:
C:\Users\dell>docker search Dynamo NAME DESCRIPTION STARS OFFICIAL AUTOMATED amazon/dynamodb-local DynamoDB local 390 cnadiminti/dynamodb-local AWS Amazon Dynamodb Local with openjdk:8-jre 66 [OK] dwmkerr/dynamodb Run AWS DynamoDB Local in a container. 34 peopleperhour/dynamodb Minimal DynamoDB image 30 [OK]
please provide the output after you type adata as I asked previously.
please also make sure you run dyn.tl.cell_velocities(adata) successfully before you run dyn.vf.VectorField(adata, basis='umap'). Please also check our other tutorials, such as https://dynamo-release.readthedocs.io/en/latest/notebooks/zebrafish.html.
Most of your questions are quite basic, and can be solved easily once you are more familiar with our toolkit. The same thing applies to learning another tools as I strongly believe it will not only save the developer's time in answering basic question but also train you a better scientist in the first place.
Unfortunately we won't provide a docker image also as we will continuouslly develop our package
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 14 days