mnnpy icon indicating copy to clipboard operation
mnnpy copied to clipboard

IndexError

Open adamgayoso opened this issue 5 years ago • 3 comments

I get the following error when using MNN with 4000 genes, but do not get it when testing on 100 genes. This is with the newest numba version (0.47.0)

Performing cosine normalization...
Starting MNN correct iteration. Reference batch: 0
Step 1 of 1: processing batch 1
  Looking for MNNs...
  Computing correction vectors...
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-19-9ee4a0f9a20e> in <module>
     23 sc.pp.log1p(mnn_input_adata_1_rna)
     24 
---> 25 adata_mnn_rna, _, _ = mnn_correct(mnn_input_adata_0_rna, mnn_input_adata_1_rna, n_jobs=None)

/data/yosef2/users/adamgayoso/.pyenv/versions/scvi/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:

/data/yosef2/users/adamgayoso/.pyenv/versions/scvi/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

Update: the code works with numba==0.45.0.

adamgayoso avatar Jan 04 '20 18:01 adamgayoso

Hi, did you solve this problem? I also encountered the same problem

tkisss avatar Jan 06 '20 06:01 tkisss

Yes, it worked with numba version 0.45.0 and llvmlite 0.30.0

adamgayoso avatar Jan 06 '20 06:01 adamgayoso

Yes, it worked with numba version 0.45.0 and llvmlite 0.30.0

It works! Thank you very much!

tkisss avatar Jan 06 '20 14:01 tkisss