KevinMenden / scaden

Deep Learning based cell composition analysis with Scaden.
https://scaden.readthedocs.io
MIT License
71 stars 25 forks source link

IndexError: arrays used as indices must be of integer (or boolean) type #122

Open Wangyananblink opened 2 years ago

Wangyananblink commented 2 years ago

I am sorry to disturb you. I utilized the scaden to simulate a new h5ad file from the count.txt and the celltype.txt. But when I run the scaden process, I met "IndexError: arrays used as indices must be of integer (or boolean) type". When I utilize the h5ad generated by scanpy, the same question will appear. Could you give me any advice? Thank you in advance! Here are related information.

INFO Found 0 common genes. functions.py:88 INFO Pre-processing raw data ... functions.py:58 INFO Subsetting genes ... functions.py:61 INFO Scaling using log_min_max functions.py:65 Traceback (most recent call last): File "E:\SoftWare\Anaconda\envs\ForSAM\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "E:\SoftWare\Anaconda\envs\ForSAM\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "E:\SoftWare\Anaconda\envs\ForSAM\Scripts\scaden.exe__main.py", line 7, in File "E:\SoftWare\Anaconda\envs\ForSAM\lib\site-packages\scaden\main.py", line 48, in main cli() File "E:\SoftWare\Anaconda\envs\ForSAM\lib\site-packages\click\core.py", line 1130, in call return self.main(*args, kwargs) File "E:\SoftWare\Anaconda\envs\ForSAM\lib\site-packages\click\core.py", line 1055, in main rv = self.invoke(ctx) File "E:\SoftWare\Anaconda\envs\ForSAM\lib\site-packages\click\core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "E:\SoftWare\Anaconda\envs\ForSAM\lib\site-packages\click\core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "E:\SoftWare\Anaconda\envs\ForSAM\lib\site-packages\click\core.py", line 760, in invoke return callback(*args, *kwargs) File "E:\SoftWare\Anaconda\envs\ForSAM\lib\site-packages\scaden__main.py", line 159, in process var_cutoff=var_cutoff, File "E:\SoftWare\Anaconda\envs\ForSAM\lib\site-packages\scaden\process.py", line 37, in processing sig_genes=sig_genes) File "E:\SoftWare\Anaconda\envs\ForSAM\lib\site-packages\scaden\model\functions.py", line 67, in preprocess_h5ad_data raw_input.X = sample_scaling(raw_input.X, scaling_option) File "E:\SoftWare\Anaconda\envs\ForSAM\lib\site-packages\anndata_core\anndata.py", line 625, in X _subset(self._adata_ref.X, (self._oidx, self._vidx)), File "E:\SoftWare\Anaconda\envs\ForSAM\lib\functools.py", line 840, in wrapper return dispatch(args[0].class__)(args, **kw) File "E:\SoftWare\Anaconda\envs\ForSAM\lib\site-packages\anndata_core\index.py", line 127, in _subset return a[subset_idx] IndexError: arrays used as indices must be of integer (or boolean) type

ZhiyunGong commented 10 months ago

Hi I'm having the same issue. I'm wondering if you have figured out how to solve it? Thanks !!

snowGoose-Chen commented 9 months ago

I encountered the same error and managed to solve it. In my case, this error did not stem from the h5ad file generated by 'scaden simulate,' but rather from the prediction data having an incorrect format, which led to the error report 'INFO Found 0 common genes. functions.py:88.' It seems the input prediction data (a gene * sample matrix table) should be written with '\t' as the separator and without quotation marks. I resolved this error by preparing my prediction data in R using the following code: 'write.table(prediction_data, path, sep = "\t", quote = FALSE)'. Hope it will be helpful.