lilab-bcb / pegasus

A tool for analyzing trascriptomes of millions of single cells.

Home Page:https://pegasus.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error with tsne function after following the Regress Out tutorial

morgeur opened this issue · comments

Hello,

I followed the Regress Out tutorial as I would like to give a try to the cell cycle regression on my own dataset.
After using the regress_out function, I used the X_pca_regressed for downstream analysis:

pg.neighbors(data, rep="pca_regressed")
pg.louvain(data, rep="pca_regressed")`

But when calling the tsne function, I encounter the following error:

pg.tsne(data, rep="pca_regressed")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/site-packages/pegasusio/decorators.py", line 12, in wrapper_timer
    result = func(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pegasus/tools/visualization.py", line 296, in tsne
    data.obsm["X_" + out_basis] = calc_tsne(
  File "/usr/local/lib/python3.8/site-packages/pegasus/tools/visualization.py", line 55, in calc_tsne
    return FItSNE(
  File "/usr/local/lib/python3.8/site-packages/fitsne/cywrap.py", line 120, in FItSNE
    _TSNErun(X, N, D, Y, no_dims, perplexity, theta, rand_seed,
  File "fitsne/cppwrap.pyx", line 16, in fitsne.cppwrap._TSNErun
  File "stringsource", line 658, in View.MemoryView.memoryview_cwrapper
  File "stringsource", line 349, in View.MemoryView.memoryview.__cinit__
ValueError: ndarray is not C-contiguous

I do not encountered this error when running: pg.tsne(data, rep="pca") or pg.umap(data, rep="pca_regressed")

Am I doing anything wrong?
Many thanks for your help and providing this great tool!

commented

Hi @morgeur ,

Thanks for liking our tool! Actually, we're aware of this bug and have fixed it in our master branch.

If you check out the master branch and install it locally, you will get rid of this problem. Alternatively, we plan to release pegasus v1.3.0 today. You can wait until v1.3.0 is released and install this version via pip.

Best,
Bo