Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arrays used as indices must be of integer (or boolean) type #42

Open
aheravi opened this issue Aug 13, 2020 · 12 comments
Open

arrays used as indices must be of integer (or boolean) type #42

aheravi opened this issue Aug 13, 2020 · 12 comments

Comments

@aheravi
Copy link

aheravi commented Aug 13, 2020

Hi mnnpy,
I am getting an error using mnnpy.mnn_correct and wondering if you could please comment on my error. I have the latest version of numba and llvmlite.

Here is what I used:

adata_list = [adata_mnn[adata_mnn.obs['sample'] == i] for i in adata_mnn.obs['sample'].unique()]
corrected = mnnpy.mnn_correct(*adata_list, batch_key="sample")

and the error:

Starting MNN correct iteration. Reference batch: 0
Step 1 of 4: processing batch 1
  Looking for MNNs...

  Computing correction vectors...

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-43-69e6e2b5cdef> in <module>
----> 1 corrected = mnnpy.mnn_correct(*adata_list, batch_key="sample")

/Anaconda_python3/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:

/Anaconda_python3/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

and finally the version of the packages:

mnnpy==0.1.9.5
numpy==1.19.1 scipy==1.5.0 pandas==1.0.5 scikit-learn==0.23.1 statsmodels==0.11.1 python-igraph==0.8.2 louvain==0.7.0 leidenalg==0.8.1
numba==0.50.1
llvmlite==0.33.0+1.g022ab0f

@Gpasquini
Copy link

Having the identical error here. Happening at step 2 of 4.

@csgroen
Copy link

csgroen commented Oct 21, 2020

Same issue here.
I traced it to compute_correction. Of note is that mnn_ref and mnn_new are empty, which may be causing the error.

@ebruder
Copy link

ebruder commented Dec 9, 2020

@csgroen Were you able to resolve the error? I am getting the exact same error and mnn_ref and mnn_new are empty for me as well.

@csgroen
Copy link

csgroen commented Dec 9, 2020

@ebruder no, I ended up switching strategies and didn't use this method

@ebruder
Copy link

ebruder commented Dec 9, 2020

@csgroen Is there any other python packages you know doing MNNcorrect?

@ebruder
Copy link

ebruder commented Dec 9, 2020

@chriscainx any suggestions on how to resolve this issue of mnn_ref and mnn_new being empty out of find_mutual_nn()?

@HelloWorldLTY
Copy link

Any solution here? I still cannot solve this problem.

@dongzuoyk
Copy link

maybe this problem was caused by numba package,u can modifiy utils.py,when i deleted some lines including @jit,i solved this problem.

@HelloWorldLTY
Copy link

Hi, I have another method to solve it. We can enlarge the value of k, for example using k=2000 rather than k=20, it can also solve the problem. However, I cannot guarantee that it will lead to the best performance of mnn.

@matq007
Copy link

matq007 commented Aug 13, 2021

Hi, I've solved the issue using this package setup

- anndata==0.7.1
- fa2==0.3.5
- h5py==2.9.0
- loompy==2.0.17
- numpy==1.17.3
- pandas==0.25.3
- scanpy==1.4.4.post1
- scikit-learn==0.22.1
- numba==0.45.0
- llvmlite==0.31.0
- mnnpy==0.1.9.5
- cython==0.29.14
- python-igraph==0.9.6
- umap-learn==0.3.10
- llvmlite==0.30

@melancholy12
Copy link

Same problem here. Are there any method to solve this issue?

@HelloWorldLTY
Copy link

HelloWorldLTY commented Feb 7, 2022

Same problem here. Are there any method to solve this issue?

I implemented a new version without such program. You can take a look at it here:

https://github.com/HelloWorldLTY/mnnpy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants