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

ValueError: could not broadcast input array from shape #128

Open
wariobrega opened this issue Nov 27, 2023 · 3 comments
Open

ValueError: could not broadcast input array from shape #128

wariobrega opened this issue Nov 27, 2023 · 3 comments
Labels
bug Something isn't working question Further information is requested

Comments

@wariobrega
Copy link

Hello,

I have a dataset made of unpaired RNA/ATAC seq data.

I performed PCA / nearest neighbors on each modality using a standard approach and I was going for the joint neighbors embedding.

I obtain however the following error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
[/home/dcapocef/Projects/EPINet/scripts/screen_orig_data.ipynb](https://file+.vscode-resource.vscode-cdn.net/home/dcapocef/Projects/EPINet/scripts/screen_orig_data.ipynb) Cell 31 line 1
----> [1](vscode-notebook-cell:/home/dcapocef/Projects/EPINet/scripts/screen_orig_data.ipynb#X54sZmlsZQ%3D%3D?line=0) mu.pp.neighbors(ctrl)

File [~/miniconda3/envs/muon/lib/python3.10/site-packages/muon/_core/preproc.py:465](https://file+.vscode-resource.vscode-cdn.net/home/dcapocef/Projects/EPINet/scripts/~/miniconda3/envs/muon/lib/python3.10/site-packages/muon/_core/preproc.py:465), in neighbors(mdata, n_neighbors, n_bandwidth_neighbors, n_multineighbors, neighbor_keys, metric, low_memory, key_added, weight_key, add_weights_to_modalities, eps, copy, random_state)
    [463](https://file+.vscode-resource.vscode-cdn.net/home/dcapocef/Projects/EPINet/scripts/~/miniconda3/envs/muon/lib/python3.10/site-packages/muon/_core/preproc.py:463)         currtheta = theta
    [464](https://file+.vscode-resource.vscode-cdn.net/home/dcapocef/Projects/EPINet/scripts/~/miniconda3/envs/muon/lib/python3.10/site-packages/muon/_core/preproc.py:464)     else:
--> [465](https://file+.vscode-resource.vscode-cdn.net/home/dcapocef/Projects/EPINet/scripts/~/miniconda3/envs/muon/lib/python3.10/site-packages/muon/_core/preproc.py:465)         thetas[:, lasti] = theta
    [466](https://file+.vscode-resource.vscode-cdn.net/home/dcapocef/Projects/EPINet/scripts/~/miniconda3/envs/muon/lib/python3.10/site-packages/muon/_core/preproc.py:466)         lasti += 1
    [467](https://file+.vscode-resource.vscode-cdn.net/home/dcapocef/Projects/EPINet/scripts/~/miniconda3/envs/muon/lib/python3.10/site-packages/muon/_core/preproc.py:467) ratios[ratioidx, i1] = currtheta [/](https://file+.vscode-resource.vscode-cdn.net/) (np.max(thetas, axis=1) + eps)

ValueError: could not broadcast input array from shape (0,) into shape (5106,)

This usually happens after a couple of minutes after running the command, so way along the line

The data is made of 5106 Cells from ATAC and 4215 Cells from RNA.

I am using the latest stable version of muon on a conda environment running python 3.10. The conda env contains only muon and its minimal dependencies + ipython kernel/jupyter specs.

Can you help me understand this issue and how to fix it?

Thanks,

Daniele

@wariobrega wariobrega added the bug Something isn't working label Nov 27, 2023
@jefferyUstc
Copy link

Today I also encountered the same bug. Any fix now?

@jefferyUstc
Copy link

It seems that a little bit different from the above, this is the traceback info

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[675], line 1
----> 1 mu.pp.neighbors(mdata_cc, key_added='wnn', n_neighbors=15)
      2 mu.tl.umap(mdata_cc, neighbors_key='wnn', random_state=10)

File [/home/to/envs/scverse/lib/python3.10/site-packages/muon/_core/preproc.py:491](http://localhost:8989/home/to/envs/scverse/lib/python3.10/site-packages/muon/_core/preproc.py#line=490), in neighbors(mdata, n_neighbors, n_bandwidth_neighbors, n_multineighbors, neighbor_keys, metric, low_memory, key_added, weight_key, add_weights_to_modalities, eps, copy, random_state)
    489         currtheta = theta
    490     else:
--> 491         thetas[:, lasti] = theta
    492         lasti += 1
    493 ratios[ratioidx, i1] = currtheta [/](http://localhost:8989/) (np.max(thetas, axis=1) + eps)

ValueError: could not broadcast input array from shape (0,) into shape (13498,)

@gtca
Copy link
Collaborator

gtca commented Oct 17, 2024

Hey @jefferyUstc, thanks for reporting this.

So far I wasn't able to reproduce this error.
Is there any data that we could reproduce it on?
Does it also happen with the latest version of muon from the main branch?

@gtca gtca added the question Further information is requested label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants