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

Pielou_e sometime crash with division by zero error #14

Open
Patg13 opened this issue Aug 4, 2023 · 2 comments
Open

Pielou_e sometime crash with division by zero error #14

Patg13 opened this issue Aug 4, 2023 · 2 comments
Labels
bug Something isn't working Long term dev For features/bugs/enhancement that will be done in the future

Comments

@Patg13
Copy link
Collaborator

Patg13 commented Aug 4, 2023

Normally happening during the metric step without rarefaction, temporary workaround is to remove the | exit_on_error on the alpha-significance check, that will skip the QZV generation. It's however not a good long term solution, It must be addressed.

Because metrics are more useful with rarefied data, this issue is low priority

For now, a bypass mecanism was added to the metric generation command so if it fails, it does not stop the script, the other metrics will still be generated. It is not a fix, so the issue is not closed, but it's not that problematic anymore

@Patg13 Patg13 added bug Something isn't working Long term dev For features/bugs/enhancement that will be done in the future labels Aug 4, 2023
@Patg13
Copy link
Collaborator Author

Patg13 commented Sep 8, 2023

Problem is caused by the pielou formula itself in python (qiime2 source code scikit-bio/skbio/diversity/alpha
/_base.py):

counts = _validate_counts_vector(counts)
return ((np.exp(shannon(counts, base=np.e)) - 1) /
(observed_otus(counts) - 1))

If the count of an observed feature is 1, the denominator will 1-1, so 0, causing the division by zero error.

@Patg13
Copy link
Collaborator Author

Patg13 commented Sep 12, 2023

One potential solution would be to force add 1 feature to every features < 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Long term dev For features/bugs/enhancement that will be done in the future
Projects
None yet
Development

No branches or pull requests

1 participant