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: setting an array element with a sequence. when running velocity.tl.fit.recover_reaction_rate_pars() #3

Open
lconan opened this issue Oct 2, 2023 · 1 comment

Comments

@lconan
Copy link

lconan commented Oct 2, 2023

Hi, thanks for the tool.
When I try to run the tutorial or the figure note books (3 of them), I got the similar error: ValueError: setting an array element with a sequence.
For example: when try Pancreas dataset - complete pipeline:

### recover dynamics for all genes
velocity.tl.fit.recover_reaction_rate_pars(adata, use_raw=False, n=100, 
                                 fit_kappa=True, fit_scaling=True)

this line of code, raises error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[14], line 2
      1 ### recover dynamics for all genes
----> 2 velocity.tl.fit.recover_reaction_rate_pars(adata, use_raw=False, n=100, 
      3                                  fit_kappa=True, fit_scaling=True)

File ~/sw/velocity_package/velocity/tools/fit.py:10, in recover_reaction_rate_pars(adata, use_raw, n, key, fit_scaling, parallel, n_cores, n_parts, inplace, fit_kappa)
      8 unspliced, spliced = adata.layers["unspliced" if use_raw else "Mu"], adata.layers["spliced" if use_raw else "Ms"]
      9 if parallel:
---> 10     alpha, beta, gamma, U_switch, scaling, likelihood, Pi = fit_all_parallel(unspliced, spliced, n=n,
     11                                                                              n_cores=n_cores, n_parts=n_parts,
     12                                                                              fit_scaling=fit_scaling,
     13                                                                              fit_kappa=fit_kappa)
     14 else:
     15     alpha, beta, gamma, U_switch, scaling, likelihood, Pi = fit_all(unspliced, spliced, n=n,
     16                                                                     fit_scaling=fit_scaling, fit_kappa=fit_kappa)

File ~/sw/velocity_package/velocity/tools/fit.py:88, in fit_all_parallel(unspliced, spliced, n, n_cores, n_parts, fit_scaling, fit_kappa)
     86 for i in result:
     87     r.extend(i)
---> 88 r = np.array(r)
     90 alpha, beta, gamma, U_switch, scaling, likelihood = r[:, 0], r[:, 1], r[:, 2], r[:, 3], r[:, 4], r[:, 5]
     91 Pi = np.stack(r[:, 6]).T

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (406, 7) + inhomogeneous part.
@Baschdl
Copy link

Baschdl commented Aug 29, 2024

This error unfortunately still persists.

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

2 participants