maximilianh / cellBrowser

main repo: https://github.com/ucscGenomeBrowser/cellBrowser/ - Python pipeline and Javascript scatter plot library for single-cell datasets, http://cellbrowser.rtfd.org
https://github.com/ucscGenomeBrowser/cellBrowser/
GNU General Public License v3.0
104 stars 41 forks source link

Following a standard scanpy pipeline example gives index error #169

Closed inodb closed 2 years ago

inodb commented 4 years ago

Following https://cellbrowser.readthedocs.io/scanpy.html example using latest pip install of both scanpy and cellbrowser gives an error in the scanpy pipeline process.

When running

cbScanpy -e filtered_gene_bc_matrices/hg19/matrix.mtx -o scanpyOut -n pbmc3k

it gives an error

reindexing only valid with uniquely valued index objects

on the line

https://github.com/maximilianh/cellBrowser/blob/master/src/cbPyLib/cellbrowser/cellbrowser.py#L5173

in pdb doing a p adata[:, mito_genes] or any list of genes for that matter give the same error

Looks like some combined issue of cellbrowser, anndata and scanpy.

For anyone just looking to get something running. A quickfix is to comment out the else clause and thereby always doing doMito=False

LisaSikkema commented 4 years ago

thanks for documenting this, it more or less worked for me as well! I didn't comment out the complete else clause, but changed doMito = True to doMito = False after the else clause, and commented out the rest.

matthewspeir commented 2 years ago

Is this still an issue? If not, maybe we can close the issue?

maximilianh commented 2 years ago

Yes, this was still an issue. I'm sorry that it took me two years to get back to this, mea culpa, it indeed broke our cbScanpy example. The fix was easy, one only has to run adata.var_names_make_unique() before running the gene filters. Scanpy used to do this automatically. One reason why we couldn't reproduce this at first could have been that we used a slightly outdated scanpy version back in 2020.

Many thanks Matt for pinging this ticket.

maximilianh commented 2 years ago

Closing this issue now, though maybe Matt want to test that the example really works now...?