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.

When I ran sce.pp.mnn_correct(), there was an IndexError

See original GitHub issue
-----------------------------------------------------
IndexError          Traceback (most recent call last)
<ipython-input-22-408c81d5d845> in <module>
      1 t1 = time.time()
----> 2 corrected = sce.pp.mnn_correct(scdata[scdata.obs['batch']==batch_[0]],scdata[scdata.obs['batch']==batch_[1]])
      3 t2 = time.time()
      4 print('Took '+str(timedelta(seconds=t2-t1)))

~/miniconda3/lib/python3.7/site-packages/scanpy/external/pp/_mnn_correct.py in mnn_correct(var_index, var_subset, batch_key, index_unique, batch_categories, k, sigma, cos_norm_in, cos_norm_out, svd_dim, var_adj, compute_angle, mnn_order, svd_mode, do_concatenate, save_raw, n_jobs, *datas, **kwargs)
    152         save_raw=save_raw,
    153         n_jobs=n_jobs,
--> 154         **kwargs,
    155     )
    156     return datas, mnn_list, angle_list

~/miniconda3/lib/python3.7/site-packages/mnnpy/mnn.py in mnn_correct(var_index, var_subset, batch_key, index_unique, batch_categories, k, sigma, cos_norm_in, cos_norm_out, svd_dim, var_adj, compute_angle, mnn_order, svd_mode, do_concatenate, save_raw, n_jobs, *datas, **kwargs)
    124                                 cos_norm_out=cos_norm_out, svd_dim=svd_dim, var_adj=var_adj,
    125                                 compute_angle=compute_angle, mnn_order=mnn_order,
--> 126                                 svd_mode=svd_mode, do_concatenate=do_concatenate, **kwargs)
    127         print('Packing AnnData object...')
    128         if do_concatenate:

~/miniconda3/lib/python3.7/site-packages/mnnpy/mnn.py in mnn_correct(var_index, var_subset, batch_key, index_unique, batch_categories, k, sigma, cos_norm_in, cos_norm_out, svd_dim, var_adj, compute_angle, mnn_order, svd_mode, do_concatenate, save_raw, n_jobs, *datas, **kwargs)
    180         print('  Computing correction vectors...')
    181         correction_in = compute_correction(ref_batch_in, new_batch_in, mnn_ref, mnn_new,
--> 182                                            new_batch_in, sigma)
    183         if not same_set:
    184             correction_out = compute_correction(ref_batch_out, new_batch_out, mnn_ref, mnn_new,

IndexError: arrays used as indices must be of integer (or boolean) type
corrected = sce.pp.mnn_correct(*[scdata[scdata.obs['batch']==batch] for batch in batch_])

Versions:

scanpy==1.4.5 anndata==0.7rc1 umap==0.3.7 numpy==1.18.0 scipy==1.3.1 pandas==0.23.4 scikit-learn==0.19.1 statsmodels==0.10.1 python-igraph==0.7.1 louvain==0.6.1

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
adamgayosocommented, Jan 6, 2020

I believe there are some issues with the newest version of llvmlite.

https://github.com/chriscainx/mnnpy/issues/30

0reactions
flying-sheepcommented, Jan 13, 2020

Since the bug happens in mnnpy and isn’t caused by the scanpy wrapper, this is not a scanpy bug: chriscainx/mnnpy#30

Read more comments on GitHub >

github_iconTop Results From Across the Web

When I ran sce.pp.mnn_correct(), there was an IndexError #974
Here's an example with the newest numba and llvmlite. I noticed with fewer cells it works. import scanpy as sc import anndata ...
Read more >
scanpy.external.pp.mnn_correct - Read the Docs
Depending on do_concatenate , returns matrices or AnnData objects in the original order containing corrected expression values or a concatenated matrix or ...
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