question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

scv.pp.moment error

See original GitHub issue

Hello,

First try with this testing release. I cloned the git repo, and installed with pip install . on python 3.6.5 I loaded an annotated dataframe I am using to work on (created/pp with scanpy), then:

>>> scv.pp.moments(adata)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/path/to/scvelo/scvelo/preprocessing/moments.py", line 42, in moments
    adata.layers['Ms'] = csr_matrix.dot(connectivities, adata.layers['spliced']).toarray()
  File "/path/to/local/python/python-dev/lib/python3.6/site-packages/anndata/layers.py", line 41, in __getitem__
    return self._layers[key]
KeyError: 'spliced'

Many thanks for your work, Best.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
VolkerBergencommented, Aug 30, 2018

.X contains the logarithmized normalized spliced counts used e.g. for computing neighbor graphs and embeddings, while .layers['spliced'] contains the non-logarithmized normalized spliced counts (keeping it comparable to unspliced counts). Indeed, we might be better off just applying np.log1p whenever needed instead of storing another count table. However, since batch correction and other preprocessing procedures should only affect .X as well, it is probably best to keep it as is.

The initially raised plotting issue (seemed to have been lost in the course of conversation) is still on my to-do list.

0reactions
juugiicommented, Sep 10, 2018

Hi @VolkerBergen, Sorry for my late answer. I have been able to use the plotting functions, yet I have to use plt.show() as explained. But it is functional, and gives expected results. I have been able to work with loom files after upgrading to the latest scanpy. I’m also building on creating an AnnData according to your recommendations, but it is outside the scope of this OP, I can close it. Thanks for your help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

error from scv.pp.moments(adata) · Issue #16 · theislab/scvelo
Hi, I'm attempting to run a scanpy processed .h5ad file through scvelo but am running into the error pasted below.
Read more >
scVelo documentation - Read the Docs
Compute a neighborhood graph of observations. pp.moments(data[, n_neighbors, n_pcs, mode, . . . ]) Computes moments for velocity estimation. 4.3. API.
Read more >
RNA velocity analysis with scVelo - Sam Morabito
In this tutorial, I will cover how to use the Python package scVelo to perform RNA velocity analysis in single-cell RNA-seq data (scRNA-seq)....
Read more >
scvelo Velocity plots raise KeyError(f"None of [{key}] are in the ...
I had the same issue, converting umaps to numpy array before adding to adata object fixed it for me. s.obsm["X_umap"] = umap.to_numpy().
Read more >
Dynamical Modeling — scVelo 0.2.6.dev4+g5725727 ...
Processing consists of gene selection, normalizing by total size, logarithmizing X, and computing moments for velocity estimation. See the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found