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

ZeroDivisionError: integer division or modulo by zero #139

Closed
simonekats opened this issue Apr 22, 2024 · 2 comments
Closed

ZeroDivisionError: integer division or modulo by zero #139

simonekats opened this issue Apr 22, 2024 · 2 comments

Comments

@simonekats
Copy link

masks = palantir.presults.select_branch_cells(adata, eps=0)
plt.show()


ZeroDivisionError Traceback (most recent call last)
Cell In[545], line 1
----> 1 masks = palantir.presults.select_branch_cells(adata, eps=0)
2 plt.show()

File ~/anaconda3/lib/python3.10/site-packages/palantir/presults.py:555, in select_branch_cells(ad, pseudo_time_key, fate_prob_key, q, eps, masks_key, save_as_df)
552 n = fate_probs.shape[0]
554 step = n // PSEUDOTIME_RES
--> 555 nsteps = n // step
556 for i in range(nsteps):
557 l, r = i * step, (i + 1) * step

ZeroDivisionError: integer division or modulo by zero

katosh added a commit that referenced this issue Apr 22, 2024
@katosh
Copy link
Collaborator

katosh commented Apr 22, 2024

Hi @simonekats,

Thank you for reporting. My guess is that your dataset has a very small number of cells (<500). The best solution would be to increase the number of cells in tour dataset, as results for such a small sample size might vary. As a quick fix to make this work for the given dataset you can run

palantir.presults.PSEUDOTIME_RES = ad.n_obs

before running the selection. I also made a patch that should avoid this error in the future. You can install the patched version now with

pip install --ignore-installed --no-deps 'git+https://github.com/dpeerlab/Palantir'

Please let me know if the issue persist or if we can close this.

@simonekats
Copy link
Author

The first code solved it thank you so much!

@katosh katosh closed this as completed Apr 26, 2024
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