ManuSetty / wishbone

Wishbone is an algorithm to align cells along developmental trajectories with branches
GNU General Public License v2.0
41 stars 36 forks source link

tSNE ValueError with reduced rows/cells in scseq datasets #28

Closed JamesBadger closed 8 years ago

JamesBadger commented 8 years ago

Hello, sorry another tSNE error. Your example data is fine but my own scseq data fails tSNE with a ValueError.

I am able to reproduce this error using your example scseq data if I reduce the number of rows to 2000 or less. 3000 rows is fine. Traceback below, made using sample_scseq_data.csv but with rows cut to around 2000 (SCData: 2014 cells x 2307 genes). Thanks.

ValueError                                Traceback (most recent call last)
<ipython-input-47-304a98b05359> in <module>()
      1 NO_CMPNTS = 4
----> 2 scdata.run_tsne(n_components=NO_CMPNTS, perplexity=30)

/usr/local/lib/python3.5/dist-packages/wishbone/wb.py in run_tsne(self, n_components, perplexity)
    416             print('Reducing perplexity to %d since there are <100 cells in the dataset. ' % perplexity_limit)
    417             perplexity = perplexity_limit
--> 418         self.tsne = pd.DataFrame(bh_sne(data, perplexity=perplexity),
    419                                  index=self.data.index, columns=['x', 'y'])
    420 

/usr/local/lib/python3.5/dist-packages/tsne/__init__.py in bh_sne(data, pca_d, d, perplexity, theta)
     40 
     41     tsne = BH_SNE()
---> 42     Y = tsne.run(X, N, X.shape[1], d, perplexity, theta)
     43     return Y
     44 

tsne/bh_sne.pyx in bh_sne.BH_SNE.run (tsne/bh_sne.cpp:1496)()

ValueError: Buffer dtype mismatch, expected 'float64_t' but got 'float' 
ManuSetty commented 8 years ago

Thanks again for pointing this out. This is related to Issue #20. I have made changes to the run_tsne function and pushed into the develop branch. Please update your installation and let me know if you the issue persists.

Thanks

JamesBadger commented 8 years ago

After the update the issue is resolved. All files I have tried now work well. Thanks again for the prompt fix.